/* ============================================================================
   login.css — estilos de la pantalla de acceso (views/main/login.php)
   ============================================================================

   La pantalla es sólo el CAPTCHA: no hay usuario, contraseña, registro ni
   recuperación (esas reglas ya se eliminaron de este archivo).

   CÓMO ESTÁ ORGANIZADO
     1. Tokens          → colores, tipografías y medidas base (:root)
     2. Reset y fondo   → grafito sólido con trama diagonal estática.
                          Son sólo body::before y body::after: no hay SVG,
                          no hay nodos decorativos en el HTML y no hay
                          ninguna animación en bucle. Para subirlo o
                          bajarlo de tono, mover --trama-fina y
                          --trama-ancha en :root.
     3. Tarjeta         → .login-card y su cabecera
     4. Campo y captcha → .field-group, .input-wrap, .captcha-*
     5. Botón y pie     → .btn-login, .secure-badge
     6. Loader          → overlay "Validando acceso" al enviar
     7. Responsive      → ajustes por ancho y por alto de pantalla

   El color naranja de marca sale de --primary; cambiándolo ahí se actualiza
   toda la pantalla (líneas del fondo, captcha, botón y foco de los campos).
   ========================================================================== */

   /* ─── 1. Design Tokens ──────────────────────────────── */
    :root {
      --primary:   #ff6d00;   /* naranja principal */
      --primary-d: #c94f00;   /* naranja oscuro (gradiente/hover) */
      --secondary: #B0B0B0;   /* gris complementario */
      --teal:      #ff6d00;   /* alias legacy → apunta al primario */
      --ink:       #e8e7e5;
      --slate:     #6b7075;   /* gris azulado neutro para labels/iconos */
      --dark:      #0b0e13;   /* grafito base del fondo */
      --ink-2:     #cfccc8;   /* texto secundario claro */
      --card-bg:   #ffffff;
      --card-bg-t: rgba(19,24,31,.94);          /* tarjeta sólida sobre la trama */

      /* Trama diagonal del fondo (ver body::before) */
      --trama-fina:  rgba(255,255,255,.055);
      --trama-ancha: rgba(255,255,255,.13);
      --input-bg:  rgba(255,255,255,.055);       /* input sobre vidrio */
      --input-bg-f:rgba(255,109,0,.06);          /* input enfocado (tinte naranja) */
      --border:    rgba(255,255,255,.12);
      --shadow:    0 24px 64px rgba(0,0,0,.55);
      --radius:    18px;
      --font:      'Nunito', sans-serif;
      --mono:      'Courier New', ui-monospace, monospace;
    }

    /* ─── Reset / Base ───────────────────────────────────── */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    body {
      font-family: var(--font);
      min-height: 100dvh;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      background: var(--dark);
      overflow-x: hidden;
      position: relative;
    }

    /* ─── 2. Fondo ───────────────────────────────────────────
       Grafito sólido con trama diagonal. Todo es estático: la
       sensación de movimiento la da la dirección del patrón, no
       una animación. Dos capas fijas, sin SVG y sin nodos extra
       en el HTML:

         body::before → planos + trama
         body::after  → velo central + un solo reflejo de marca

       Para calmarlo o subirlo de tono, mover sólo los alfa de las
       tramas (--trama-fina / --trama-ancha).
    ────────────────────────────────────────────────────────── */

    body::before {
      content: '';
      position: fixed;
      inset: 0;
      pointer-events: none;
      z-index: 0;
      background:
        /* 1. Hairlines diagonales: la trama propiamente dicha. */
        repeating-linear-gradient(
          135deg,
          var(--trama-fina) 0 1px,
          transparent 1px 13px
        ),
        /* 2. Bandas anchas: cada 9 hairlines una marcada, para que
              la trama tenga ritmo y no se lea como un tramado plano. */
        repeating-linear-gradient(
          135deg,
          var(--trama-ancha) 0 1px,
          transparent 1px 117px
        ),
        /* 3. Planos de fondo: el degradado diagonal separa la
              pantalla en dos masas de distinto tono. */
        linear-gradient(135deg, #161d26 0%, #0e131a 46%, #080a0e 100%);
    }

    body::after {
      content: '';
      position: fixed;
      inset: 0;
      pointer-events: none;
      z-index: 0;
      background:
        /* Reflejo de marca: fijo, en una esquina, muy contenido. */
        radial-gradient(58% 42% at 92% 6%, rgba(255,109,0,.10), transparent 62%),
        /* Velo central: apaga la trama detrás de la tarjeta para que
           el texto siempre tenga contraste. Se mantiene ceñido a la
           tarjeta para que el patrón llegue cerca y no quede un hueco
           liso en medio de la pantalla. */
        radial-gradient(42% 40% at 50% 50%,
          rgba(6,8,11,.88) 0%,
          rgba(6,8,11,.50) 55%,
          transparent 100%);
    }

    /* ─── Page wrapper ───────────────────────────────────── */
    .page-wrapper {
      position: relative;
      z-index: 1;
      width: 100%;
      max-width: 460px;
      padding: 16px;
      animation: fadeUp .6s ease both;
    }
    @keyframes fadeUp {
      from { opacity: 0; transform: translateY(28px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    /* ─── Brand header ───────────────────────────────────── */
    .brand-header {
      text-align: center;
      margin-bottom: 16px;
    }
    /* ─── Logo (imagen) ──────────────────────────────────── */
    .brand-logo {
      display: inline-block;
      width: 108px;
      height: 108px;
      object-fit: contain;
      /* Quieto: sólo una sombra tenue que lo despega de la trama. */
      filter: drop-shadow(0 6px 18px rgba(0,0,0,.55));
    }
    /* logoSpin se conserva porque lo usa el anillo del loader. */
    @keyframes logoSpin {
      from { transform: rotate(0deg); }
      to   { transform: rotate(360deg); }
    }

    /* ─── Card ───────────────────────────────────────────── */
    .login-card {
      background: var(--card-bg-t);
      border-radius: var(--radius);
      padding: 26px 28px 24px;
      box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.06);
      border: 1px solid rgba(255,255,255,.08);
      position: relative;
      overflow: hidden;
      /* Casi opaca: la trama del fondo no debe leerse a través de la
         tarjeta. El blur queda mínimo, sólo para el canto. */
      -webkit-backdrop-filter: blur(6px);
      backdrop-filter: blur(6px);
    }
    .login-card > * { position: relative; z-index: 1; }
    /* Barra de acento tech en el borde superior */
    .login-card::before {
      content: '';
      position: absolute;
      top: 0; left: 0; right: 0;
      height: 3px;
      background: linear-gradient(90deg, transparent, var(--primary) 30%, var(--primary) 70%, transparent);
      z-index: 2;
    }

    /* ─── Cabecera de sección (registro / recuperación) ──── */
    .card-head {
      text-align: center;
      margin-bottom: 20px;
    }
    .card-head.compact { margin-bottom: 16px; }
    .card-head h2 {
      font-family: var(--mono);
      font-size: 1.25rem;
      font-weight: 800;
      letter-spacing: 1px;
      text-transform: uppercase;
      color: var(--ink);
      margin: 0;
    }
    .card-head h2 .accent { color: var(--primary); }
    .card-head .head-line {
      width: 46px;
      height: 3px;
      margin: 10px auto 0;
      border-radius: 3px;
      background: linear-gradient(90deg, var(--primary), var(--primary-d));
      box-shadow: 0 0 12px rgba(255,109,0,.5);
    }
    .card-head p {
      margin: 12px 0 0;
      font-size: .8rem;
      line-height: 1.5;
      color: var(--ink-2);
      font-weight: 600;
    }

    /* ─── Field groups ───────────────────────────────────── */
    .field-group {
      margin-bottom: 14px;
    }
    .field-label {
      display: block;
      font-size: .7rem;
      font-weight: 800;
      letter-spacing: 1.4px;
      text-transform: uppercase;
      color: var(--secondary);
      margin-bottom: 6px;
    }
    .input-wrap {
      display: flex;
      align-items: center;
      background: var(--input-bg);
      border: 1.5px solid var(--border);
      border-radius: 10px;
      padding: 0 14px;
      transition: border-color .2s, box-shadow .2s, background .2s;
    }
    .input-wrap:focus-within {
      border-color: var(--primary);
      background: var(--input-bg-f);
      box-shadow: 0 0 0 3px rgba(255,109,0,.18);
    }
    .input-wrap .material-icons {
      font-size: 1.2rem;
      color: var(--secondary);
      opacity: .85;
      flex-shrink: 0;
      transition: color .2s;
    }
    .input-wrap:focus-within .material-icons { color: var(--primary); opacity: 1; }
    .input-wrap input {
      flex: 1;
      border: none !important;
      background: transparent !important;
      box-shadow: none !important;
      height: 48px;
      font-family: var(--font);
      font-size: .95rem;
      color: var(--ink);
      padding: 0 10px;
    }
    /* Autofill del navegador (evita el fondo blanco) */
    .input-wrap input:-webkit-autofill,
    .input-wrap input:-webkit-autofill:focus {
      -webkit-text-fill-color: var(--ink);
      -webkit-box-shadow: 0 0 0 1000px rgba(26,23,20,.9) inset;
      caret-color: var(--ink);
      transition: background-color 9999s;
    }
    .input-wrap input::placeholder { color: rgba(176,176,176,.55); }
    /* Remove Materialize underline */
    .input-wrap input:focus { border: none !important; box-shadow: none !important; }

    /* Toggle eye button */

    /* ─── CAPTCHA display ────────────────────────────────── */
    .captcha-row {
      display: flex;
      gap: 10px;
      margin-top: 10px;
    }
    .captcha-display {
      flex: 1;
      background: var(--input-bg);
      border: 1.5px dashed var(--border);
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      padding: 10px 16px;
      position: relative;
      overflow: hidden;
    }
    /* Subtle noise texture */
    .captcha-display::before {
      content: '';
      position: absolute;
      inset: 0;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='60'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='60' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
      pointer-events: none;
    }
    .captcha-char {
      font-size: 1.55rem;
      font-weight: 800;
      color: var(--ink);
      letter-spacing: 2px;
      font-family: var(--mono);
      user-select: none;
      text-shadow: 0 0 10px rgba(255,109,0,.25);
    }
    .captcha-char:nth-child(odd)  { color: var(--primary); transform: rotate(-4deg); }
    .captcha-char:nth-child(even) { color: var(--ink);     transform: rotate(3deg);  }

    .captcha-refresh {
      width: 48px;
      height: 48px;
      background: var(--input-bg);
      border: 1.5px solid var(--border);
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      color: var(--secondary);
      transition: background .2s, color .2s, transform .35s;
      flex-shrink: 0;
    }
    .captcha-refresh:hover {
      background: var(--teal);
      color: #fff;
      border-color: var(--teal);
    }
    .captcha-refresh.spinning { transform: rotate(360deg); }

    /* ─── Submit button ──────────────────────────────────── */
    .btn-login {
      width: 100%;
      height: 52px;
      border: none;
      border-radius: 12px;
      background: linear-gradient(135deg, var(--primary) 0%, var(--primary-d) 100%);
      color: #fff;
      font-family: var(--font);
      font-size: 1rem;
      font-weight: 800;
      letter-spacing: .5px;
      cursor: pointer;
      margin-top: 20px;
      box-shadow: 0 8px 24px rgba(255,109,0,.35);
      transition: transform .15s, box-shadow .15s, filter .15s;
      position: relative;
      overflow: hidden;
    }
    .btn-login::after {
      content: '';
      position: absolute;
      inset: 0;
      background: linear-gradient(135deg,rgba(255,255,255,.18) 0%,transparent 60%);
    }
    .btn-login:hover  { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(255,109,0,.5); }
    .btn-login:active { transform: translateY(0);    box-shadow: 0 4px 12px rgba(255,109,0,.3); filter: brightness(.95); }

    /* ─── Mantener sesión (checkbox) ─────────────────────── */

    /* ─── Footer badge ───────────────────────────────────── */
    .secure-badge {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      margin-top: 14px;
      font-size: .75rem;
      color: rgba(255,255,255,.45);
      letter-spacing: .5px;
    }
    .secure-badge .material-icons { font-size: 1rem; color: var(--teal); opacity: .8; }

    /* ─── Responsive ─────────────────────────────────────── */
    @media (min-width: 600px) {
      .login-card { padding: 44px 44px 36px; }
    }
    @media (min-width: 960px) {
      .page-wrapper { max-width: 480px; }
    }

    /* ─── Pantallas bajas (celular): comprimir al máximo ──── */
    @media (max-height: 780px) {
      .brand-header { margin-bottom: 10px; }
      .brand-logo  { width: 92px; height: 92px; }
      .login-card  { padding: 20px 24px 20px; }
      .field-group { margin-bottom: 11px; }
      .card-head   { margin-bottom: 14px; }
      .card-head.compact { margin-bottom: 12px; }
      .card-head p { font-size: .76rem; margin-top: 8px; }
      .input-wrap input { height: 44px; }
      .captcha-refresh, .captcha-display { min-height: 44px; }
      .btn-login   { height: 48px; margin-top: 16px; }
      .secure-badge{ margin-top: 10px; }
    }
    /* Muy bajas: recorta lo prescindible del registro */
    @media (max-height: 660px) {
      .brand-logo { width: 78px; height: 78px; }
    }

    /* ─── Error state ────────────────────────────────────── */
    .input-wrap.error { border-color: #EF5350; box-shadow: 0 0 0 3px rgba(239,83,80,.12); }
    .error-msg { font-size: .72rem; color: #EF5350; margin-top: 5px; font-weight: 600; display: none; }
    .error-msg.show { display: block; }

    /* ─── App alerts (setmensaje) ────────────────────────── */

    /* ─── Toggle entre login y registro ─────────────────── */

    /* ─── Texto descriptivo dentro de tarjeta ───────────── */

    /* ─── Animación al cambiar de sección ───────────────── */
    #loginSection { animation: fadeUp .35s ease both; }

    /* ══════════════════════════════════════════════════════
       LOADER DE ACCESO (bio.)
    ══════════════════════════════════════════════════════ */
    .app-loader {
      position: fixed;
      inset: 0;
      z-index: 9999;
      display: none;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      background: radial-gradient(120% 90% at 50% 40%, rgba(23,18,13,.82), rgba(5,5,5,.92));
      -webkit-backdrop-filter: blur(12px) saturate(130%);
      backdrop-filter: blur(12px) saturate(130%);
    }
    .app-loader.show { display: flex; animation: fadeUp .25s ease both; }

    .loader-box {
      display: flex;
      flex-direction: column;
      align-items: center;
    }

    /* Anillo orbital + núcleo */
    .loader-orbit {
      position: relative;
      width: 92px;
      height: 92px;
      display: grid;
      place-items: center;
    }
    .loader-ring {
      position: absolute;
      inset: 0;
      border-radius: 50%;
      background: conic-gradient(from 0deg,
                  rgba(255,109,0,0) 0deg,
                  rgba(255,109,0,.15) 140deg,
                  var(--primary) 320deg,
                  var(--primary) 360deg);
      -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 6px));
              mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 6px));
      animation: logoSpin 1s linear infinite;
      filter: drop-shadow(0 0 10px rgba(255,109,0,.5));
    }
    /* Segundo anillo tenue, gris, girando al revés */
    .loader-orbit::before {
      content: '';
      position: absolute;
      inset: 12px;
      border-radius: 50%;
      border: 2px dashed rgba(176,176,176,.28);
      animation: logoSpin 6s linear infinite reverse;
    }
    .loader-core {
      font-family: var(--font);
      font-weight: 800;
      font-size: 1.9rem;
      color: var(--primary);
      text-shadow: 0 0 16px rgba(255,109,0,.6);
      animation: corePulse 1.2s ease-in-out infinite;
    }
    @keyframes corePulse {
      0%, 100% { opacity: 1;   transform: scale(1); }
      50%      { opacity: .55; transform: scale(.9); }
    }

    .loader-brand {
      margin-top: 22px;
      font-family: var(--font);
      font-weight: 800;
      font-size: 2rem;
      letter-spacing: -1.5px;
      color: var(--ink);
    }
    .loader-brand .dot {
      color: var(--primary);
      text-shadow: 0 0 18px rgba(255,109,0,.75);
    }

    .loader-msg {
      margin-top: 8px;
      font-family: var(--mono);
      font-size: .74rem;
      letter-spacing: 2px;
      text-transform: uppercase;
      color: var(--secondary);
    }
    /* Puntos "..." animados */
    .loader-dots::after {
      content: '';
      animation: loaderDots 1.4s steps(4, end) infinite;
    }
    @keyframes loaderDots {
      0%   { content: ''; }
      25%  { content: '.'; }
      50%  { content: '..'; }
      75%  { content: '...'; }
      100% { content: ''; }
    }

    @media (prefers-reduced-motion: reduce) {
      .loader-ring, .loader-orbit::before, .loader-core, .loader-dots::after { animation-duration: 2.5s; }
    }