/* ===== Modo oscuro automático para w3.css ===== */

/* Informa al navegador que soportas claro/oscuro */
html { color-scheme: light dark; }

/* Paleta oscura */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0f;
    --text: #e6e6e6;
    --muted: #9aa0a6;
    --card: #12121a;
    --border: #2a2a35;
    --link: #8ab4f8;
    --link-visited: #c58af9;
  }

  /* Fondo y texto general */
  html, body {
    background: var(--bg);
    color: var(--text);
  }

  /* Enlaces */
  a { color: var(--link); }
  a:visited { color: var(--link-visited); }
  small, .muted, .w3-small { color: var(--muted); }

  /* Bordes y tablas */
  hr,
  .w3-border,
  .w3-card,
  .w3-table-all td, .w3-table-all th {
    border-color: var(--border) !important;
  }

  /* Fondos claros que deben oscurecerse */
  .w3-card, .w3-white, .w3-light-grey, .w3-panel, .w3-container {
    background: var(--card) !important;
    color: var(--text) !important;
  }

  /* Tablas: alternancia sutil */
  .w3-table-all tr:nth-child(even) {
    background: #171722;
  }

  /* Formularios */
  input, select, textarea, button {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
  }

  /* Badges y etiquetas */
  .w3-badge, .w3-tag {
    background: var(--border);
    color: var(--text);
  }

  /* Cabecera adaptada */
  .w3-theme, .w3-top, .w3-bar.w3-theme {
    background: #1f2937 !important;
    color: #e6e6e6 !important;
  }
}
