/* ==========================================================
   ONBOARDING Y PULSOS DEL LOGIN

   Dos cosas que comparten el mismo fondo animado, por eso van
   juntas: la pantalla de ingreso y las cinco pantallas de la
   primera vez.

   LA REGLA DE RENDIMIENTO DE TODO ESTE ARCHIVO:

   Solo se animan `transform` y `opacity`. Ninguna otra
   propiedad. Esas dos las resuelve el compositor sin tocar
   layout ni repintar, asi que corren en el hilo grafico y no
   compiten con el CRM que esta cargando atras.

   Animar `filter: blur()` o `background-position` —que es lo
   que uno escribe primero para un "pulso de luz"— obliga a
   repintar la zona entera en cada cuadro. Con tres manchas de
   400px sobre un telefono, eso es el login tartamudeando
   justo cuando la persona esta tipeando su contraseña.

   Por eso las manchas llevan el desenfoque FIJO y lo que se
   mueve es su escala y su opacidad.
   ========================================================== */

/* ==========================================================
   1. EL FONDO DE LUZ, COMPARTIDO
   ========================================================== */

.onb-fondo,
.auth-luces {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
    /* Recorta las manchas contra el borde de la caja sin crear
       un contenedor de scroll (ver el bloque 1 de app-movil.css:
       `hidden` dejo la app sin poder deslizarse). */
    border-radius: inherit;
}

.onb-fondo i,
.auth-luces i {
    position: absolute;
    display: block;
    width: 46vmax;
    height: 46vmax;
    border-radius: 50%;
    /* El desenfoque es FIJO. Ver la nota de arriba. */
    filter: blur(90px);
    opacity: .5;
    will-change: transform, opacity;
}

.onb-fondo i:nth-child(1),
.auth-luces i:nth-child(1) {
    top: -18vmax; left: -14vmax;
    background: var(--primary, #2be58b);
    animation: luz-respira 11s ease-in-out infinite;
}

.onb-fondo i:nth-child(2),
.auth-luces i:nth-child(2) {
    bottom: -20vmax; right: -16vmax;
    background: #37c2ff;
    opacity: .34;
    animation: luz-respira 14s ease-in-out infinite reverse;
    animation-delay: -4s;
}

.onb-fondo i:nth-child(3),
.auth-luces i:nth-child(3) {
    top: 36%; left: 44%;
    width: 30vmax; height: 30vmax;
    background: #7c6cff;
    opacity: .22;
    animation: luz-deriva 17s ease-in-out infinite;
    animation-delay: -7s;
}

@keyframes luz-respira {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); opacity: .5; }
    50%      { transform: translate3d(6%, 5%, 0) scale(1.18); opacity: .28; }
}

@keyframes luz-deriva {
    0%, 100% { transform: translate3d(-8%, 0, 0) scale(.9); }
    50%      { transform: translate3d(10%, -7%, 0) scale(1.1); }
}

/* Quien pidio menos movimiento ve las manchas quietas: el
   degradado de color se queda, el latido no. */
@media (prefers-reduced-motion: reduce) {
    .onb-fondo i,
    .auth-luces i { animation: none !important; }
}

/* ==========================================================
   2. LOS PULSOS EN LA PANTALLA DE INGRESO

   Las luces las inserta js/onboarding.js dentro de #auth-screen.
   Van DETRAS de la tarjeta del formulario, no encima: lo que se
   mira ahi es un campo de contraseña, y nada tiene que
   moverse por delante.
   ========================================================== */

#auth-screen {
    position: relative;
    isolation: isolate;   /* las luces no se escapan a otras capas */
}

#auth-screen > *:not(.auth-luces) {
    position: relative;
    z-index: 1;
}

/* ==========================================================
   3. EL ONBOARDING
   ========================================================== */

#onboarding {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    background: var(--bg-main, #10151a);
    opacity: 0;
    transition: opacity 300ms var(--c-inout, cubic-bezier(.2,.8,.2,1));
    /* El teclado del telefono no tiene que empujar el marco
       entero cuando se escribe el nombre en el ultimo paso. */
    overflow: hidden;
}

#onboarding.visible { opacity: 1; }

.onb-marco {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: calc(16px + env(safe-area-inset-top)) 0 calc(14px + env(safe-area-inset-bottom));
}

/* --- La pista que se desliza -------------------------------
   Los pasos van uno al lado del otro en una fila que mide
   N x 100%, y se mueve toda junta con un solo translate. Es
   una propiedad compuesta: ni layout ni repintado. */
.onb-pista {
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
    transform: translate3d(0, 0, 0);
    transition: transform 280ms var(--c-inout, cubic-bezier(.22,.9,.26,1));
    will-change: transform;
}

.onb-paso {
    flex: 0 0 100%;
    width: 100%;
    min-width: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 0 22px;
}

@media (prefers-reduced-motion: reduce) {
    .onb-pista { transition: none; }
    #onboarding { transition: none; }
}

.onb-centro {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    min-height: 100%;
    justify-content: center;
    padding: 18px 0;
}

.onb-centro h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 750;
    letter-spacing: -0.02em;
    color: var(--text-main, #e9ebf1);
}

.onb-centro > p {
    margin: 0;
    max-width: 34ch;
    font-size: 14px;
    line-height: 1.45;
    color: var(--text-muted, #9aa5a0);
}

.onb-logo img {
    width: 84px; height: 84px;
    object-fit: contain;
    border-radius: 20px;
}

/* --- Foto --- */
.onb-avatar {
    width: 128px; height: 128px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--primary, #2be58b);
    flex: 0 0 auto;
}

.onb-avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
    /* Sin esto, el `max-width: 100%` global del proyecto deforma
       la foto dentro de un contenedor flexible. Es el mismo
       problema que dejo el avatar de Mi Perfil en 60x92. */
    max-width: none;
}

.onb-acciones-foto {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 300px;
}

/* Mismo motivo que los botones del pie: hay un
   `height !important` en ajustes.css que hay que pisar. */
.onb-btn-ancho {
    width: 100% !important;
    justify-content: center !important;
    height: auto !important;
    min-height: 46px !important;
}

.onb-estado {
    margin: 0;
    font-size: 12.5px;
    min-height: 18px;
    color: var(--text-muted, #9aa5a0);
}

/* --- Grillas de opciones --- */
.onb-grilla {
    display: grid;
    gap: 8px;
    width: 100%;
    /* `max-content` por la misma razon que en la galeria de
       fondos: con filas automaticas dentro de un alto acotado,
       el navegador las aplasta y las tarjetas se montan. */
    grid-auto-rows: max-content;
}

.onb-grilla--modos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.onb-grilla--fondos { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.onb-opcion {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 13px 12px;
    min-height: 92px;
    border: 1px solid var(--border-color, #23262b);
    border-radius: 13px;
    background: var(--surf-1, #171719);
    color: var(--text-main, #e9ebf1);
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 140ms, transform 140ms;
}

.onb-opcion i { font-size: 17px; color: var(--primary, #2be58b); }
.onb-opcion strong { font-size: 13.5px; font-weight: 650; }
.onb-opcion small { font-size: 10.5px; line-height: 1.3; color: var(--text-muted, #9aa5a0); }

.onb-opcion.activa {
    border-color: var(--primary, #2be58b);
    box-shadow: inset 0 0 0 1px var(--primary, #2be58b);
}

.onb-opcion:active { transform: scale(.97); transition: none; }

/* --- Colores --- */
.onb-colores {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    width: 100%;
    max-width: 300px;
}

.onb-color {
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px solid transparent;
    background: var(--c);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 140ms;
}

.onb-color.activa {
    /* El anillo va por fuera con `outline` y no con un borde:
       un borde comeria del circulo y el color se veria mas
       chico que los otros siete. */
    outline: 2px solid var(--text-main, #e9ebf1);
    outline-offset: 3px;
}

.onb-color:active { transform: scale(.9); transition: none; }

/* --- Fondos ---
   LA CLASE SE LLAMA `.onb-clip` Y NO `.onb-fondo`, Y HAY UN
   MOTIVO CARO DETRAS.

   La primera version les puso `onb-fondo` a estos botones, que
   es la MISMA clase del contenedor de las luces de arriba de
   este archivo. Los botones heredaron su
   `position: absolute; inset: 0` y cada uno paso a ocupar la
   pantalla entera: los rotulos de los ocho videos aparecian
   apilados sobre el paso de bienvenida, que ni siquiera era el
   paso donde viven.

   "Fondo" es una palabra que en este archivo significa dos
   cosas distintas —el fondo de luz de la pantalla y el clip de
   fondo del CRM— asi que una de las dos tenia que cambiar de
   nombre. */
.onb-clip {
    position: relative;
    display: block;
    aspect-ratio: 16 / 10;
    min-height: 86px;
    border: 1px solid var(--border-color, #23262b);
    border-radius: 11px;
    overflow: hidden;
    background: var(--surf-2, #1c1c1f);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.onb-grilla--fondos video {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}

.onb-grilla--fondos span {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 12px 6px 4px;
    font-size: 9.5px;
    color: #fff;
    background: linear-gradient(to top, rgba(0,0,0,.85), transparent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.onb-grilla--fondos button.activa {
    border-color: var(--primary, #2be58b);
    box-shadow: inset 0 0 0 2px var(--primary, #2be58b);
}

/* --- Campos --- */
.onb-campo {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
    max-width: 340px;
    text-align: left;
}

.onb-campo span {
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--text-muted, #9aa5a0);
}

/* 16px o iOS hace zoom al enfocar y no vuelve. Mismo motivo
   que en app-movil.css. */
.onb-campo input {
    width: 100%;
    min-height: 46px;
    font-size: max(16px, 1em);
}

/* --- El pie --- */
.onb-pie {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px 22px 0;
}

.onb-puntos { display: flex; gap: 6px; }

.onb-puntos i {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--text-dim, #8b9a95);
    opacity: .35;
    transition: opacity 200ms, transform 200ms, background 200ms;
}

.onb-puntos i.activo {
    background: var(--primary, #2be58b);
    opacity: 1;
    transform: scale(1.4);
}

.onb-botones {
    display: flex;
    /* `center` y no el `stretch` por defecto: los dos botones
       quedaban a distinta altura —uno ocho pixeles mas abajo que
       el otro— porque heredan margenes distintos de las reglas
       de .btn del proyecto. Centrados en el eje, cualquier
       margen que traigan deja de descolocarlos. */
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 340px;
}

/* EL !important NO ES PEREZA, ES LA UNICA FORMA DE GANAR.

   ajustes.css trae
   `html body .btn { height: var(--h-md) !important; min-height: var(--h-md) !important }`.
   Una declaracion !important le gana a CUALQUIER regla normal,
   por mas especifica que sea: sin !important aca, estos botones
   salian de 30px de alto en vez de 48 y quedaban chicos para un
   pulgar justo en la pantalla que se toca seis veces seguidas.

   Y se pisa `height` ademas de `min-height`: aquella regla fija
   las dos, y dejando `height` en 30 el `min-height` de 48 no
   alcanza —gana el mas restrictivo de los dos en este caso—. */
.onb-botones .btn {
    flex: 1 1 0 !important;
    justify-content: center !important;
    height: 48px !important;
    min-height: 48px !important;
    margin: 0 !important;
}

.onb-botones .btn:disabled { opacity: .35; pointer-events: none; }

.onb-saltar {
    border: none;
    background: none;
    color: var(--text-dim, #8b9a95);
    font-size: 12.5px;
    text-decoration: underline;
    cursor: pointer;
    padding: 4px 8px;
    -webkit-tap-highlight-color: transparent;
}

/* ==========================================================
   4. LOS ATAJOS DE SECCION EN MI PERFIL (solo rol TEAM S/C)

   Los arma js/shell-movil.js cuando la barra no tiene menu
   "Mas". Ver colgarAtajosEnPerfil().
   ========================================================== */

.shell-atajos {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.shell-atajo {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 48px;
    padding: 0 12px;
    border: 1px solid var(--border-color, #23262b);
    border-radius: 11px;
    background: var(--surf-1, #171719);
    color: var(--text-main, #e9ebf1);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.shell-atajo i { font-size: 15px; color: var(--primary, #2be58b); flex: 0 0 auto; }
.shell-atajo span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shell-atajo:active { transform: scale(.97); transition: none; }
