/* ─────────────────────────────────────────────────────────────────────────
   public/assets/css/main.css
   Sistema de diseño de HelpGo. Variables (tokens) + componentes reutilizables.
   Dark mode se activa con la clase .dark en <html>.
   ───────────────────────────────────────────────────────────────────────── */

:root {
  /* Marca */
  --primario: #1D4ED8;
  --primario-hover: #1E40AF;
  --acento: #DC2626;
  --acento-hover: #B91C1C;

  /* Superficies y texto */
  --fondo: #F1F5F9;
  --superficie: #FFFFFF;
  --superficie-2: #F8FAFC;
  --texto: #0F172A;
  --texto-sec: #64748B;
  --borde: #E2E8F0;

  /* Estados */
  --exito: #059669;
  --error: #DC2626;
  --aviso: #D97706;
  --exito-bg: #ECFDF5;
  --error-bg: #FEF2F2;
  --aviso-bg: #FFFBEB;

  /* Forma */
  --radio: 12px;
  --radio-sm: 8px;
  --sombra: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
  --sombra-lg: 0 10px 30px rgba(15, 23, 42, .12);
}

html.dark {
  --primario: #3B82F6;
  --primario-hover: #60A5FA;
  --acento: #F87171;
  --acento-hover: #FCA5A5;

  --fondo: #0B1220;
  --superficie: #111A2E;
  --superficie-2: #1E293B;
  --texto: #F1F5F9;
  --texto-sec: #94A3B8;
  --borde: #283449;

  --exito: #34D399;
  --error: #F87171;
  --aviso: #FBBF24;
  --exito-bg: #052e2b;
  --error-bg: #2a1212;
  --aviso-bg: #2a200a;

  --sombra: 0 1px 3px rgba(0, 0, 0, .4);
  --sombra-lg: 0 12px 40px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--fondo);
  color: var(--texto);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--primario); }

/* ── Header ─────────────────────────────────────────────────────────────── */
.hg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem 1.25rem;
  background: var(--superficie);
  border-bottom: 1px solid var(--borde);
}
.hg-logo { font-weight: 800; font-size: 1.3rem; color: var(--texto); text-decoration: none; letter-spacing: -.02em; }
.hg-logo span { color: var(--primario); }
.hg-header-actions { display: flex; align-items: center; gap: .5rem; }

.hg-tema {
  background: var(--superficie-2);
  border: 1px solid var(--borde);
  border-radius: var(--radio-sm);
  width: 38px; height: 38px;
  cursor: pointer;
  font-size: 1rem;
  color: var(--texto);
  transition: background .15s ease;
}
.hg-tema:hover { background: var(--borde); }

/* ── Layout principal ───────────────────────────────────────────────────── */
.hg-main { flex: 1; }
.hg-footer { padding: 1.25rem; text-align: center; color: var(--texto-sec); border-top: 1px solid var(--borde); background: var(--superficie); }
.hg-container { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.25rem; }

/* ── Hero (landing) ─────────────────────────────────────────────────────── */
.hg-hero {
  max-width: 720px; margin: 0 auto; text-align: center;
  padding: clamp(2.5rem, 8vw, 6rem) 1.25rem;
}
.hg-hero h1 { font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1.1; margin: 0 0 1rem; letter-spacing: -.03em; }
.hg-hero h1 span { color: var(--primario); }
.hg-hero p { color: var(--texto-sec); font-size: clamp(1rem, 2.5vw, 1.25rem); margin: 0 auto 2rem; max-width: 520px; }
.hg-cta { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }
.hg-pasos {
  list-style: none; padding: 0; margin: 2.5rem 0 0;
  display: flex; gap: 1.25rem; justify-content: center; flex-wrap: wrap; color: var(--texto-sec);
}
.hg-pasos strong { color: var(--primario); }

/* ── Botones ────────────────────────────────────────────────────────────── */
.hg-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.5rem;
  border-radius: var(--radio);
  border: 1px solid transparent;
  font-weight: 600; font-size: 1rem;
  text-decoration: none; cursor: pointer;
  transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
}
.hg-btn:active { transform: scale(.98); }
.hg-btn--primary { background: var(--primario); color: #fff; }
.hg-btn--primary:hover { background: var(--primario-hover); }
.hg-btn--acento { background: var(--acento); color: #fff; }
.hg-btn--acento:hover { background: var(--acento-hover); }
.hg-btn--ghost { background: var(--superficie-2); color: var(--texto); border-color: var(--borde); }
.hg-btn--ghost:hover { background: var(--borde); }
.hg-btn--block { width: 100%; }

/* ── Auth (login/registro/reset) ────────────────────────────────────────── */
.hg-auth-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.hg-card {
  width: 100%; max-width: 420px;
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: 18px;
  box-shadow: var(--sombra-lg);
  padding: 2rem;
}
.hg-auth-head { text-align: center; margin-bottom: 1.5rem; }
.hg-auth-head .hg-logo { font-size: 1.6rem; }
.hg-auth-head h1 { font-size: 1.25rem; margin: .75rem 0 .25rem; }
.hg-auth-head p { color: var(--texto-sec); font-size: .9rem; margin: 0; }

/* ── Formularios ────────────────────────────────────────────────────────── */
.hg-field { margin-bottom: 1rem; }
.hg-label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .4rem; color: var(--texto); }
.hg-input {
  width: 100%; padding: .7rem .85rem;
  background: var(--superficie-2);
  border: 1px solid var(--borde);
  border-radius: var(--radio-sm);
  color: var(--texto); font-size: 1rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.hg-input:focus { outline: none; border-color: var(--primario); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primario) 22%, transparent); }
.hg-input::placeholder { color: var(--texto-sec); }

/* Campo de contraseña con ojo */
.hg-pass { position: relative; }
.hg-pass .hg-input { padding-right: 2.75rem; }
.hg-ojo {
  position: absolute; right: .25rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 1.1rem;
  width: 2.25rem; height: 2.25rem; color: var(--texto-sec);
}
.hg-ojo:hover { color: var(--texto); }

.hg-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; font-size: .85rem; }
.hg-check { display: flex; align-items: center; gap: .4rem; color: var(--texto-sec); }

.hg-hint { font-size: .8rem; color: var(--texto-sec); margin-top: .35rem; }

/* Medidor de fuerza de contraseña */
.hg-strength { height: 6px; border-radius: 3px; background: var(--borde); margin-top: .5rem; overflow: hidden; }
.hg-strength span { display: block; height: 100%; width: 0; transition: width .2s ease, background .2s ease; }

/* Tabs login/registro */
.hg-tabs { display: flex; background: var(--superficie-2); border: 1px solid var(--borde); border-radius: var(--radio); padding: .25rem; margin-bottom: 1.5rem; }
.hg-tab { flex: 1; text-align: center; padding: .5rem; border-radius: var(--radio-sm); text-decoration: none; color: var(--texto-sec); font-weight: 600; font-size: .9rem; }
.hg-tab--active { background: var(--superficie); color: var(--texto); box-shadow: var(--sombra); }

/* Honeypot (invisible para humanos) */
.hp { position: absolute !important; left: -9999px !important; opacity: 0 !important; height: 0; width: 0; }

/* ── Alerts ─────────────────────────────────────────────────────────────── */
.hg-alert { padding: .8rem 1rem; border-radius: var(--radio-sm); font-size: .9rem; margin-bottom: 1.25rem; border: 1px solid transparent; }
.hg-alert--error { background: var(--error-bg); color: var(--error); border-color: color-mix(in srgb, var(--error) 30%, transparent); }
.hg-alert--exito { background: var(--exito-bg); color: var(--exito); border-color: color-mix(in srgb, var(--exito) 30%, transparent); }
.hg-alert--aviso { background: var(--aviso-bg); color: var(--aviso); border-color: color-mix(in srgb, var(--aviso) 30%, transparent); }

.hg-auth-foot { text-align: center; margin-top: 1.25rem; font-size: .88rem; color: var(--texto-sec); }
.hg-auth-foot a { font-weight: 600; }

/* ── Dashboards ─────────────────────────────────────────────────────────── */
.hg-topbar { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1.25rem; background: var(--superficie); border-bottom: 1px solid var(--borde); }
.hg-topbar .hg-user { font-size: .9rem; color: var(--texto-sec); }
.hg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.hg-tile { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1.25rem; box-shadow: var(--sombra); }
.hg-tile h3 { margin: 0 0 .5rem; font-size: .85rem; color: var(--texto-sec); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.hg-tile .hg-metric { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; }
.hg-badge { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 700; background: color-mix(in srgb, var(--primario) 15%, transparent); color: var(--primario); }

/* ── Mapa ───────────────────────────────────────────────────────────────── */
.hg-mapa {
  width: 100%; height: 320px;
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  margin-top: .5rem;
  z-index: 0;
}
/* El control de Leaflet no debe taparse con el tema oscuro */
.leaflet-container { background: var(--superficie-2); }

/* ── Selector de servicio (grúa / ambulancia) ───────────────────────────── */
.hg-choice { display: flex; gap: .75rem; }
.hg-choice-item {
  flex: 1; cursor: pointer;
  border: 2px solid var(--borde);
  border-radius: var(--radio);
  padding: 1rem; text-align: center; font-weight: 600;
  background: var(--superficie-2);
  transition: border-color .15s ease, background .15s ease;
}
.hg-choice-item input { position: absolute; opacity: 0; }
.hg-choice-item:has(input:checked) { border-color: var(--primario); background: color-mix(in srgb, var(--primario) 10%, transparent); }

/* ── Stepper de estados ─────────────────────────────────────────────────── */
.hg-stepper { display: flex; flex-direction: column; gap: 0; margin: 1rem 0; }
.hg-step { display: flex; align-items: center; gap: .75rem; position: relative; padding: .35rem 0; }
.hg-step-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--borde); border: 2px solid var(--borde);
  flex-shrink: 0; z-index: 1; transition: background .2s ease, border-color .2s ease;
}
/* Línea vertical que conecta los pasos */
.hg-step:not(:last-child)::after {
  content: ''; position: absolute; left: 7px; top: 1.4rem; bottom: -0.35rem;
  width: 2px; background: var(--borde);
}
.hg-step--done .hg-step-dot { background: var(--exito); border-color: var(--exito); }
.hg-step--done:not(:last-child)::after { background: var(--exito); }
.hg-step-label { font-size: .95rem; color: var(--texto-sec); }
.hg-step--current .hg-step-label { color: var(--texto); font-weight: 700; }
.hg-step--current .hg-step-dot { box-shadow: 0 0 0 4px color-mix(in srgb, var(--exito) 25%, transparent); }

/* ── Sub-navegación (admin) ─────────────────────────────────────────────── */
.hg-subnav {
  display: flex; flex-wrap: wrap; gap: .25rem;
  background: var(--superficie-2);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: .3rem;
  margin: 1rem 0;
}
.hg-subnav-item {
  padding: .45rem .85rem; border-radius: var(--radio-sm);
  text-decoration: none; color: var(--texto-sec); font-weight: 600; font-size: .88rem;
  white-space: nowrap;
}
.hg-subnav-item:hover { color: var(--texto); }
.hg-subnav-item--active { background: var(--superficie); color: var(--primario); box-shadow: var(--sombra); }

/* ── Tabla (operador) ───────────────────────────────────────────────────── */
.hg-table-wrap { overflow-x: auto; border: 1px solid var(--borde); border-radius: var(--radio); }
.hg-table { width: 100%; border-collapse: collapse; background: var(--superficie); }
.hg-table th, .hg-table td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--borde); font-size: .9rem; }
.hg-table th { color: var(--texto-sec); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.hg-table tbody tr:last-child td { border-bottom: none; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .hg-card { padding: 1.5rem; }
  .hg-cta { flex-direction: column; }
  .hg-btn { width: 100%; }
}
