/* Custom styles for SavinEasy Store */

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    opacity: 0;
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Product card hover effects */
.card-product {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-product:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Badge pulse animation */
.badge-promo {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.9;
        transform: scale(1.05);
    }
}

/* Ripple effect for buttons */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transform: scale(0);
    animation: ripple-animation 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

button, .btn-primary, .btn-secondary, a[class*="btn"] {
    position: relative;
    overflow: hidden;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Text truncation */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Sticky header styles */
nav.scrolled {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
}

/* Back to top button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: #FCD34D !important;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    transition: transform 0.3s ease;
    max-width: 90%;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast-success {
    background: #10b981;
}

.toast-error {
    background: #ef4444;
}

.toast-info {
    background: #3b82f6;
}

/* Search focused state */
.search-focused {
    transform: scale(1.02);
    transition: transform 0.3s ease;
}

/* Form error states */
input.error, textarea.error {
    border-color: #ef4444 !important;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Cart counter animation */
.cart-counter {
    transition: all 0.3s ease;
}

.cart-counter.animate-bounce {
    animation: bounce 1s;
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* Mobile menu */
.mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.mobile-menu:not(.hidden) {
    max-height: 500px;
    opacity: 1;
}

.mobile-menu-btn.active svg {
    transform: rotate(90deg);
    transition: transform 0.3s ease;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .back-to-top {
        width: 45px;
        height: 45px;
        bottom: 20px;
        right: 20px;
        font-size: 20px;
    }
    
    .card-product {
        margin-bottom: 1rem;
    }
    
    /* Improve touch targets */
    button, a.btn-primary, a.btn-secondary {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Better spacing on mobile */
    section {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
    
    /* Stack grid items on mobile */
    .grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* Reduce font sizes on mobile */
    h1 {
        font-size: 1.75rem !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
    
    h3 {
        font-size: 1.25rem !important;
    }
    
    /* Better product card spacing */
    .card-product .p-3,
    .card-product .p-4 {
        padding: 0.75rem;
    }
    
    /* Hide decorative elements on mobile */
    .hero-section .absolute {
        display: none;
    }
}

@media (max-width: 768px) {
    /* Stack grid items on tablet */
    .grid {
        gap: 1rem;
    }
    
    /* Reduce font sizes slightly */
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
}

/* Enhanced hover effects */
a, button {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

a:hover {
    transform: translateY(-2px);
}

/* Category cards hover */
.bg-gradient-to-br:hover {
    transform: translateY(-5px) scale(1.05);
    transition: all 0.3s ease;
}

/* Collection cards hover */
.group:hover .group-hover\:scale-110 {
    transform: scale(1.1);
}

/* Product image zoom */
.card-product img,
.card-product [class*="aspect"] {
    transition: transform 0.5s ease;
}

.card-product:hover img,
.card-product:hover [class*="aspect"] {
    transform: scale(1.1);
}

/* Button hover effects */
.btn-primary:hover,
.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* Fix blur issue on footer Learn More button */
footer a[href="/about-us/"] {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    transform: translateZ(0);
}

/* Navigation links hover */
nav a:hover {
    color: inherit;
}

/* Smooth transitions for all interactive elements */
* {
    transition-property: color, background-color, border-color, transform, opacity;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

/* Loading skeleton for images (only for lazy loaded) */
img[data-src] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    min-height: 200px;
}

img[data-src].loaded {
    background: none;
    animation: none;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Cart button styles */
.add-to-cart-btn {
    transition: all 0.3s ease;
}

.add-to-cart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.added-to-cart {
    background-color: #10b981 !important;
    color: white !important;
    border-color: #10b981 !important;
    cursor: default;
    opacity: 0.9;
    transition: all 0.3s ease;
}

.added-to-cart:hover {
    background-color: #059669 !important;
    border-color: #059669 !important;
    transform: none;
    box-shadow: none;
}

.added-to-cart svg {
    display: inline-block;
    animation: checkmark 0.5s ease;
}

@keyframes checkmark {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Print styles */
@media print {
    .back-to-top,
    nav,
    footer,
    button {
        display: none !important;
    }
}

