/* Visual Oleada 1 — Cinema Premium (CSS-only, sin contrato API) */

:root {
    --premium-radius-lg: 20px;
    --premium-radius-md: 14px;
    --premium-glow: rgba(139, 92, 246, 0.42);
    --premium-glow-soft: rgba(99, 102, 241, 0.22);
    --premium-surface: rgba(12, 16, 30, 0.72);
    --premium-surface-strong: rgba(8, 12, 24, 0.88);
    --premium-border: rgba(139, 92, 246, 0.28);
    --premium-shadow: 0 18px 48px rgba(2, 6, 23, 0.45);
    --premium-shadow-soft: 0 10px 28px rgba(2, 6, 23, 0.32);
    --premium-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --premium-font-display: "Segoe UI", Inter, system-ui, sans-serif;
}

[data-theme="light"] {
    --premium-surface: rgba(255, 255, 255, 0.86);
    --premium-surface-strong: rgba(255, 255, 255, 0.96);
    --premium-border: rgba(99, 102, 241, 0.22);
    --premium-shadow: 0 16px 40px rgba(30, 41, 59, 0.12);
    --premium-shadow-soft: 0 8px 22px rgba(30, 41, 59, 0.08);
}

/* Fondo ambiental cinematográfico */
body.visual-theme-premium {
    position: relative;
    isolation: isolate;
    background:
        radial-gradient(ellipse 120% 80% at 10% -20%, rgba(124, 58, 237, 0.34), transparent 52%),
        radial-gradient(ellipse 90% 60% at 95% 0%, rgba(34, 211, 238, 0.14), transparent 48%),
        radial-gradient(ellipse 70% 50% at 50% 110%, rgba(79, 70, 229, 0.18), transparent 55%),
        linear-gradient(168deg, #06080f 0%, #0a0f1c 42%, #070a12 100%);
}

body.visual-theme-premium::before {
    content: "";
    position: fixed;
    inset: -20% -10%;
    z-index: -2;
    pointer-events: none;
    background:
        radial-gradient(circle at 20% 30%, rgba(139, 92, 246, 0.12), transparent 42%),
        radial-gradient(circle at 78% 18%, rgba(59, 130, 246, 0.1), transparent 38%);
    animation: premium-ambient-drift 28s ease-in-out infinite alternate;
}

body.visual-theme-premium::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

[data-theme="light"].visual-theme-premium,
[data-theme="light"] body.visual-theme-premium {
    background:
        radial-gradient(ellipse 100% 70% at 8% -15%, rgba(99, 102, 241, 0.14), transparent 50%),
        radial-gradient(ellipse 80% 55% at 92% 5%, rgba(14, 165, 233, 0.1), transparent 45%),
        linear-gradient(180deg, #eef1ff 0%, #f8f9ff 55%, #eef2ff 100%);
}

@keyframes premium-ambient-drift {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to { transform: translate3d(2%, -1.5%, 0) scale(1.04); }
}

@keyframes premium-fade-up {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes premium-shine {
    from { transform: translateX(-120%) skewX(-18deg); }
    to { transform: translateX(220%) skewX(-18deg); }
}

/* Entrada suave de contenido principal */
body.visual-theme-premium .container > * {
    animation: premium-fade-up 0.55s var(--premium-ease) both;
}

body.visual-theme-premium .home-stream > *:nth-child(1) { animation-delay: 0.04s; }
body.visual-theme-premium .home-stream > *:nth-child(2) { animation-delay: 0.1s; }
body.visual-theme-premium .home-stream > *:nth-child(3) { animation-delay: 0.16s; }

/* Topnav glass premium */
body.visual-theme-premium .topnav {
    position: sticky;
    top: 8px;
    z-index: 100;
    border: 1px solid var(--premium-border);
    border-radius: var(--premium-radius-md);
    background: var(--premium-surface-strong);
    backdrop-filter: blur(16px) saturate(1.25);
    -webkit-backdrop-filter: blur(16px) saturate(1.25);
    box-shadow: var(--premium-shadow-soft);
}

body.visual-theme-premium .topnav-brand {
    font-family: var(--premium-font-display);
    font-weight: 800;
    letter-spacing: 0.02em;
    background: linear-gradient(120deg, #f8fafc 0%, #c4b5fd 55%, #93c5fd 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

[data-theme="light"] body.visual-theme-premium .topnav-brand {
    background: linear-gradient(120deg, #1e1b4b 0%, #5b21b6 55%, #1d4ed8 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

body.visual-theme-premium .topnav .ghost-link.active {
    border-color: transparent;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.35);
}

/* Hero cinematográfico Home */
.cinema-hero {
    position: relative;
    overflow: hidden;
    margin-bottom: 14px;
    padding: clamp(18px, 4vw, 28px);
    border-radius: var(--premium-radius-lg);
    border: 1px solid var(--premium-border);
    background:
        linear-gradient(125deg, rgba(99, 102, 241, 0.22) 0%, rgba(15, 23, 42, 0.55) 38%, rgba(8, 12, 24, 0.82) 100%);
    box-shadow: var(--premium-shadow);
}

.cinema-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 88% 12%, rgba(167, 139, 250, 0.35), transparent 42%),
        radial-gradient(circle at 12% 88%, rgba(56, 189, 248, 0.18), transparent 40%);
    pointer-events: none;
}

.cinema-hero::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
}

[data-theme="light"] .cinema-hero {
    background:
        linear-gradient(125deg, rgba(99, 102, 241, 0.12) 0%, rgba(255, 255, 255, 0.94) 45%, rgba(248, 250, 255, 0.98) 100%);
}

.cinema-hero__inner {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 16px;
}

.cinema-hero__kicker {
    margin: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #c4b5fd;
}

[data-theme="light"] .cinema-hero__kicker {
    color: var(--accent-2);
}

.cinema-hero__title {
    margin: 0;
    font-family: var(--premium-font-display);
    font-size: clamp(1.65rem, 4.8vw, 2.45rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.03em;
    max-width: 16ch;
}

.cinema-hero__subtitle {
    margin: 0;
    max-width: 42rem;
    font-size: clamp(0.92rem, 2.2vw, 1.05rem);
    line-height: 1.5;
    color: var(--sub);
}

.cinema-hero__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.cinema-hero__stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 108px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(139, 92, 246, 0.28);
    background: rgba(8, 12, 24, 0.45);
    backdrop-filter: blur(6px);
}

[data-theme="light"] .cinema-hero__stat {
    background: rgba(255, 255, 255, 0.82);
}

.cinema-hero__stat-value {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.cinema-hero__stat-label {
    font-size: 11px;
    color: var(--sub);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.cinema-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.cinema-hero__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.18s var(--premium-ease), box-shadow 0.18s var(--premium-ease);
}

.cinema-hero__cta--primary {
    color: #fff;
    border: 1px solid rgba(167, 139, 250, 0.5);
    background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
    box-shadow: 0 10px 24px rgba(79, 70, 229, 0.38);
}

.cinema-hero__cta--secondary {
    color: var(--text);
    border: 1px solid var(--premium-border);
    background: rgba(15, 23, 42, 0.35);
}

[data-theme="light"] .cinema-hero__cta--secondary {
    background: rgba(255, 255, 255, 0.9);
}

.cinema-hero__cta:hover {
    transform: translateY(-2px);
}

.cinema-hero__cta--primary:hover {
    box-shadow: 0 14px 32px rgba(79, 70, 229, 0.48);
}

/* Paneles y búsqueda */
body.visual-theme-premium .panel {
    border-color: var(--premium-border);
    border-radius: var(--premium-radius-md);
    background: var(--premium-surface);
    backdrop-filter: blur(10px);
    box-shadow: var(--premium-shadow-soft);
}

body.visual-theme-premium .home-panel-primary {
    border-color: rgba(139, 92, 246, 0.42);
    box-shadow: var(--premium-shadow);
}

body.visual-theme-premium .global-search__input,
body.visual-theme-premium .field:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.65);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.22);
}

body.visual-theme-premium .home-block-title,
body.visual-theme-premium .shelf-head h3 {
    font-family: var(--premium-font-display);
    font-weight: 800;
    letter-spacing: -0.02em;
}

body.visual-theme-premium .netflix-home .shelf-head h3,
body.visual-theme-premium .home-discovery .shelf-head h3 {
    font-size: clamp(1.1rem, 2.5vw, 1.35rem);
}

/* Estantes premium — tarjetas más grandes y efecto shine */
body.visual-theme-premium .shelf-panel {
    border-color: var(--premium-border);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.52), rgba(15, 23, 42, 0.22));
}

body.visual-theme-premium .shelf-panel .shelf-track {
    gap: 18px;
    padding: 4px 2px 12px;
    scroll-padding-inline: 8px;
    mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
}

body.visual-theme-premium .netflix-home .shelf-panel .shelf-card,
body.visual-theme-premium .cinema-home .shelf-panel .shelf-card {
    min-width: 252px;
    max-width: 252px;
    padding: 12px;
    border-radius: 18px;
    border-color: rgba(148, 163, 184, 0.22);
    background: linear-gradient(165deg, rgba(20, 26, 44, 0.88), rgba(10, 14, 26, 0.55));
    box-shadow: 0 8px 22px rgba(2, 6, 23, 0.28);
    transition:
        transform 0.22s var(--premium-ease),
        border-color 0.22s var(--premium-ease),
        box-shadow 0.22s var(--premium-ease);
}

body.visual-theme-premium .shelf-panel .shelf-card:not(.library-shelf-card--spine):hover {
    transform: translateY(-6px) scale(1.02);
    border-color: rgba(167, 139, 250, 0.75);
    box-shadow: 0 20px 40px rgba(2, 6, 23, 0.42), 0 0 0 1px rgba(139, 92, 246, 0.15);
}

body.visual-theme-premium .shelf-cover-wrap {
    border-radius: 14px;
    border-color: rgba(167, 139, 250, 0.25);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

body.visual-theme-premium .shelf-cover-wrap::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
    pointer-events: none;
    opacity: 0.85;
    transition: opacity 0.2s ease;
}

body.visual-theme-premium .shelf-panel .shelf-card:hover .shelf-cover-wrap::after {
    opacity: 0.65;
}

body.visual-theme-premium .shelf-cover-wrap::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    background: linear-gradient(105deg, transparent 42%, rgba(255, 255, 255, 0.22) 50%, transparent 58%);
    transform: translateX(-120%) skewX(-18deg);
    pointer-events: none;
}

body.visual-theme-premium .shelf-panel .shelf-card:hover .shelf-cover-wrap::before {
    animation: premium-shine 0.75s var(--premium-ease);
}

body.visual-theme-premium .shelf-panel .shelf-card:hover .shelf-cover {
    transform: scale(1.06);
}

body.visual-theme-premium .shelf-cta-primary,
body.visual-theme-premium .shelf-form .shelf-cta-primary {
    border-radius: 11px;
    font-weight: 700;
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.28);
}

body.visual-theme-premium .shelf-nav-btn {
    border-radius: 999px;
    width: 34px;
    height: 34px;
    border-color: var(--premium-border);
    background: rgba(15, 23, 42, 0.72);
    transition: transform 0.15s ease, border-color 0.15s ease;
}

body.visual-theme-premium .shelf-nav-btn:hover {
    transform: scale(1.06);
    border-color: rgba(167, 139, 250, 0.75);
}

/* Biblioteca premium */
body.visual-theme-premium.library-page .library-pitch {
    border-radius: var(--premium-radius-md);
    border-color: var(--premium-border);
    box-shadow: var(--premium-shadow-soft);
}

body.visual-theme-premium.library-page .library-hero h1 {
    font-family: var(--premium-font-display);
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.03em;
}

body.visual-theme-premium.library-page .library-tabs {
    padding: 6px;
    border-radius: 14px;
    border: 1px solid var(--premium-border);
    background: rgba(8, 12, 24, 0.55);
    gap: 6px;
}

[data-theme="light"] body.visual-theme-premium.library-page .library-tabs {
    background: rgba(255, 255, 255, 0.88);
}

body.visual-theme-premium.library-page .library-tab {
    border-radius: 10px;
    transition: transform 0.15s ease, background 0.15s ease;
}

body.visual-theme-premium.library-page .library-tab.is-active {
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.32);
}

body.visual-theme-premium .library-series-shelf {
    border-radius: var(--premium-radius-md);
    border-color: var(--premium-border);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.48), rgba(15, 23, 42, 0.22));
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body.visual-theme-premium .library-series-shelf:hover {
    border-color: rgba(167, 139, 250, 0.45);
    box-shadow: var(--premium-shadow-soft);
}

body.visual-theme-premium .library-series-shelf__card {
    flex: 0 0 118px;
    transition: transform 0.18s var(--premium-ease);
}

body.visual-theme-premium .library-series-shelf__card:hover {
    transform: translateY(-4px) scale(1.03);
}

body.visual-theme-premium .library-series-shelf__cover {
    border-radius: 12px;
    box-shadow: 0 8px 18px rgba(2, 6, 23, 0.32);
}

body.visual-theme-premium .library-shelf-card .shelf-cover-wrap {
    box-shadow: 0 10px 22px rgba(2, 6, 23, 0.28);
}

body.visual-theme-premium .library-shelf-card:hover .shelf-cover-wrap {
    box-shadow: 0 14px 28px rgba(2, 6, 23, 0.38);
}

body.visual-theme-premium .library-shelf-card .shelf-cover-overlay.library-shelf-actions .library-shelf-cta.cta-read {
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}

body.visual-theme-premium .library-continue-card__cover {
    border-radius: 14px;
    box-shadow: 0 12px 28px rgba(2, 6, 23, 0.38);
}

body.visual-theme-premium .library-collection-card {
    border-radius: var(--premium-radius-md);
    overflow: hidden;
    transition: transform 0.2s var(--premium-ease), box-shadow 0.2s var(--premium-ease);
}

body.visual-theme-premium .library-collection-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--premium-shadow-soft);
}

/* Empty states */
body.visual-theme-premium .empty-state {
    padding: 22px 16px;
    border-radius: var(--premium-radius-md);
    border: 1px dashed rgba(139, 92, 246, 0.35);
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.08), rgba(15, 23, 42, 0.2));
    text-align: center;
}

body.visual-theme-premium .empty-state-title {
    font-weight: 800;
    font-size: 1.05rem;
}

/* Overlay búsqueda */
body.visual-theme-premium .global-search-overlay__panel {
    border-radius: var(--premium-radius-lg);
    border-color: rgba(139, 92, 246, 0.45);
    box-shadow: var(--premium-shadow);
}

/* Bottom nav móvil */
body.visual-theme-premium .app-mobile-bottomnav {
    border-top: 1px solid var(--premium-border);
    background: var(--premium-surface-strong);
    backdrop-filter: blur(18px) saturate(1.2);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    box-shadow: 0 -8px 28px rgba(2, 6, 23, 0.35);
}

body.visual-theme-premium .app-mobile-bottomnav__item.is-active {
    color: #c4b5fd;
}

body.visual-theme-premium .app-mobile-bottomnav__item.is-active .app-mobile-bottomnav__icon {
    filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.55));
}

/* Compact mode: no agrandar tarjetas */
body.visual-theme-premium.compact-home .shelf-panel .shelf-card:not(.library-shelf-card--spine) {
    min-width: 180px;
    max-width: 180px;
    transform: none;
}

@media (max-width: 900px) {
    body.visual-theme-premium .netflix-home .shelf-panel .shelf-card,
    body.visual-theme-premium .cinema-home .shelf-panel .shelf-card {
        min-width: 178px;
        max-width: 178px;
    }

    body.visual-theme-premium .cinema-hero__stats {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.visual-theme-premium .cinema-hero__stat {
        min-width: 0;
    }
}

/* Ficha de serie */
body.visual-theme-premium.library-series-detail-page .library-series-detail-back {
    margin: 0 0 12px;
}

body.visual-theme-premium .library-series-detail-hero {
    margin-bottom: 16px;
    padding: 22px 20px;
    border-radius: var(--premium-radius-md);
    border: 1px solid var(--premium-border);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(15, 23, 42, 0.42));
}

body.visual-theme-premium .library-series-detail-kicker {
    margin: 0 0 6px;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.75;
}

body.visual-theme-premium .library-series-detail-meta {
    margin: 8px 0 14px;
    opacity: 0.9;
}

body.visual-theme-premium .library-series-detail-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

body.visual-theme-premium .library-series-shelf-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 4px;
}

body.visual-theme-premium .library-series-shelf-link {
    font-size: 0.88rem;
    font-weight: 600;
}

body.visual-theme-premium .library-shelf-panel--spine .shelf-track.is-spine-track {
    border-radius: 0 0 14px 14px;
}

body.visual-theme-premium .shelf-spine-preview.is-spine-flyout {
    box-shadow: 0 22px 48px rgba(2, 6, 23, 0.62);
}

body.visual-theme-premium .library-series-load-more-wrap {
    display: flex;
    justify-content: center;
    margin: 14px 0 6px;
}

body.visual-theme-premium .library-series-load-more {
    min-width: min(100%, 320px);
}

body.visual-theme-premium .library-series-detail-load-more {
    min-width: min(100%, 360px);
}

@media (max-width: 900px) {
    body.visual-theme-premium.library-page .library-layout,
    body.visual-theme-premium.library-series-detail-page .library-layout {
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    }

    body.visual-theme-premium .library-series-load-more-wrap,
    body.visual-theme-premium #library-series-detail-load-more-wrap {
        position: sticky;
        bottom: calc(72px + env(safe-area-inset-bottom, 0px));
        z-index: 6;
        margin: 18px 0 10px;
        padding: 10px 0 6px;
        background: linear-gradient(180deg, transparent 0%, rgba(8, 12, 24, 0.88) 35%, rgba(8, 12, 24, 0.96) 100%);
    }

    body.visual-theme-premium .library-series-load-more,
    body.visual-theme-premium .library-series-detail-load-more {
        width: 100%;
        min-height: 48px;
        padding: 12px 18px;
        font-size: 1rem;
        font-weight: 600;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    body.visual-theme-premium.library-series-detail-page .shelf-track,
    body.visual-theme-premium.library-page .shelf-track {
        -webkit-overflow-scrolling: touch;
        scroll-padding-inline: 10px;
        gap: 10px;
    }

    body.visual-theme-premium.library-series-detail-page .library-series-detail-meta {
        font-size: 0.92rem;
        line-height: 1.45;
    }
}

body.visual-theme-premium.library-page.library-tab-loading {
    cursor: progress;
}

/* Catálogo premium */
body.visual-theme-premium.catalog-browse-page .catalog-explorer {
    border-radius: var(--premium-radius-md);
}

body.visual-theme-premium.catalog-browse-page .catalog-browse-meta {
    border-radius: 12px;
    border: 1px solid var(--premium-border);
    background: rgba(8, 12, 24, 0.45);
    padding: 12px 14px;
}

[data-theme="light"] body.visual-theme-premium.catalog-browse-page .catalog-browse-meta {
    background: rgba(255, 255, 255, 0.9);
}

@media (prefers-reduced-motion: reduce) {
    body.visual-theme-premium::before,
    body.visual-theme-premium .container > *,
    body.visual-theme-premium .home-stream > * {
        animation: none !important;
    }

    body.visual-theme-premium .shelf-panel .shelf-card:hover .shelf-cover-wrap::before {
        animation: none !important;
    }
}
