/* /public_html/assets/css/main.css — MA Ayacucho (Producción)
   - Reset ligero + tipografía del sistema
   - Tokens unificados (guía del proyecto)
   - Sin reglas globales que deformen íconos (NO max-width:100% global)
   - Componentes base y formularios accesibles
   - FIX: elimina pseudo-decorativos bajo títulos (punto blanco)
*/

/* ---------- Variables y tokens ---------- */
:root {
  /* Compat de tu paleta */
  --brand: #0ea5e9;        /* cyan-500 */
  --brand-strong: #0284c7; /* sky-700 */
  --fg: #0f172a;           /* slate-900 */
  --fg-weak: #475569;      /* slate-600 */
  --bg: #ffffff;
  --border: #e2e8f0;       /* slate-200 */
  --muted: #cbd5e1;        /* slate-300 */
  --hint: #94a3b8;         /* slate-400 */
  --ok-bg: #ecfeff;        /* cyan-50 */
  --ok-fg: #164e63;        /* cyan-900 */
  --ok-br: #a5f3fc;        /* cyan-200 */
  --err-bg: #fff1f2;       /* rose-50 */
  --err-fg: #881337;       /* rose-900 */
  --err-br: #fecdd3;       /* rose-200 */
  --nav-bg: #f0f9ff;       /* sky-50 */
  --nav-br: #bae6fd;       /* sky-200 */
  --nav-fg: #0369a1;       /* sky-700 */
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* helpers de layout */
  --container-max: 980px;
  --narrow-max: 720px;

  /* formularios */
  --input-fs: 16px;        /* >=16px evita zoom iOS */
  --radius: 12px;

  /* ====== TOKENS REQUERIDOS POR LA GUÍA ====== */
  --color-primario: var(--brand);
  --ok: #16a34a;
  --warn: #f59e0b;
  --error: #ef4444;
  --shadow: 0 10px 30px rgba(0,0,0,.15);

  /* Orden de capas coherente */
  --z-map: 0;
  --z-controls: 10;
  --z-sheet: 20;
  --z-toast: 30;
}

/* ---------- Reset básico y box-sizing ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; color-scheme: light dark; }
html, body { height: 100%; margin: 0; padding: 0; }

body {
  font-family: system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",Ubuntu,Cantarell,"Fira Sans","Droid Sans",sans-serif;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ⚠️ Sin max-width global para NO deformar íconos */
img, svg, canvas, video { display: inline-block; height: auto; }

/* Opt-in para contenidos responsivos */
.media-responsiva img { max-width: 100%; height: auto; display: block; }

a { color: var(--color-primario); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: 2px; }

[hidden] { display: none !important; }
.hint { font-size: .875rem; color: var(--fg-weak); }

/* Accesibilidad helpers */
.sr-only,
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- Contenedores y estructura (centrados) ---------- */
.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding: 1rem;
}
.container--narrow { max-width: var(--narrow-max); margin-inline: auto; }
.text-center { text-align: center; }

/* Respiración vertical suave en la portada (sin crear app.css) */
main#contenido .container--narrow { padding-block: 18px 28px; }

header { border-bottom: 1px solid var(--border); }
footer { border-top: 1px solid var(--border); padding: 1rem 0 calc(1rem + var(--safe-bottom)); color: var(--fg-weak); }

/* Cabecera centrada */
header .container { text-align: center; }
.app-title { margin: .25rem 0 0; font-size: 1.6rem; font-weight: 700; color: var(--fg); }
.app-tagline { margin: .25rem 0 1rem; font-size: 1rem; color: var(--fg-weak); }

/* ---------- FIX pseudo-decorativos (punto blanco) ---------- */
/* Algunos temas añaden ::before debajo de títulos. Lo neutralizamos. */
h1::before, h2::before, h3::before,
#titulo-ingreso::before,
main::before {
  content: none !important;
  display: none !important;
}
/* Evita markers fantasma si hay listas sin estilo intencional */
main ul:not(.has-markers),
main ol:not(.has-markers) {
  list-style: none;
  padding-left: 0;
}

/* ---------- Botón instalar PWA ---------- */
.pwa-actions { margin: .5rem 0 1rem; }
#btnInstalarApp {
  appearance: none;
  border: none;
  border-radius: .75rem;
  padding: .7rem 1.1rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--color-primario);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(14,165,233,.25);
  min-height: 44px;
}
#btnInstalarApp:hover { filter: brightness(.96); }
#btnInstalarApp:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: 2px; }

/* ---------- Tarjetas (centradas y legibles) ---------- */
.card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: .75rem;
  padding: 1rem;
  margin: 1rem auto;          /* centradas */
  max-width: var(--narrow-max);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.card h3 { margin-top: 0; }

/* ---------- Navegación principal (centrada) ---------- */
.nav-principal { text-align: center; }
.nav-principal ul {
  display: inline-flex;
  justify-content: center;
  gap: .75rem;
  padding: 0;
  margin: .75rem 0 0;
  list-style: none;
}
.nav-principal a {
  display: inline-block;
  padding: .5rem .75rem;
  border-radius: .5rem;
  border: 1px solid var(--nav-br);
  background: var(--nav-bg);
  color: var(--nav-fg);
}
.nav-principal a:hover { background: #e0f2fe; } /* sky-100 */

/* ---------- Formularios (claros y accesibles) ---------- */
form { display: grid; gap: .75rem; justify-items: center; }  /* centra controles dentro */
.campo { display: grid; gap: .25rem; width: 100%; max-width: 440px; }
.campo-inline { display: flex; align-items: center; gap: .5rem; justify-content: center; }

label { font-weight: 600; color: var(--fg); }
input, select, button, textarea { font: inherit; }

/* Inputs base */
input[type="text"],
input[type="tel"],
input[type="number"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: .7rem .9rem;        /* alto táctil */
  border-radius: var(--radius);
  border: 1px solid var(--muted);
  background: #ffffff;
  color: var(--fg);
  font-size: var(--input-fs);  /* >=16px evita zoom iOS */
  line-height: 1.35;
  min-height: 44px;            /* área táctil */
  transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder { color: var(--hint); }
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primario);
  box-shadow: 0 0 0 3px rgba(14,165,233,.20);
}

/* Código OTP monoespaciado */
.input-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* ---------- Grupo de acciones (botones) centrado ---------- */
.acciones { display: flex; gap: .75rem; flex-wrap: wrap; justify-content: center; }
.acciones button {
  appearance: none; border: none; border-radius: .75rem;
  padding: .7rem 1.1rem; font-weight: 700; cursor: pointer;
  background: var(--color-primario); color: #ffffff;
  box-shadow: 0 2px 8px rgba(14,165,233,.25);
  transition: transform .05s ease, filter .15s ease;
  min-height: 44px;
}
.acciones button:hover { filter: brightness(.96); }
.acciones button:active { transform: translateY(1px); }
.acciones button.secondary { background: #334155; } /* slate-700 */
.acciones button:disabled { opacity: .6; cursor: not-allowed; box-shadow: none; }

/* ---------- Estados accesibles (auth) ---------- */
#estadoAuth {
  padding: .6rem .8rem;
  border-radius: .75rem;
  min-height: 1.5rem;
  background: #f8fafc;           /* slate-50 */
  border: 1px solid var(--border);
  color: #334155;                /* slate-700 */
  text-align: center;            /* centrado */
}
#estadoAuth[data-variant="ok"] {
  background: var(--ok-bg);
  color: var(--ok-fg);
  border-color: var(--ok-br);
}
#estadoAuth[data-variant="error"] {
  background: var(--err-bg);
  color: var(--err-fg);
  border-color: var(--err-br);
}

/* ---------- Badges de estado (viajes) ---------- */
.badge {
  display:inline-block; padding:.15rem .5rem; border-radius:.5rem;
  font-size:.75rem; font-weight:700; line-height:1;
  border:1px solid var(--border); background:#f8fafc; color:#334155;
}
.badge.ok { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-br); }
.badge.err { background: var(--err-bg); color: var(--err-fg); border-color: var(--err-br); }

/* ---------- Grids responsivos ---------- */
@media (min-width: 720px) {
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
}

/* ---------- Modo oscuro ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e2e8f0;
    --fg-weak: #94a3b8;
    --bg: #0b1220;
    --border: #1e293b;
    --muted: #334155;
    --nav-bg: #07263b;
    --nav-br: #0b4d74;
    --nav-fg: #0ea5e9;
  }

  body { background: var(--bg); color: var(--fg); }
  header, footer { border-color: var(--border); }
  .app-title { color: var(--fg); }
  .app-tagline { color: var(--fg-weak); }

  .card {
    background: #0f172a;
    border-color: var(--border);
    box-shadow: none;
  }
  input, select, textarea {
    background: #0b1220;
    color: var(--fg);
    border-color: var(--muted);
  }
  input::placeholder { color: #64748b; }

  .nav-principal a {
    color: var(--nav-fg);
    background: var(--nav-bg);
    border-color: var(--nav-br);
  }

  .acciones button,
  #btnInstalarApp { background: #22d3ee; color: #062a33; } /* contraste OK */
}

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Z helpers coherentes ---------- */
.z-map { z-index: var(--z-map); position: relative; }
.z-controls { z-index: var(--z-controls); position: relative; }
.z-sheet { z-index: var(--z-sheet); position: relative; }
.z-toast { z-index: var(--z-toast); position: relative; }

/* ---------- Print-friendly ---------- */
@media print {
  .pwa-actions, .acciones { display:none !important; }
}
