/**
 * Micro-Interactions CSS - Forever BE Premium
 *
 * Subtle animations and transitions for enhanced UX
 * - Button hover/focus states
 * - Card hover effects
 * - Link transitions
 * - Form input focus
 * - Menu interactions
 * - Touch feedback
 *
 * @package Forever_BE_Premium
 * @since 2.0.0
 * @author BMAD Developer Agent (Amelia)
 */

/* ============================================
   1. CSS CUSTOM PROPERTIES - Animation Tokens
   ============================================ */
:root {
    /* Timing functions */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);

    /* Durations */
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;

    /* Hover transforms */
    --hover-lift: translateY(-2px);
    --hover-scale: scale(1.02);
    --active-scale: scale(0.98);
}

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

/* ============================================
   2. BUTTONS - Hover, Focus, Active States
   ============================================ */

/* Primary Buttons */
.btn,
.btn-primary,
.btn-cta,
button[type="submit"],
input[type="submit"] {
    position: relative;
    overflow: hidden;
    transition:
        transform var(--duration-fast) var(--ease-out-expo),
        box-shadow var(--duration-fast) var(--ease-out-expo),
        background-color var(--duration-fast) ease;
}

.btn:hover,
.btn-primary:hover,
.btn-cta:hover,
button[type="submit"]:hover,
input[type="submit"]:hover {
    transform: var(--hover-lift);
    box-shadow: 0 4px 12px rgba(30, 90, 62, 0.25);
}

.btn:active,
.btn-primary:active,
.btn-cta:active,
button[type="submit"]:active,
input[type="submit"]:active {
    transform: var(--active-scale);
    transition-duration: 50ms;
}

.btn:focus-visible,
.btn-primary:focus-visible,
button[type="submit"]:focus-visible {
    outline: 3px solid rgba(30, 90, 62, 0.5);
    outline-offset: 3px;
}

/* Button ripple effect */
.btn::after,
.btn-primary::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease, opacity 0.4s ease;
    opacity: 0;
    pointer-events: none;
}

.btn:active::after,
.btn-primary:active::after {
    width: 200%;
    height: 200%;
    opacity: 1;
    transition: width 0s, height 0s, opacity 0s;
}

/* Secondary/Outline Buttons */
.btn-secondary,
.btn-outline {
    transition:
        transform var(--duration-fast) var(--ease-out-expo),
        border-color var(--duration-fast) ease,
        background-color var(--duration-fast) ease,
        color var(--duration-fast) ease;
}

.btn-secondary:hover,
.btn-outline:hover {
    transform: var(--hover-lift);
}

/* Gold/CTA Buttons */
.btn-gold {
    transition:
        transform var(--duration-fast) var(--ease-out-expo),
        box-shadow var(--duration-fast) var(--ease-out-expo),
        filter var(--duration-fast) ease;
}

.btn-gold:hover {
    transform: var(--hover-lift);
    box-shadow: 0 6px 20px rgba(251, 191, 36, 0.4);
    filter: brightness(1.05);
}

/* ============================================
   3. CARDS - Hover Effects
   ============================================ */

/* Product Cards */
.product-card-premium,
.product-card {
    transition:
        transform var(--duration-normal) var(--ease-out-expo),
        box-shadow var(--duration-normal) var(--ease-out-expo);
}

.product-card-premium:hover,
.product-card:hover {
    transform: translateY(-4px);
    box-shadow:
        0 12px 24px -8px rgba(0, 0, 0, 0.15),
        0 4px 8px -2px rgba(0, 0, 0, 0.08);
}

.product-card-premium .product-image,
.product-card .product-image {
    transition: transform var(--duration-slow) var(--ease-out-expo);
}

.product-card-premium:hover .product-image,
.product-card:hover .product-image {
    transform: scale(1.05);
}

/* Testimonial Cards */
.testimonial-card-premium,
.written-testimonial-card {
    transition:
        transform var(--duration-normal) var(--ease-out-expo),
        box-shadow var(--duration-normal) ease;
}

.testimonial-card-premium:hover,
.written-testimonial-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 32px -8px rgba(0, 0, 0, 0.12);
}

/* Benefit Cards */
.benefit-card-premium,
.avantage-card {
    transition:
        transform var(--duration-normal) var(--ease-out-expo),
        box-shadow var(--duration-normal) ease,
        border-color var(--duration-fast) ease;
}

.benefit-card-premium:hover,
.avantage-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 20px 40px -12px rgba(30, 90, 62, 0.15);
    border-color: var(--brand-green, #1e5a3e);
}

/* Generic Cards */
.card,
[class*="card-"] {
    transition:
        transform var(--duration-normal) var(--ease-out-expo),
        box-shadow var(--duration-normal) ease;
}

/* ============================================
   4. LINKS - Underline Animation
   ============================================ */

/* Animated underline for text links */
a:not(.btn):not(.no-underline):not([class*="card"]):not(.product-cta) {
    position: relative;
    text-decoration: none;
    transition: color var(--duration-fast) ease;
}

/* Underline animation - grows from left */
.content a,
.prose a,
article a:not(.btn) {
    background-image: linear-gradient(currentColor, currentColor);
    background-size: 0% 1px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    transition:
        background-size var(--duration-normal) var(--ease-out-expo),
        color var(--duration-fast) ease;
}

.content a:hover,
.prose a:hover,
article a:not(.btn):hover {
    background-size: 100% 1px;
}

/* Navigation links */
.main-navigation a,
.nav-link {
    position: relative;
    transition: color var(--duration-fast) ease;
}

.main-navigation a::after,
.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: currentColor;
    transition: width var(--duration-normal) var(--ease-out-expo);
}

.main-navigation a:hover::after,
.nav-link:hover::after {
    width: 100%;
}

/* ============================================
   5. FORM INPUTS - Focus States
   ============================================ */

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="number"],
textarea,
select {
    transition:
        border-color var(--duration-fast) ease,
        box-shadow var(--duration-fast) ease,
        background-color var(--duration-fast) ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--brand-green, #1e5a3e);
    box-shadow:
        0 0 0 3px rgba(30, 90, 62, 0.1),
        0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Input placeholder animation */
input::placeholder,
textarea::placeholder {
    transition: opacity var(--duration-fast) ease;
}

input:focus::placeholder,
textarea:focus::placeholder {
    opacity: 0.5;
}

/* Checkbox/Radio custom styling */
input[type="checkbox"],
input[type="radio"] {
    transition:
        border-color var(--duration-fast) ease,
        background-color var(--duration-fast) ease,
        box-shadow var(--duration-fast) ease;
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
    animation: checkPop 0.3s var(--ease-spring);
}

@keyframes checkPop {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* ============================================
   6. MENU ITEMS - Dropdown & Mega Menu
   ============================================ */

/* Dropdown items */
.dropdown-list a,
.mega-menu-items a {
    position: relative;
    transition:
        color var(--duration-fast) ease,
        background-color var(--duration-fast) ease,
        padding-left var(--duration-fast) var(--ease-out-expo);
}

.dropdown-list a:hover,
.mega-menu-items a:hover {
    padding-left: 0.5rem;
}

/* Mobile menu items */
.flp-menu-list a {
    transition:
        color var(--duration-fast) ease,
        background-color var(--duration-fast) ease,
        transform var(--duration-fast) var(--ease-out-expo);
}

.flp-menu-list a:active {
    transform: scale(0.98);
}

/* ============================================
   7. ICONS - Hover Animations
   ============================================ */

/* Icon buttons */
.icon-btn,
[class*="icon-"] button,
button svg {
    transition: transform var(--duration-fast) var(--ease-out-expo);
}

.icon-btn:hover svg,
[class*="icon-"]:hover svg {
    transform: scale(1.1);
}

/* Social icons */
.social-icon,
[class*="social-"] a {
    transition:
        transform var(--duration-fast) var(--ease-out-expo),
        color var(--duration-fast) ease;
}

.social-icon:hover,
[class*="social-"] a:hover {
    transform: translateY(-3px) scale(1.1);
}

/* Arrow icons in links/buttons */
.btn svg,
a svg[class*="arrow"],
.product-cta svg {
    transition: transform var(--duration-fast) var(--ease-out-expo);
}

.btn:hover svg,
a:hover svg[class*="arrow"],
.product-cta:hover svg {
    transform: translateX(4px);
}

/* ============================================
   8. SCROLL ANIMATIONS - Fade In
   ============================================ */

/* Fade in from bottom */
.fade-in-up {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s var(--ease-out-expo) forwards;
}

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

/* Staggered animation delay for grids */
.fade-in-up:nth-child(1) { animation-delay: 0ms; }
.fade-in-up:nth-child(2) { animation-delay: 50ms; }
.fade-in-up:nth-child(3) { animation-delay: 100ms; }
.fade-in-up:nth-child(4) { animation-delay: 150ms; }
.fade-in-up:nth-child(5) { animation-delay: 200ms; }
.fade-in-up:nth-child(6) { animation-delay: 250ms; }
.fade-in-up:nth-child(7) { animation-delay: 300ms; }
.fade-in-up:nth-child(8) { animation-delay: 350ms; }

/* ============================================
   9. LOADING STATES
   ============================================ */

/* Skeleton pulse animation */
.skeleton,
[class*="skeleton-"] {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

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

/* Spinner */
.spinner,
.loading-spinner {
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   10. SPECIAL EFFECTS
   ============================================ */

/* Glow effect on focus/hover */
.glow-on-hover:hover {
    box-shadow:
        0 0 20px rgba(30, 90, 62, 0.3),
        0 0 40px rgba(30, 90, 62, 0.1);
}

/* Pulse effect for live indicators */
.pulse,
.live-dot {
    animation: pulse 2s ease-in-out infinite;
}

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

/* Shimmer effect for badges */
.badge-new::before,
.badge-promo::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    50%, 100% { left: 100%; }
}

/* ============================================
   11. TOUCH FEEDBACK (Mobile)
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    /* Tap highlight */
    a, button {
        -webkit-tap-highlight-color: rgba(30, 90, 62, 0.1);
    }

    /* Remove hover states that don't work on touch */
    .product-card-premium:hover,
    .product-card:hover {
        transform: none;
    }

    /* Active states for touch */
    .btn:active,
    button:active,
    a:active {
        opacity: 0.8;
        transform: scale(0.98);
    }
}

/* ============================================
   12. ACCORDION/FAQ ANIMATIONS
   ============================================ */

details summary {
    cursor: pointer;
    transition: color var(--duration-fast) ease;
}

details summary:hover {
    color: var(--brand-green, #1e5a3e);
}

details summary::marker,
details summary::-webkit-details-marker {
    transition: transform var(--duration-fast) var(--ease-out-expo);
}

details[open] summary::marker,
details[open] summary::-webkit-details-marker {
    transform: rotate(90deg);
}

/* FAQ answer slide down */
.faq-answer,
details > *:not(summary) {
    animation: slideDown var(--duration-normal) var(--ease-out-expo);
}

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

/* ============================================
   13. MODAL/OVERLAY TRANSITIONS
   ============================================ */

.modal,
.overlay,
[class*="-modal"],
[class*="-overlay"] {
    transition:
        opacity var(--duration-normal) ease,
        visibility var(--duration-normal) ease;
}

.modal-content,
[class*="-modal-content"] {
    transition:
        transform var(--duration-normal) var(--ease-out-expo),
        opacity var(--duration-normal) ease;
}

/* Modal enter animation */
.modal.is-visible .modal-content,
[class*="-modal"].is-visible [class*="-modal-content"] {
    animation: modalEnter var(--duration-normal) var(--ease-out-expo);
}

@keyframes modalEnter {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}
