/* ========================================
   NEXUS TV — Animation Library
   ======================================== */

/* --- Page Transitions --- */
@keyframes pageIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes pageFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- Card Effects --- */
@keyframes cardGlow {
    0% { box-shadow: 0 0 0 rgba(168,85,247,0); }
    100% { box-shadow: 0 0 30px rgba(168,85,247,0.15); }
}
@keyframes borderShimmer {
    0% { border-color: rgba(168,85,247,0.2); }
    50% { border-color: rgba(6,182,212,0.4); }
    100% { border-color: rgba(168,85,247,0.2); }
}

/* --- Skeleton Loading --- */
@keyframes skeletonPulse {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: skeletonPulse 1.8s ease-in-out infinite;
    border-radius: 8px;
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 22px; width: 60%; margin-bottom: 12px; }
.skeleton-card { aspect-ratio: 2/3; border-radius: 12px; }
.skeleton-hero { height: 500px; border-radius: 0; }

/* --- Modal Effects --- */
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.92) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes modalOut {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.92); }
}
@keyframes backdropIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- Sidebar --- */
@keyframes slideInLeft {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOutLeft {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(-100%); opacity: 0; }
}

/* --- Button Effects --- */
@keyframes ripple {
    0% { transform: scale(0); opacity: 0.5; }
    100% { transform: scale(4); opacity: 0; }
}
@keyframes btnPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(168,85,247,0.4); }
    50% { box-shadow: 0 0 0 14px rgba(168,85,247,0); }
}

/* --- Progress --- */
@keyframes progressGrow {
    from { width: 0; }
    to { width: var(--progress, 0%); }
}
@keyframes progressShine {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* --- Toast Notifications --- */
@keyframes toastIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}

/* --- Floating / Ambient --- */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
@keyframes ambientGlow {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}
@keyframes rotateGlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- Hero --- */
@keyframes heroGradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes heroZoom {
    from { transform: scale(1); }
    to { transform: scale(1.08); }
}

/* --- Subscription / Pricing --- */
@keyframes pricePop {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
@keyframes bestValueBadge {
    0%, 100% { transform: rotate(-2deg) scale(1); }
    50% { transform: rotate(2deg) scale(1.06); }
}

/* --- Spinner --- */
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Checkmark --- */
@keyframes checkDraw {
    from { stroke-dashoffset: 100; }
    to { stroke-dashoffset: 0; }
}
@keyframes checkCircle {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* --- Fade In Up (staggered) --- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* --- Utility Classes --- */
.animate-in { animation: pageIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }
.animate-fade { animation: pageFade 0.4s ease both; }
.animate-float { animation: float 3s ease-in-out infinite; }
.animate-pulse { animation: btnPulse 2s ease infinite; }
.animate-fade-up { animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }
.animate-fade-down { animation: fadeInDown 0.4s ease both; }
.animate-fade-scale { animation: fadeInScale 0.4s cubic-bezier(0.16, 1, 0.3, 1) both; }

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }
.stagger-7 { animation-delay: 0.35s; }
.stagger-8 { animation-delay: 0.4s; }

/* --- Staggered Content Section Animations --- */
.content-section:nth-child(1) { animation-delay: 0s; }
.content-section:nth-child(2) { animation-delay: 0.08s; }
.content-section:nth-child(3) { animation-delay: 0.16s; }
.content-section:nth-child(4) { animation-delay: 0.24s; }
.content-section:nth-child(5) { animation-delay: 0.32s; }
.content-section:nth-child(6) { animation-delay: 0.4s; }
.content-section:nth-child(7) { animation-delay: 0.48s; }
.content-section:nth-child(8) { animation-delay: 0.56s; }
.content-section:nth-child(9) { animation-delay: 0.64s; }
.content-section:nth-child(10) { animation-delay: 0.72s; }

/* --- Page Transition --- */
@keyframes pageTransition {
    /* opacity + transform only - both composited. A filter here blurs the
       entire .main-content subtree (the whole page) for 400ms per navigation. */
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.main-content {
    animation: pageTransition 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* --- TV Remote Focus Pulse (for D-PAD navigation indicators) --- */
@keyframes tvFocusPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}
.tv-focus-indicator {
    animation: tvFocusPulse 1.5s ease-in-out infinite;
}

/* --- Image Loading Placeholder ---
   Do NOT animate this. loading="lazy" is a permanent attribute, so an animation
   keyed off it never stops - it repainted ~400 posters every frame, forever. */
.content-card-poster[loading="lazy"],
.card-poster img[loading="lazy"] {
    background-color: var(--bg-surface);
}

/* --- Smooth Server Toast Animation --- */
.server-toast {
    animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.server-toast.removing {
    animation: toastOut 0.3s ease-in both;
}

