/*! CINTIA Parral — base.css
   - Tema claro/oscuro con CSS variables
   - Estilos base, tipografía, botones, tarjetas, utilidades
   - El atributo data-theme en <html> SIEMPRE tiene prioridad
*/

/* =========================
   1) Tema LIGHT por defecto
   ========================= */
:root {
  /* Superficies */
  --bg: #f5f5f5;
  --card: #ffffff;
  --surface-variant: #e0e0e0;

  /* Texto */
  --text: #222222;
  --muted: #555555;

  /* Marca y acentos (Flutter → Web) */
  --brand: #00b8d9; /* secondary */
  --brand-2: #1b2a4e; /* primary */
  --accent: #e63946; /* tertiary */

  /* color del texto del boton */
  --btn-on-filled: #ffffff;

  /* Bordes / foco */
  --border: #cccccc;
  --focus: #00b8d9;

  /* Estados */
  --success: #2ecc71;
  --warning: #f39c12;
  --error: #b00020;

  /* Sombras */
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.07);

  /* Tipografía y layout */
  --radius-outer: 16px;
  --radius-inner: 12px;
  --radius-pill: 999px;
  --container-max: 1200px;

  /* Hero pills (claro) */
  --hero-pill-bg: #f3f6fb;
  --hero-pill-bd: #d6dee8;
  --hero-pill-label: #405070;
  --hero-pill-value: #1b2a4e;

  --menu-hover-bg: color-mix(in oklab, var(--brand-2) 12%, #fff);
  --menu-hover-text: var(--brand-2);

  /* CONTRASTE del título del hero */
  --h1-hero: #ffffff; /* blanco para que se lea sobre el hero oscuro */
}

/* ==========================================
   2) Tema DARK cuando lo pida el atributo
   ========================================== */
html[data-theme="dark"] {
  --bg: #121212;
  --card: #1e1e1e;
  --surface-variant: #2c2c2c;

  --text: #eaf1ff;
  --muted: #a5b2c7;

  --brand: #4dd9f7; /* secondaryDark */
  --brand-2: #9ab3ff; /* primaryDark   */
  --accent: #ff8c99; /* tertiaryDark  */

  --btn-on-filled: #001219;

  --border: #2c3550;
  --focus: #ff8c99;

  --success: #2ecc71;
  --warning: #f39c12;
  --error: #b00020;

  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);

  /* Hero pills (dark) */
  --hero-pill-bg: #0f1a28;
  --hero-pill-bd: #2b3a52;
  --hero-pill-label: #c3d2e7;
  --hero-pill-value: #f4f8ff;

  --menu-hover-bg: color-mix(in oklab, var(--brand-2) 16%, var(--card));
  --menu-hover-text: #f4f8ff;

  /* Título del hero también blanco en dark */
  --h1-hero: #ffffff;
}

/* ==========================================================
   3) Fallback: si NO hay data-theme, usa el tema del sistema
   ========================================================== */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #121212;
    --card: #1e1e1e;
    --surface-variant: #2c2c2c;

    --text: #eaf1ff;
    --muted: #a5b2c7;

    --brand: #4dd9f7;
    --brand-2: #9ab3ff;
    --accent: #ff8c99;

    --border: #2c3550;
    --focus: #ff8c99;

    --success: #2ecc71;
    --warning: #f39c12;
    --error: #b00020;

    --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);

    --hero-pill-bg: #0f1a28;
    --hero-pill-bd: #2b3a52;
    --hero-pill-label: #c3d2e7;
    --hero-pill-value: #f4f8ff;

    --h1-hero: #ffffff;
  }
}

/* =========================
   Reset / Base tipográfica
   ========================= */
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    "Apple Color Emoji", "Segoe UI Emoji";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img {
  max-width: 100%;
  display: block;
}
a {
  color: var(--brand-2);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
a:focus {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}
p {
  line-height: 1.6;
  margin: 0 0 10px;
}
ul,
ol {
  margin: 0 0 10px 20px;
}
small {
  font-size: 12px;
  color: var(--muted);
}
code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono",
    monospace;
}
pre {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-inner);
  padding: 12px;
  overflow: auto;
}

/* Encabezados (márgenes coherentes) */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 8px;
  line-height: 1.2;
}
h1 {
  font-size: clamp(26px, 5vw, 36px);
}
h2 {
  font-size: clamp(20px, 3.5vw, 28px);
}
h3 {
  font-size: clamp(16px, 2.6vw, 20px);
}

/* =========================
   Contenedores y secciones
   ========================= */
.container {
  width: min(var(--container-max), 92vw);
  margin-inline: auto;
}
.section {
  padding: 28px 0 48px;
}
.section-title {
  font-size: clamp(20px, 3vw, 28px);
  margin: 0 0 12px;
}

/* Tarjetas y elementos genéricos */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-outer);
  padding: 16px;
  box-shadow: var(--shadow);
}

/* Botones */
.btn {
  display: inline-block;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: var(--btn-on-filled);
  font-weight: 700;
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  border: 0;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.12s ease;
}
.btn:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}
.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

/* Chips / Badges / Tags */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
}
.chip[aria-current="true"] {
  background: color-mix(in oklab, var(--brand-2) 14%, var(--card));
}

.badge {
  background: color-mix(in oklab, var(--brand-2) 12%, var(--card));
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 12px;
  padding: 3px 8px;
  display: inline-block;
}
.badge.green {
  background: color-mix(in oklab, var(--success) 18%, var(--card));
  color: #dfffe8;
  border-color: color-mix(in oklab, var(--success) 25%, var(--border));
}
.tag {
  font-size: 12px;
  color: var(--muted);
}

/* Utilidades */
.muted {
  color: var(--muted);
}
.gradient {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* --------- HERO: contraste del título --------- */
.hero-text h1 {
  color: var(--h1-hero);
  opacity: 1;
  text-shadow: none;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  padding: 24px 0 60px;
  font-size: 14px;
}
.footer-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.footer-links {
  display: flex;
  gap: 16px;
}

/* Formularios base */
input,
select,
textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
}
textarea {
  resize: vertical;
}
input::placeholder,
textarea::placeholder {
  color: color-mix(in oklab, var(--muted) 80%, transparent);
}

/* Tablas básicas */
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
}
thead th {
  text-align: left;
  color: var(--muted);
}

/* Focus visible para accesibilidad */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Transición suave entre temas */
@media (prefers-reduced-motion: no-preference) {
  html,
  body,
  .card,
  .btn,
  .chip,
  .badge,
  .tag,
  input,
  select,
  textarea {
    transition: background-color 0.2s ease, color 0.2s ease,
      border-color 0.2s ease;
  }
}

/* Scrollbar (opcional) */
* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in oklab, var(--brand-2) 35%, var(--border))
    transparent;
}
*::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}
*::-webkit-scrollbar-thumb {
  background: color-mix(in oklab, var(--brand-2) 35%, var(--border));
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
