/* =========================================================
   Modo oscuro — Firmas Electrónicas Ecuador
   Se activa con data-theme="dark" en <html> (switch del footer,
   ver assets/js/theme.js). El modo claro es el diseño por defecto.

   Las secciones que ya son oscuras (header, beneficios, pasos,
   cierre, footer) no cambian. Aquí solo se redefinen las
   superficies y textos de las secciones claras.
   ========================================================= */

:root[data-theme="dark"] {
  color-scheme: dark;

  /* Superficies */
  --color-page-bg: #0b0d1f;
  --surface-cool: #0f1229;
  --surface-soft: #121638;
  --surface-card: #171b3d;
  --surface-info: #1e2352;

  /* Textos */
  --color-navy-title: #e7e9ff;
  --color-text-soft: #9ba4c8;
  --color-ink-muted: #b5b9d8;
  --text-strong-dark: #e7e9ff;   /* reemplaza a brand-deep cuando es color de texto */

  /* Bordes */
  --color-border-soft: #2a2f5e;
  --border-subtle: rgba(170, 180, 255, 0.14);
  --border-strong: rgba(170, 180, 255, 0.28);

  /* Sombras: sobre fondo oscuro el tinte violeta no se ve, se usa negro */
  --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.25), 0 12px 28px rgba(0, 0, 0, 0.35);
  --shadow-card-hover: 0 4px 8px rgba(0, 0, 0, 0.3), 0 20px 40px rgba(0, 0, 0, 0.45);
  --shadow-chip: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* Texto general (--color-ink se conserva para los botones amarillos) */
:root[data-theme="dark"] body {
  color: var(--text-strong-dark);
}

/* ---------- Hero: textos que usaban el azul violeta de marca ---------- */
:root[data-theme="dark"] .hero__title,
:root[data-theme="dark"] .price-card__tag,
:root[data-theme="dark"] .price-card__validity,
:root[data-theme="dark"] .price-card__amount,
:root[data-theme="dark"] .hero__place-title,
:root[data-theme="dark"] .hero__place-meta,
:root[data-theme="dark"] .rating-block__count strong,
:root[data-theme="dark"] .review__author,
:root[data-theme="dark"] .btn--outline,
:root[data-theme="dark"] .hero__chip-value {
  color: var(--text-strong-dark);
}

:root[data-theme="dark"] .price-card--gold .price-card__tag {
  color: var(--color-ink);
}

:root[data-theme="dark"] .btn--outline:hover {
  border-color: var(--text-strong-dark);
}

:root[data-theme="dark"] .hero__chip,
:root[data-theme="dark"] .hero__nav {
  background-color: rgba(23, 27, 61, 0.92);
}

:root[data-theme="dark"] .hero__nav:hover {
  background-color: var(--surface-info);
}

:root[data-theme="dark"] .hero__nav svg {
  fill: var(--text-strong-dark);
}

/* Textos azul eléctrico sobre fondo oscuro: un tono más claro para que se lean */
:root[data-theme="dark"] .tipos__eyebrow,
:root[data-theme="dark"] .hero__eyebrow {
  color: #8fa8ff;
}

:root[data-theme="dark"] .price-card:not(.price-card--blue):not(.price-card--gold) .price-card__cta {
  background-color: rgba(28, 81, 255, 0.22);
  color: #c9d5ff;
}

/* ---------- Tipos de firma ---------- */
:root[data-theme="dark"] .tipos__title-accent {
  background-image: linear-gradient(
    90deg,
    #aebcff 0%,
    #6f94ff 55%,
    #4aa3ff 100%
  );
}

/* La etiqueta "Urgente" va sobre amarillo: mantiene texto oscuro */
:root[data-theme="dark"] .sig-card__flag {
  color: #171168;
}

:root[data-theme="dark"] .sig-card__icon--blue { background-color: rgba(36, 91, 255, 0.18); }
:root[data-theme="dark"] .sig-card__icon--sky { background-color: rgba(8, 124, 255, 0.18); }
:root[data-theme="dark"] .sig-card__icon--violet { background-color: rgba(110, 86, 248, 0.22); }
:root[data-theme="dark"] .sig-card__icon--gold { background-color: rgba(244, 181, 0, 0.16); }

/* ---------- Modal de feriados (estilos inyectados por modal.js) ---------- */
:root[data-theme="dark"] #modal-feriado .modal-feriado__contenido {
  background: var(--surface-card);
}

:root[data-theme="dark"] #modal-feriado .modal-feriado__texto strong {
  color: var(--text-strong-dark);
}

/* =========================================================
   Switch de tema del footer (#theme-switch)
   Vive al final de la fila de redes sociales (40px de alto): el
   switch mide 24px, así que el footer no gana altura.
   ========================================================= */
.site-footer__theme {
  display: flex;
  align-items: center;
  margin-left: var(--space-xs);
  padding-left: var(--space-md);
  border-left: 1px solid rgba(255, 255, 255, 0.14);
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0;
  border: 0;
  background: none;
  color: rgba(255, 255, 255, 0.78);
  font: inherit;
  font-size: var(--fs-sm);
  white-space: nowrap;
  cursor: pointer;
}

.theme-switch:hover {
  color: var(--color-white);
}

.theme-switch:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
  border-radius: var(--radius-pill);
}

.theme-switch__track {
  position: relative;
  flex: none;
  width: 44px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-pill);
  background-color: rgba(255, 255, 255, 0.12);
  transition: background-color var(--transition-base), border-color var(--transition-base);
}

.theme-switch__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: var(--color-white);
  color: var(--color-brand-deep);
  transition: transform var(--transition-base);
}

.theme-switch__thumb svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.theme-switch__icon--moon { display: none; }

.theme-switch[aria-checked="true"] .theme-switch__track {
  background-color: var(--color-yellow);
  border-color: var(--color-yellow);
}

.theme-switch[aria-checked="true"] .theme-switch__thumb {
  transform: translateX(20px);
  background-color: var(--color-brand-deep);
  color: var(--color-yellow);
}

.theme-switch[aria-checked="true"] .theme-switch__icon--sun { display: none; }
.theme-switch[aria-checked="true"] .theme-switch__icon--moon { display: block; }

/* Pantallas muy estrechas: solo el switch, sin texto, para no partir la fila */
@media (max-width: 399px) {
  .theme-switch__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  .theme-switch__track,
  .theme-switch__thumb {
    transition: none;
  }
}
