/* ============================================================================
   W STUDIOS VOICE — LUXURY MOTION LAYER  (Remotion-style cinematics)
   ----------------------------------------------------------------------------
   GPU-friendly (transform / opacity / filter only). Applies to every theme.
   Fully disabled for users who prefer reduced motion.
   Loaded last so it composes on top of the existing UI without changing it.
   ============================================================================ */

:root {
    --lux-ease: cubic-bezier(0.22, 1, 0.36, 1);     /* smooth "expo-out" */
    --lux-ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Respect the OS-level reduced-motion preference: opt-in only. */
@media (prefers-reduced-motion: no-preference) {

    /* ------------------------------------------------------------------ */
    /* 1. PAGE / VIEW ENTRANCE                                            */
    /* ------------------------------------------------------------------ */
    .page.active {
        animation: luxPageIn 0.55s var(--lux-ease) both;
    }
    @keyframes luxPageIn {
        from { opacity: 0; transform: translateY(16px) scale(0.992); filter: blur(3px); }
        to   { opacity: 1; transform: none;                          filter: blur(0); }
    }

    /* gentle one-time fade for the whole app shell when it appears */
    .app:not(.hidden) { animation: luxFadeIn 0.7s var(--lux-ease-soft) both; }
    @keyframes luxFadeIn { from { opacity: 0; } to { opacity: 1; } }

    /* ------------------------------------------------------------------ */
    /* 2. STAGGERED CARD / TILE REVEAL inside the active view             */
    /* ------------------------------------------------------------------ */
    .page.active .voice-card,
    .page.active .history-card,
    .page.active .audio-card,
    .page.active .sf-ah-card,
    .page.active .stat-card,
    .page.active [class*="-card"] {
        animation: luxRise 0.6s var(--lux-ease) both;
    }
    .page.active .voice-card:nth-child(1),
    .page.active [class*="-card"]:nth-child(1)  { animation-delay: 0.02s; }
    .page.active .voice-card:nth-child(2),
    .page.active [class*="-card"]:nth-child(2)  { animation-delay: 0.06s; }
    .page.active .voice-card:nth-child(3),
    .page.active [class*="-card"]:nth-child(3)  { animation-delay: 0.10s; }
    .page.active .voice-card:nth-child(4),
    .page.active [class*="-card"]:nth-child(4)  { animation-delay: 0.14s; }
    .page.active .voice-card:nth-child(5),
    .page.active [class*="-card"]:nth-child(5)  { animation-delay: 0.18s; }
    .page.active .voice-card:nth-child(6),
    .page.active [class*="-card"]:nth-child(6)  { animation-delay: 0.22s; }
    .page.active .voice-card:nth-child(7),
    .page.active [class*="-card"]:nth-child(7)  { animation-delay: 0.26s; }
    .page.active .voice-card:nth-child(n+8),
    .page.active [class*="-card"]:nth-child(n+8){ animation-delay: 0.30s; }
    @keyframes luxRise {
        from { opacity: 0; transform: translateY(22px) scale(0.985); }
        to   { opacity: 1; transform: none; }
    }

    /* ------------------------------------------------------------------ */
    /* 3. SIDEBAR NAV — refined hover/active micro-interaction            */
    /* ------------------------------------------------------------------ */
    .nav-item { transition: transform 0.25s var(--lux-ease), background 0.25s ease, color 0.25s ease; }
    .nav-item:hover { transform: translateX(4px); }
    .nav-item.active { transform: translateX(2px); }

    /* ------------------------------------------------------------------ */
    /* 4. PRIMARY BUTTON — luxury light sweep + lift                      */
    /* ------------------------------------------------------------------ */
    .btn-primary { position: relative; overflow: hidden; }
    .btn-primary::before {
        content: '';
        position: absolute;
        top: 0; left: -130%;
        width: 55%; height: 100%;
        background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.38) 50%, transparent 100%);
        transform: skewX(-20deg);
        pointer-events: none;
    }
    .btn-primary:hover::before { animation: luxShine 0.85s var(--lux-ease-soft); }
    @keyframes luxShine { from { left: -130%; } to { left: 150%; } }

    /* ------------------------------------------------------------------ */
    /* 5. MODAL ENTRANCE                                                  */
    /* ------------------------------------------------------------------ */
    .modal:not(.hidden) .modal-content,
    .modal:not(.hidden) .modal-box {
        animation: luxModalIn 0.45s var(--lux-ease) both;
    }
    @keyframes luxModalIn {
        from { opacity: 0; transform: translateY(20px) scale(0.965); }
        to   { opacity: 1; transform: none; }
    }
    .modal:not(.hidden) .modal-overlay,
    .modal:not(.hidden) [class*="modal-overlay"] {
        animation: luxFadeIn 0.35s ease both;
    }

    /* ------------------------------------------------------------------ */
    /* 6. GRADIENT PICKER SWATCHES — playful pop                         */
    /* ------------------------------------------------------------------ */
    .gradient-option { transition: transform 0.3s var(--lux-ease), box-shadow 0.3s ease, border-color 0.3s ease; }
    .gradient-option:hover { transform: translateY(-5px) scale(1.015); }

    /* ------------------------------------------------------------------ */
    /* 7. AMBIENT ACCENT SHIMMER — logo + credits (subtle, infinite)     */
    /* ------------------------------------------------------------------ */
    .logo-icon,
    .user-avatar {
        background-size: 200% 200% !important;
        animation: luxGradientShift 7s ease-in-out infinite;
    }
    @keyframes luxGradientShift {
        0%, 100% { background-position: 0% 50%; }
        50%      { background-position: 100% 50%; }
    }

    /* credits count gently pulses focus when it changes hands */
    #credits-count { transition: transform 0.3s var(--lux-ease); }

    /* ------------------------------------------------------------------ */
    /* 8. COLLAPSIBLE SIDEBAR CHEVRON — smoother easing                  */
    /* ------------------------------------------------------------------ */
    .nav-toggle-icon { transition: transform 0.35s var(--lux-ease) !important; }

    /* ------------------------------------------------------------------ */
    /* 9. GENERIC INTERACTIVE LIFT for buttons / chips                   */
    /* ------------------------------------------------------------------ */
    .btn-secondary,
    .sidebar-btn { transition: transform 0.25s var(--lux-ease), background 0.25s ease, border-color 0.25s ease; }
    .btn-secondary:hover { transform: translateY(-1px); }
    .sidebar-btn:hover { transform: translateY(-2px); }
}

/* Hard stop for reduced-motion users (and disables the infinite shimmer). */
@media (prefers-reduced-motion: reduce) {
    .logo-icon,
    .user-avatar { animation: none !important; }
}
