/* ============================================
   Animations & Transitions
   ============================================ */

/* Keyframe Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Page Load Animations */
.page-load {
    animation: fadeIn 0.5s ease-in-out;
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.fade-in-down {
    animation: fadeInDown 0.6s ease-out;
}

.slide-in-left {
    animation: slideInLeft 0.6s ease-out;
}

.slide-in-right {
    animation: slideInRight 0.6s ease-out;
}

.scale-in {
    animation: scaleIn 0.4s ease-out;
}

/* Staggered Animation Delays */
.animate-delay-1 {
    animation-delay: 0.1s;
}

.animate-delay-2 {
    animation-delay: 0.2s;
}

.animate-delay-3 {
    animation-delay: 0.3s;
}

.animate-delay-4 {
    animation-delay: 0.4s;
}

.animate-delay-5 {
    animation-delay: 0.5s;
}

/* Header Animations */
.header {
    animation: fadeInDown 0.4s ease-out;
}

.header-top {
    animation: fadeIn 0.3s ease-out;
}

.logo {
    transition: transform var(--transition-base);
}

.logo:hover {
    transform: scale(1.05);
}

.logo-img {
    transition: transform var(--transition-base);
}

.logo:hover .logo-img {
    transform: scale(1.1);
}

/* Navigation Menu Animations */
.nav-menu li {
    position: relative;
}

.nav-menu li::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width var(--transition-base);
}

.nav-menu li:hover::after,
.nav-menu li.active::after {
    width: 100%;
}

/* Button Animations */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary:active {
    transform: scale(0.98) translateY(0);
}

.btn-secondary:active {
    transform: scale(0.98) translateY(0);
}

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

/* Product Card Animations */
.product-card {
    animation: fadeInUp 0.5s ease-out;
}

.product-card:hover {
    animation: none; /* Disable initial animation on hover */
}

.product-image-wrapper {
    overflow: hidden;
}

.product-image {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card:hover .product-image {
    transform: scale(1.08);
}

.product-actions-overlay {
    transform: translateY(-10px);
    transition: all var(--transition-base);
}

.product-card:hover .product-actions-overlay {
    transform: translateY(0);
}

/* Category Card Animations */
.category-card {
    animation: scaleIn 0.4s ease-out;
}

.category-card:hover {
    animation: none;
}

.category-icon {
    transition: transform var(--transition-base);
}

.category-card:hover .category-icon {
    transform: scale(1.2) rotate(5deg);
}

/* Carousel Animations */
.carousel-container {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-item {
    transition: opacity var(--transition-base);
}

.carousel-nav {
    transition: all var(--transition-base);
}

.carousel-nav:hover:not(:disabled) {
    transform: scale(1.1);
    background: var(--primary-dark);
}

.carousel-nav:active:not(:disabled) {
    transform: scale(0.95);
}

.carousel-dot {
    transition: all var(--transition-base);
}

.carousel-dot:hover {
    transform: scale(1.2);
}

.carousel-dot.active {
    animation: pulse 2s infinite;
}

/* Dropdown Animations */
.currency-dropdown,
.language-dropdown,
.mega-menu {
    animation: fadeInDown 0.3s ease-out;
}

/* Form Animations */
.form-input,
.form-select,
.form-textarea {
    transition: all var(--transition-base);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    animation: pulse 0.3s ease-out;
}

.form-group {
    animation: fadeInUp 0.4s ease-out;
}

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

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--gray-200) 0%,
        var(--gray-100) 50%,
        var(--gray-200) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* Badge Animations */
.badge {
    animation: scaleIn 0.3s ease-out;
}

.badge-new {
    animation: bounce 1s infinite;
}

/* Modal Animations */
.modal {
    animation: scaleIn 0.3s ease-out;
}

.modal-backdrop {
    animation: fadeIn 0.3s ease-out;
}

/* Toast/Notification Animations */
.toast {
    animation: slideInRight 0.4s ease-out;
}

.toast.hide {
    animation: slideInRight 0.4s ease-out reverse;
}

/* Scroll Animations */
.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Counter Animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.count-up {
    animation: countUp 0.6s ease-out;
}

/* Flash Deals Timer Animation */
.flash-deals-timer {
    animation: pulse 2s infinite;
}

.flash-deals-timer .timer-digit {
    transition: transform var(--transition-base);
}

.flash-deals-timer .timer-digit:last-child {
    animation: pulse 1s infinite;
}

/* Tier Badge Animations */
.tier-badge {
    transition: all var(--transition-base);
}

.tier-badge:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: var(--shadow-xl);
}

/* Search Bar Animation */
.search-form {
    transition: all var(--transition-base);
}

.search-form:focus-within {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

.search-input:focus {
    animation: pulse 0.3s ease-out;
}

/* Cart Sidebar Animation */
.cart-sidebar {
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-sidebar.closing {
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1) reverse;
}

/* Overlay Animation */
.overlay {
    animation: fadeIn 0.3s ease-out;
}

.overlay.closing {
    animation: fadeIn 0.3s ease-out reverse;
}

/* Price Animation */
.price-current {
    transition: all var(--transition-base);
}

.product-card:hover .price-current {
    transform: scale(1.05);
    color: var(--primary-dark);
}

/* Rating Stars Animation */
.rating-stars {
    transition: all var(--transition-base);
}

.product-card:hover .rating-stars {
    transform: scale(1.1);
}

/* Vendor Badge Animation */
.vendor-badge {
    animation: fadeInUp 0.5s ease-out;
    transition: all var(--transition-base);
}

.vendor-badge:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Discount Badge Animation */
.discount-badge {
    animation: bounce 1s infinite;
}

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

/* Reduce Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .product-card {
        animation-duration: 0.3s;
    }
    
    .fade-in-up,
    .fade-in-down,
    .slide-in-left,
    .slide-in-right {
        animation-duration: 0.4s;
    }
}

