/* ============================================================================
   index.css — Pantalla de acceso

   Móvil: el fondo de la película ocupa la pantalla, atenuado, con la tira de
   portadas abajo y el formulario flotando encima.
   Escritorio: dos columnas — formulario a la izquierda, panel visual a la
   derecha con el fondo, la sinopsis y el carrusel de portadas.
   ========================================================================== */

:root {
    --bg:          #08080c;
    --bg-soft:     #0e0e14;
    --surface:     #15151d;
    --surface-2:   #1e1e28;
    --line:        rgba(255, 255, 255, .09);
    --line-strong: rgba(255, 255, 255, .16);

    --text:        #ffffff;
    --muted:       #8d8d9e;
    --muted-dim:   #63636f;

    --accent:      #e50914;
    --accent-soft: rgba(229, 9, 20, .16);
    --accent-glow: rgba(229, 9, 20, .45);
    --live:        #46d369;

    --r-sm:  12px;
    --r-md:  16px;
    --r-lg:  22px;
    --r-xl:  28px;

    --ease: cubic-bezier(.22, .9, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100svh;
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

/* ── Estructura ──────────────────────────────────────────────────────────── */

.auth {
    position: relative;
    min-height: 100svh;
    display: grid;
    grid-template-columns: 1fr;
}

.auth__panel {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
    min-height: 100svh;
}

.auth__card {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
}

/* ══════════════════════════════════════════════════════════════════════════
   PANEL VISUAL — fondo de película + portadas
   En móvil cubre toda la pantalla por detrás del formulario.
   ══════════════════════════════════════════════════════════════════════════ */

.auth__hero {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background: linear-gradient(160deg, #15060a 0%, #0a0a12 55%, #08080c 100%);
    pointer-events: none;
}

.hero__media { position: absolute; inset: 0; }

.hero__backdrop {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transform: scale(1.06);
    transition: opacity 1.1s var(--ease), transform 9s linear;
}

.hero__backdrop.is-on {
    opacity: 1;
    transform: scale(1);
}

/* Velo que mantiene el texto legible sobre cualquier imagen */
.hero__veil {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(8, 8, 12, .55) 0%, rgba(8, 8, 12, .80) 45%, rgba(8, 8, 12, .97) 100%),
        radial-gradient(ellipse at 30% 20%, rgba(229, 9, 20, .14), transparent 60%);
}

.hero__glow {
    position: absolute;
    width: 420px;
    height: 420px;
    top: -140px;
    right: -120px;
    border-radius: 50%;
    background: var(--accent);
    filter: blur(110px);
    opacity: .22;
}

.hero__content {
    position: absolute;
    inset: auto 0 0 0;
    padding: 0 0 22px;
}

/* En móvil solo se ve la tira de portadas: el resto estorbaría al formulario */
.hero__badge,
.hero__title,
.hero__meta,
.hero__text { display: none; }

/* ── Carrusel de portadas ────────────────────────────────────────────────── */

.posters {
    overflow: hidden;
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.posters__track {
    display: flex;
    gap: 12px;
    width: max-content;
    padding: 4px 16px;
    animation: slide 56s linear infinite;
}

@keyframes slide {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

.poster {
    flex: 0 0 auto;
    width: 92px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface);
    overflow: hidden;
    cursor: pointer;
    opacity: .55;
    transition: opacity .25s, transform .25s var(--ease), border-color .25s;
}

.poster img {
    display: block;
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
}

.poster.is-active {
    opacity: 1;
    border-color: var(--accent);
    transform: translateY(-4px);
}

/* ── Marca ───────────────────────────────────────────────────────────────── */

.auth__brand {
    display: flex;
    justify-content: center;
    margin-bottom: 26px;
}

.auth__logo {
    width: clamp(150px, 42vw, 196px);
    height: auto;
    max-height: 196px;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    filter: drop-shadow(0 8px 28px rgba(0, 0, 0, .6));
}

.auth__logo--fallback {
    width: 88px;
    height: 88px;
    display: grid;
    place-items: center;
    border-radius: var(--r-lg);
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 38px;
}

/* ── Encabezados ─────────────────────────────────────────────────────────── */

/* Centrado para que haga eje con el logo */
.auth__head {
    margin-bottom: 26px;
    text-align: center;
}

.auth__head h1 {
    margin: 0 0 6px;
    font-size: clamp(26px, 7vw, 32px);
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.15;
}

.auth__head p {
    margin: 0;
    color: var(--muted);
    font-size: 14.5px;
}

/* ── Pantallas ───────────────────────────────────────────────────────────── */

.screen { display: none; }
.screen.is-active {
    display: block;
    animation: rise .34s var(--ease) both;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

/* ── Selector de método ──────────────────────────────────────────────────── */

.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px;
    background: rgba(21, 21, 29, .82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background .2s var(--ease), border-color .2s var(--ease),
                transform .2s var(--ease);
}

.option:hover,
.option:focus-visible {
    background: rgba(30, 30, 40, .92);
    border-color: var(--line-strong);
    transform: translateY(-2px);
    outline: none;
}

.option:active { transform: translateY(0) scale(.99); }

.option__icon {
    flex: 0 0 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: var(--r-md);
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 18px;
}

.option__text { flex: 1 1 auto; min-width: 0; }

.option__title {
    display: block;
    font-weight: 650;
    font-size: 15px;
    letter-spacing: -.01em;
}

.option__desc {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-top: 2px;
}

.option__arrow {
    color: var(--muted-dim);
    font-size: 13px;
    transition: transform .2s var(--ease), color .2s var(--ease);
}

.option:hover .option__arrow {
    color: var(--text);
    transform: translateX(3px);
}

/* ── Volver ──────────────────────────────────────────────────────────────── */

.back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    padding: 9px 15px;
    background: rgba(21, 21, 29, .8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font: inherit;
    font-size: 13.5px;
    cursor: pointer;
    transition: color .2s, border-color .2s;
}

.back:hover { color: var(--text); border-color: var(--line-strong); }

/* ── Campos ──────────────────────────────────────────────────────────────── */

.field {
    position: relative;
    margin-bottom: 14px;
}

.field__icon {
    position: absolute;
    left: 17px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted-dim);
    font-size: 14px;
    pointer-events: none;
    transition: color .2s;
    z-index: 1;
}

.field input {
    width: 100%;
    /* 16px evita el zoom automático de iOS al enfocar */
    font-size: 16px;
    font-family: inherit;
    color: var(--text);
    background: rgba(21, 21, 29, .88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 22px 48px 10px 46px;
    outline: none;
    transition: border-color .2s, background .2s, box-shadow .2s;
}

.field input:hover { border-color: var(--line-strong); }

.field input:focus {
    background: rgba(30, 30, 40, .95);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

/* El icono precede al input, así que el color de foco se aplica desde el
   contenedor (los combinadores de hermano solo miran hacia adelante). */
.field:focus-within .field__icon { color: var(--accent); }

/* Etiqueta flotante */
.field label {
    position: absolute;
    left: 46px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 15px;
    pointer-events: none;
    transition: all .18s var(--ease);
}

.field input:focus + label,
.field input:not(:placeholder-shown) + label {
    top: 14px;
    transform: none;
    font-size: 11px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted-dim);
}

.field__toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    background: none;
    border: 0;
    border-radius: 10px;
    color: var(--muted-dim);
    cursor: pointer;
    transition: color .2s, background .2s;
}

.field__toggle:hover { color: var(--text); background: rgba(255, 255, 255, .06); }

/* Campo de código: grande y centrado */
.field--code input {
    padding: 20px 16px;
    text-align: center;
    font-size: clamp(28px, 9vw, 38px);
    font-weight: 700;
    letter-spacing: clamp(6px, 3vw, 14px);
    text-indent: clamp(6px, 3vw, 14px); /* compensa el tracking del último dígito */
    border-radius: var(--r-lg);
}

.field--code input::placeholder { color: #2e2e3a; }

/* ── Botón principal ─────────────────────────────────────────────────────── */

.submit {
    position: relative;
    width: 100%;
    margin-top: 10px;
    padding: 16px 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--accent);
    color: #fff;
    border: 0;
    border-radius: var(--r-md);
    font: inherit;
    font-size: 15.5px;
    font-weight: 650;
    letter-spacing: -.01em;
    cursor: pointer;
    box-shadow: 0 8px 22px -8px var(--accent-glow);
    transition: filter .2s, transform .15s var(--ease), box-shadow .2s;
}

.submit:hover:not(:disabled) {
    filter: brightness(1.1);
    box-shadow: 0 12px 28px -8px var(--accent-glow);
}

.submit:active:not(:disabled) { transform: scale(.985); }
.submit:disabled { opacity: .7; cursor: progress; }
.submit i { font-size: 13px; }

/* ── Avisos ──────────────────────────────────────────────────────────────── */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
    padding: 13px 15px;
    background: rgba(229, 9, 20, .18);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(229, 9, 20, .4);
    border-radius: var(--r-sm);
    color: #ffc2c6;
    font-size: 13.5px;
    line-height: 1.5;
    animation: rise .25s var(--ease) both;
}

.alert i { margin-top: 2px; flex: 0 0 auto; }

.auth__state {
    text-align: center;
    padding: 36px 10px;
}

.auth__state i { font-size: 34px; color: var(--muted-dim); margin-bottom: 14px; }
.auth__state h1 { margin: 0 0 8px; font-size: 22px; font-weight: 750; }
.auth__state p  { margin: 0; color: var(--muted); font-size: 14px; }

.auth__footer {
    margin-top: 34px;
    text-align: center;
    color: var(--muted-dim);
    font-size: 12px;
    letter-spacing: .06em;
    text-transform: uppercase;
}

/* ══════════════════════════════════════════════════════════════════════════
   MÓVIL — ajustes finos
   ══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 899px) {
    /* La tarjeta se centra en el espacio que deja libre la tira de portadas.
       Se usa margin auto en lugar de align-items: center porque, cuando el
       contenido es más alto que la pantalla (la pantalla de activación lo es),
       centrar desborda por arriba y por abajo; con margin auto la página
       simplemente crece y se desplaza. */
    .auth__panel {
        align-items: flex-start;
        padding-top: clamp(24px, 5svh, 48px);
        padding-bottom: 186px;
    }

    .auth__card { margin-block: auto; }

    .posters__track { padding: 4px 14px; }
    .poster { width: 78px; }
}

@media (max-width: 380px) {
    .poster { width: 68px; }
    .auth__panel { padding-bottom: 170px; }
}

/* Pantallas muy bajas (móvil apaisado): las portadas estorban */
@media (max-height: 560px) and (max-width: 899px) {
    .hero__content { display: none; }

    .auth__panel {
        align-items: center;
        padding: 18px 20px;
        min-height: auto;
    }

    .auth__brand { margin-bottom: 14px; }
    .auth__logo  { width: clamp(110px, 20vw, 130px); }
    .auth__head  { margin-bottom: 16px; }
    .auth__footer { margin-top: 18px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   ESCRITORIO — dos columnas
   ══════════════════════════════════════════════════════════════════════════ */

@media (min-width: 900px) {
    /* Izquierda 30 %, el panel visual se queda con el resto */
    .auth { grid-template-columns: 30% 1fr; }

    /* Formulario a la izquierda, panel visual a la derecha */
    .auth__panel {
        order: 1;
        background: var(--bg);
        /* El lateral se encoge en monitores pequeños para que el
           formulario no quede apretado dentro de ese 35 %. */
        padding: 48px clamp(22px, 2.6vw, 48px);
    }

    .auth__card { max-width: 400px; }

    /* Sobre fondo sólido no hace falta el cristal */
    .option,
    .back,
    .field input,
    .alert { backdrop-filter: none; -webkit-backdrop-filter: none; }

    .option      { background: var(--surface); }
    .option:hover { background: var(--surface-2); }
    .back        { background: var(--surface); }
    .field input { background: var(--surface); }
    .field input:focus { background: var(--surface-2); }
    .alert       { background: var(--accent-soft); }

    .auth__hero {
        order: 2;
        position: relative;
        inset: auto;
        display: flex;
        align-items: flex-end;
        border-left: 1px solid var(--line);
        pointer-events: auto;
    }

    /* Aquí el velo oscurece menos: la imagen es la protagonista */
    .hero__veil {
        background:
            linear-gradient(180deg, rgba(8, 8, 12, .30) 0%, rgba(8, 8, 12, .72) 52%, rgba(8, 8, 12, .96) 100%),
            linear-gradient(90deg, rgba(8, 8, 12, .70) 0%, transparent 42%);
    }

    .hero__content {
        position: relative;
        inset: auto;
        width: 100%;
        padding: 0 0 36px;
    }

    .hero__badge,
    .hero__title,
    .hero__text { display: block; }

    .hero__badge {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        margin: 0 44px 20px;
        padding: 7px 14px;
        border-radius: 999px;
        background: rgba(255, 255, 255, .08);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border: 1px solid var(--line-strong);
        font-size: 11.5px;
        font-weight: 650;
        letter-spacing: .1em;
        color: #e4e4ee;
    }

    .hero__badge .dot {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: var(--live);
        box-shadow: 0 0 0 0 rgba(70, 211, 105, .55);
        animation: pulse 2s infinite;
    }

    @keyframes pulse {
        70%  { box-shadow: 0 0 0 9px rgba(70, 211, 105, 0); }
        100% { box-shadow: 0 0 0 0 rgba(70, 211, 105, 0); }
    }

    .hero__title {
        margin: 0 44px 10px;
        font-size: clamp(30px, 2.9vw, 42px);
        font-weight: 800;
        line-height: 1.1;
        letter-spacing: -.03em;
        text-shadow: 0 2px 24px rgba(0, 0, 0, .6);
    }

    .hero__meta {
        display: flex;
        align-items: center;
        gap: 14px;
        margin: 0 44px 12px;
        font-size: 13.5px;
        color: #cfcfdb;
    }

    .hero__meta[hidden] { display: none; }

    .hero__rating {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        padding: 4px 11px;
        border-radius: 999px;
        background: rgba(255, 193, 7, .15);
        border: 1px solid rgba(255, 193, 7, .35);
        color: #ffc83d;
        font-weight: 650;
    }

    .hero__rating:empty { display: none; }
    .hero__year:empty   { display: none; }

    .hero__text {
        margin: 0 44px 28px;
        max-width: 46ch;
        color: #b9b9c8;
        font-size: 14.5px;
        line-height: 1.6;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .posters__track { padding: 6px 44px; }
    .poster { width: 104px; }
    .poster:hover { opacity: 1; transform: translateY(-5px); }
}

@media (min-width: 1500px) {
    .auth__card { max-width: 440px; }
    .auth__logo { width: clamp(180px, 14vw, 230px); max-height: 230px; }
    .hero__badge, .hero__title, .hero__meta, .hero__text { margin-left: 60px; margin-right: 60px; }
    .posters__track { padding: 6px 60px; }
    .poster { width: 116px; }
}

/* ============================================================================
   Activación por equipo — el código que el cliente pasa a su proveedor
   ========================================================================== */

.device { text-align: center; }

.device__code {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 92px;
    padding: 18px 16px;
    margin-bottom: 14px;
    background: rgba(21, 21, 29, .88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-lg);
    font-size: clamp(30px, 9vw, 42px);
    font-weight: 800;
    letter-spacing: .08em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Puntos de carga mientras llega el código */
.device__dots { display: inline-flex; gap: 9px; }

.device__dots i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--muted-dim);
    animation: dots 1.2s ease-in-out infinite;
}

.device__dots i:nth-child(2) { animation-delay: .15s; }
.device__dots i:nth-child(3) { animation-delay: .3s; }

@keyframes dots {
    0%, 60%, 100% { opacity: .3; transform: translateY(0); }
    30%           { opacity: 1;  transform: translateY(-5px); }
}

.device__copy {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    padding: 9px 16px;
    background: none;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: color .2s, border-color .2s;
}

.device__copy:hover { color: var(--text); border-color: var(--line-strong); }

.device__state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--r-md);
    background: rgba(21, 21, 29, .7);
    border: 1px solid var(--line);
    font-size: 13.5px;
    color: var(--muted);
}

.device__state.is-waiting { color: #ffc83d; border-color: rgba(255, 200, 61, .3); }
.device__state.is-ok      { color: var(--live); border-color: rgba(70, 211, 105, .35); }

.device__state.is-error {
    color: #ffc2c6;
    background: rgba(229, 9, 20, .16);
    border-color: rgba(229, 9, 20, .4);
}

.device__spin {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, .18);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

.device__state.is-error .device__spin,
.device__state.is-ok .device__spin { display: none; }

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

.device__hint {
    margin: 16px 0 0;
    color: var(--muted-dim);
    font-size: 12.5px;
    line-height: 1.6;
}

.device__reset {
    margin-top: 14px;
    padding: 0;
    background: none;
    border: 0;
    color: var(--muted-dim);
    font: inherit;
    font-size: 12.5px;
    text-decoration: underline;
    cursor: pointer;
}

.device__reset:hover { color: var(--text); }

@media (min-width: 900px) {
    .device__code,
    .device__state { backdrop-filter: none; -webkit-backdrop-filter: none; }
    .device__code  { background: var(--surface); }
    .device__state { background: var(--surface); }
}
