/**
 * Enhanced Animations & Micro-interactions
 *
 * @package NEWTIV
 * @since 1.0.0
 */

/* ============================================
   Smooth Scroll Animations
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@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 pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ============================================
   Animate on Scroll
   ============================================ */
.animate-on-scroll {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out forwards;
}

.animate-on-scroll.animated {
    opacity: 1;
}

.animate-fade-up {
    animation-delay: 0.1s;
}

.animate-fade-up:nth-child(1) { animation-delay: 0.1s; }
.animate-fade-up:nth-child(2) { animation-delay: 0.2s; }
.animate-fade-up:nth-child(3) { animation-delay: 0.3s; }
.animate-fade-up:nth-child(4) { animation-delay: 0.4s; }
.animate-fade-up:nth-child(5) { animation-delay: 0.5s; }
.animate-fade-up:nth-child(6) { animation-delay: 0.6s; }

/* ============================================
   Button Animations
   ============================================ */
.button,
button,
input[type="submit"],
input[type="button"] {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.button::before,
button::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;
}

.button:hover::before,
button:hover::before {
    width: 300px;
    height: 300px;
}

.button:active,
button:active {
    transform: scale(0.98);
}

/* ============================================
   Card Hover Effects
   ============================================ */
.entry,
.product-card,
.card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.entry:hover,
.product-card:hover,
.card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* ============================================
   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: 3px solid rgba(37, 99, 235, 0.3);
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   Success/Error Animations
   ============================================ */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notice,
.woocommerce-message,
.woocommerce-error,
.woocommerce-info {
    animation: slideDown 0.4s ease-out;
}

/* ============================================
   Smooth Page Transitions
   ============================================ */
.site-main {
    animation: fadeIn 0.4s ease-out;
}

.archive-hero-section,
.shop-hero-section,
.single-post-hero {
    animation: fadeInUp 0.6s ease-out;
}

/* ============================================
   Micro-interactions
   ============================================ */
a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
    border-radius: 4px;
}

input:focus,
textarea:focus,
select:focus {
    transform: scale(1.02);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ============================================
   Stagger Animation for Lists
   ============================================ */
.posts-wrapper .entry,
.products-grid .product {
    animation: fadeInUp 0.6s ease-out backwards;
}

.posts-wrapper .entry:nth-child(1) { animation-delay: 0.1s; }
.posts-wrapper .entry:nth-child(2) { animation-delay: 0.2s; }
.posts-wrapper .entry:nth-child(3) { animation-delay: 0.3s; }
.posts-wrapper .entry:nth-child(4) { animation-delay: 0.4s; }
.posts-wrapper .entry:nth-child(5) { animation-delay: 0.5s; }
.posts-wrapper .entry:nth-child(6) { animation-delay: 0.6s; }

/* ============================================
   Smooth Scroll Behavior
   ============================================ */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

