/**
 * ShopCore Professional Animations
 * Modern CSS animations for premium user experience
 */

/* ==========================================
   ANIMATION KEYFRAMES
   ========================================== */

/* Fade In Up */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Fade In Left */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade In Right */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Zoom In */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Slide Up */
@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Pulse */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

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

/* Bounce In */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

/* Rotate In */
@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-180deg);
    }
    to {
        opacity: 1;
        transform: rotate(0);
    }
}

/* ==========================================
   ANIMATION CLASSES
   ========================================== */

.animated {
    animation-duration: 0.6s;
    animation-fill-mode: both;
}

.animated.delay-1 { animation-delay: 0.1s; }
.animated.delay-2 { animation-delay: 0.2s; }
.animated.delay-3 { animation-delay: 0.3s; }
.animated.delay-4 { animation-delay: 0.4s; }
.animated.delay-5 { animation-delay: 0.5s; }

.animated.fast { animation-duration: 0.3s; }
.animated.slow { animation-duration: 1s; }

.fadeInUp { animation-name: fadeInUp; }
.fadeIn { animation-name: fadeIn; }
.fadeInLeft { animation-name: fadeInLeft; }
.fadeInRight { animation-name: fadeInRight; }
.zoomIn { animation-name: zoomIn; }
.slideUp { animation-name: slideUp; }
.pulse { animation-name: pulse; }
.shake { animation-name: shake; }
.bounceIn { animation-name: bounceIn; }
.rotateIn { animation-name: rotateIn; }

/* ==========================================
   ENHANCED PRODUCT CARDS
   ========================================== */

.product-card {
    position: relative;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.product-card: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);
}

.product-card__image {
    position: relative;
    overflow: hidden;
    padding-top: 100%; /* 1:1 Aspect Ratio */
}

.product-card__image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card:hover .product-card__image img {
    transform: scale(1.1);
}

/* Badge */
.product-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #ef4444;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    z-index: 2;
    animation: pulse 2s infinite;
}

.product-badge.sale {
    background: #ef4444;
}

.product-badge.new {
    background: #10b981;
}

.product-badge.featured {
    background: #f59e0b;
}

/* Quick View Button */
.quick-view-btn {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
    background: white;
    color: #2563eb;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: none;
    cursor: pointer;
    z-index: 2;
    white-space: nowrap;
}

.quick-view-btn:hover {
    background: #2563eb;
    color: white;
    transform: translateX(-50%) translateY(0) scale(1.05);
}

.product-card:hover .quick-view-btn {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Wishlist & Compare Icons */
.product-icons {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 2;
}

.icon-btn {
    width: 36px;
    height: 36px;
    background: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: scale(0.8);
}

.product-card:hover .icon-btn {
    opacity: 1;
    transform: scale(1);
}

.icon-btn:hover {
    background: #2563eb;
    color: white;
    transform: scale(1.1);
}

.icon-btn.active {
    background: #ef4444;
    color: white;
}

/* ==========================================
   LOADING SKELETONS
   ========================================== */

.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

.skeleton-card {
    border-radius: 12px;
    overflow: hidden;
}

.skeleton-image {
    width: 100%;
    padding-top: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-title {
    height: 20px;
    margin: 12px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-text {
    height: 14px;
    margin: 8px 12px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-price {
    height: 24px;
    width: 80px;
    margin: 12px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* ==========================================
   BUTTON ANIMATIONS
   ========================================== */

.btn-animated {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-animated:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.btn-animated:active {
    transform: translateY(0);
}

/* Gradient Button */
.btn-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    transition: all 0.3s ease;
}

.btn-gradient:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* ==========================================
   HERO SECTION ANIMATIONS
   ========================================== */

.hero-content {
    animation: fadeInUp 0.8s ease-out;
}

.hero-title {
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.hero-subtitle {
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.hero-cta {
    animation: fadeInUp 0.8s ease-out 0.6s both;
}

/* ==========================================
   SMOOTH SCROLL
   ========================================== */

html {
    scroll-behavior: smooth;
}

/* ==========================================
   PAGE TRANSITIONS
   ========================================== */

body {
    transition: opacity 0.3s ease;
}

body.page-transitioning {
    opacity: 0;
}

/* ==========================================
   HOVER EFFECTS
   ========================================== */

.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.hover-scale {
    transition: transform 0.3s ease;
}

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

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.4);
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    .product-card:hover {
        transform: none;
    }
    
    .product-icons .icon-btn {
        opacity: 1;
        transform: scale(1);
    }
    
    .quick-view-btn {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ==========================================
   IMAGE LAZY LOADING
   ========================================== */

img[data-src] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img[data-src].loaded {
    opacity: 1;
}

/* ==========================================
   UTILITY ANIMATIONS
   ========================================== */

.spin {
    animation: spin 1s linear infinite;
}

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

.fade-in-fast { animation: fadeIn 0.3s ease; }
.fade-in { animation: fadeIn 0.6s ease; }
.fade-in-slow { animation: fadeIn 1s ease; }

/* ==========================================
   ACCESSIBILITY
   ========================================== */

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