/* ============================================================================
   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   → cuerpo oscuro, rejilla y resplandor naranja
     3. Fondo animado   → el "tablero" decorativo (.dash-*, .kpi-*)
                          Es SVG dibujado en login.php; acá sólo se anima.
                          Para calmarlo: bajar la opacidad de .dash-bg o quitar
                          las animaciones de .dash-line / .dash-bars / .kpi.
     4. Tarjeta         → .login-card y su cabecera
     5. Campo y captcha → .field-group, .input-wrap, .captcha-*
     6. Botón y pie     → .btn-login, .secure-badge
     7. Loader          → overlay "Validando acceso" al enviar
     8. 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:      #0a0a0a;
      --ink-2:     #cfccc8;   /* texto secundario claro */
      --card-bg:   #ffffff;
      --card-bg-t: rgba(26,23,20,.66);          /* vidrio oscuro translúcido */
      --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;
    }

    /* ─── Tech grid dark background ─────────────────────── */
    body::before {
      content: '';
      position: fixed;
      inset: 0;
      pointer-events: none;
      z-index: 0;
      background:
        linear-gradient(rgba(255,109,0,.05) 1px, transparent 1px) 0 0 / 100% 34px,
        linear-gradient(90deg, rgba(255,109,0,.05) 1px, transparent 1px) 0 0 / 34px 100%,
        radial-gradient(120% 90% at 50% 20%, #17120d 0%, #0d0b09 45%, #050505 100%);
      mask-image: radial-gradient(120% 90% at 50% 30%, #000 30%, transparent 100%);
      -webkit-mask-image: radial-gradient(120% 90% at 50% 30%, #000 30%, transparent 100%);
    }
    /* Orange glow accents */
    body::after {
      content: '';
      position: fixed;
      width: 520px; height: 520px;
      border-radius: 50%;
      background: var(--primary);
      filter: blur(150px);
      opacity: .16;
      top: -160px; right: -160px;
      pointer-events: none;
      z-index: 0;
      animation: blob2 11s ease-in-out infinite alternate;
    }
    @keyframes blob2 { to { transform: translate(-70px, 70px) scale(1.18); } }

    /* ─── Fondo: tablero de indicadores animado ──────────── */
    .dash-bg {
      position: fixed;
      inset: 0;
      z-index: 0;
      pointer-events: none;
      overflow: hidden;
      /* Se atenúa en el centro para que la tarjeta siempre sea legible. */
      mask-image: radial-gradient(75% 60% at 50% 50%, transparent 8%, rgba(0,0,0,.55) 42%, #000 78%);
      -webkit-mask-image: radial-gradient(75% 60% at 50% 50%, transparent 8%, rgba(0,0,0,.55) 42%, #000 78%);
      animation: dashIn 1.4s ease both;
    }
    @keyframes dashIn { from { opacity: 0; } to { opacity: 1; } }

    .dash-svg { width: 100%; height: 100%; display: block; }

    /* Ejes */
    .dash-axes line {
      stroke: rgba(255,255,255,.06);
      stroke-width: 1;
      stroke-dasharray: 6 10;
    }

    /* Áreas bajo las curvas */
    .dash-area { stroke: none; }
    .area-a    { filter: drop-shadow(0 -6px 26px rgba(255,109,0,.14)); }

    /* Líneas de tendencia (se dibujan en bucle) */
    .dash-line {
      fill: none;
      stroke-linecap: round;
      stroke-dasharray: 2600;
      stroke-dashoffset: 2600;
      animation: dashDraw 14s ease-in-out infinite;
    }
    .line-a { stroke: rgba(255,109,0,.75); stroke-width: 3; filter: drop-shadow(0 0 10px rgba(255,109,0,.45)); }
    .line-b { stroke: rgba(143,163,176,.35); stroke-width: 2; animation-delay: -3s; }

    @keyframes dashDraw {
      0%   { stroke-dashoffset: 2600; }
      55%  { stroke-dashoffset: 0; }
      88%  { stroke-dashoffset: 0; opacity: 1; }
      100% { stroke-dashoffset: 0; opacity: 0; }
    }

    /* Punto que recorre la serie principal */
    .dash-runner {
      fill: #ff6d00;
      filter: drop-shadow(0 0 12px rgba(255,109,0,.9));
    }

    /* Barras */
    .dash-bars rect {
      fill: rgba(255,109,0,.22);
      transform-box: fill-box;
      transform-origin: bottom;
      animation: barGrow 3.6s cubic-bezier(.45,0,.25,1) infinite alternate;
    }
    .dash-bars.bars-alt rect { fill: rgba(143,163,176,.16); animation-duration: 4.4s; }
    @keyframes barGrow {
      from { transform: scaleY(var(--s, .4)); }
      to   { transform: scaleY(1); }
    }

    /* Donut de progreso */
    .dash-donut circle { fill: none; }
    .donut-track { stroke: rgba(255,255,255,.07); stroke-width: 14; }
    .donut-value {
      stroke: rgba(255,109,0,.55);
      stroke-width: 14;
      stroke-linecap: round;
      stroke-dasharray: 390;
      transform: rotate(-90deg);
      transform-box: fill-box;
      transform-origin: center;
      animation: donutFill 7s ease-in-out infinite alternate;
    }
    .donut-core { stroke: rgba(255,109,0,.18); stroke-width: 2; stroke-dasharray: 4 8;
      transform-box: fill-box; transform-origin: center;
      animation: spinSlow 22s linear infinite; }
    @keyframes donutFill {
      from { stroke-dashoffset: 330; }
      to   { stroke-dashoffset: 110; }
    }
    @keyframes spinSlow { to { transform: rotate(360deg); } }

    /* Anillo tipo radar */
    .dash-radar circle { fill: none; }
    .radar-ring {
      stroke: rgba(255,109,0,.4);
      stroke-width: 2;
      transform-box: fill-box;
      transform-origin: center;
      animation: radarPing 2.8s ease-out infinite;
    }
    .radar-dot { fill: rgba(255,109,0,.7); }
    @keyframes radarPing {
      0%   { transform: scale(.35); opacity: .85; }
      100% { transform: scale(2.6);  opacity: 0; }
    }

    /* Puntos de datos */
    .dash-dots circle {
      fill: rgba(255,109,0,.85);
      transform-box: fill-box;
      transform-origin: center;
      animation: dotPulse 3.2s ease-in-out infinite;
    }
    @keyframes dotPulse {
      0%, 100% { transform: scale(.7);  opacity: .35; }
      50%      { transform: scale(1.5); opacity: .95; }
    }

    /* Barrido de escaneo */
    .dash-sweep { animation: sweepX 9s linear infinite; }
    @keyframes sweepX {
      from { transform: translateX(0); }
      to   { transform: translateX(1500px); }
    }

    /* KPI fantasma */
    .kpi {
      position: absolute;
      display: flex;
      flex-direction: column;
      gap: 2px;
      padding: 10px 14px;
      border: 1px solid rgba(255,255,255,.07);
      border-radius: 12px;
      background: rgba(255,255,255,.025);
      backdrop-filter: blur(2px);
      animation: kpiFloat 9s ease-in-out infinite alternate;
    }
    .kpi-label {
      font-family: var(--font);
      font-size: .58rem;
      font-weight: 800;
      letter-spacing: 1.4px;
      text-transform: uppercase;
      color: rgba(255,255,255,.32);
    }
    .kpi-val {
      font-family: var(--mono);
      font-size: 1.15rem;
      font-weight: 700;
      color: rgba(255,109,0,.62);
      font-variant-numeric: tabular-nums;
    }
    .kpi-val.up { color: rgba(120,200,150,.6); }

    .kpi-1 { top: 12%;  left: 6%;  animation-delay: -1s; }
    .kpi-2 { top: 68%;  right: 7%; animation-delay: -4s; }
    .kpi-3 { bottom: 12%; left: 9%; animation-delay: -7s; }

    @keyframes kpiFloat {
      from { transform: translateY(-7px); }
      to   { transform: translateY(7px); }
    }

    /* En pantallas chicas se ocultan los KPI (no hay lugar) y se despeja
       más el centro, donde queda la tarjeta. */
    @media (max-width: 720px) {
      .kpi { display: none; }
      .dash-bg {
        mask-image: radial-gradient(85% 42% at 50% 50%, transparent 18%, rgba(0,0,0,.6) 55%, #000 90%);
        -webkit-mask-image: radial-gradient(85% 42% at 50% 50%, transparent 18%, rgba(0,0,0,.6) 55%, #000 90%);
      }
    }

    @media (prefers-reduced-motion: reduce) {
      .dash-bg *,
      .dash-bg { animation: none !important; }
      .dash-line { stroke-dashoffset: 0; }
    }

    /* ─── 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: 118px;
      height: 118px;
      object-fit: contain;
      /* Giro horario, velocidad media: un giro cada 8s */
      animation: logoSpin 8s linear infinite;
      filter: drop-shadow(0 0 22px rgba(255,109,0,.35));
      will-change: transform;
    }
    @keyframes logoSpin {
      from { transform: rotate(0deg); }
      to   { transform: rotate(360deg); }
    }
    /* Respeta a quienes prefieren menos movimiento */
    @media (prefers-reduced-motion: reduce) {
      .brand-logo { animation: none; }
    }
    /* ─── Wordmark (based on ult.jpg) ───────────────────── */

    /* ─── 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;
      -webkit-backdrop-filter: blur(18px) saturate(140%);
      backdrop-filter: blur(18px) saturate(140%);
    }
    /* Halo naranja interno para dar vida */
    .login-card::after {
      content: '';
      position: absolute;
      width: 320px; height: 320px;
      top: -160px; left: -120px;
      border-radius: 50%;
      background: radial-gradient(circle, rgba(255,109,0,.22), transparent 70%);
      pointer-events: none;
      z-index: 0;
    }
    .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; }
    }