/* === Variables de tema === */
:root {
  --bg: #eeeeee;
  --surface: #f9f9f9;
  --surface-2: #f1f1f1;
  --text: #333333;
  --head: #222222;
  --primary: #cc0000;
  --primary-hover: #a30000;
  --shadow-dark: #bcbcbc;
  --shadow-light: #ffffff;
}

[data-theme="dark"] {
  --bg: #0f0f10;
  --surface: #151517;
  --surface-2: #1a1b1e;
  --text: #e6e6e6;
  --head: #ffffff;
  --primary: #ff4d4d;
  --primary-hover: #ff1f1f;
  --shadow-dark: rgba(0, 0, 0, 0.7);
  --shadow-light: rgba(255, 255, 255, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f10;
    --surface: #151517;
    --surface-2: #1a1b1e;
    --text: #e6e6e6;
    --head: #ffffff;
    --primary: #ff4d4d;
    --primary-hover: #ff1f1f;
    --shadow-dark: rgba(0, 0, 0, 0.7);
    --shadow-light: rgba(255, 255, 255, 0.06);
  }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
}

.container {
  max-width: 700px;
  margin: 40px auto;
  padding: 30px;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: 8px 8px 20px var(--shadow-dark), -8px -8px 20px var(--shadow-light);
}

h1 {
  text-align: center;
  color: var(--primary);
  margin-bottom: 25px;
}

form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

label {
  font-weight: bold;
  margin-bottom: 5px;
  color: var(--text);
}

input, select {
  padding: 14px;
  font-size: 16px;
  border-radius: 12px;
  border: none;
  color: var(--text);
  background: var(--surface);
  box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
  transition: all 0.3s ease;
}

input::placeholder, select::placeholder {
  color: rgba(127,127,127,0.9);
}

input:focus, select:focus {
  box-shadow:
    inset 1px 1px 2px var(--shadow-dark),
    inset -1px -1px 2px var(--shadow-light),
    0 0 6px color-mix(in oklab, var(--primary) 40%, transparent);
  outline: none;
}

button {
  padding: 14px;
  font-size: 18px;
  font-weight: bold;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 3px 3px 8px color-mix(in oklab, var(--shadow-dark) 70%, #0000),
              -3px -3px 8px var(--shadow-light);
  transition: all 0.3s ease;
}

button:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 5px 5px 10px color-mix(in oklab, var(--shadow-dark) 70%, #0000),
              -5px -5px 10px var(--shadow-light);
}

#resultados {
  margin-top: 25px;
  padding: 20px;
  background: var(--surface-2);
  border-radius: 15px;
  box-shadow: inset 3px 3px 6px var(--shadow-dark);
}

/* --- Estados y gráficos --- */
#resultadosContainer {
  display: none;
  margin-top: 25px;
}

#graficoMacros {
  max-width: 300px;
  max-height: 300px;
  margin: 20px auto;
}

/* --- Sección de artículos explicativos --- */
#articulos .articles {
  margin-top: 20px;
}

#articulos h2 {
  text-align: center;
  margin-bottom: 12px;
  color: var(--head);
}

#articulos .toc {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 10px 0 20px;
}

#articulos .toc a {
  text-decoration: none;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: 2px 2px 6px color-mix(in oklab, var(--shadow-dark) 70%, #0000), -2px -2px 6px var(--shadow-light);
  color: var(--text);
}

#articulos article {
  background: var(--surface);
  border-radius: 16px;
  padding: 18px;
  margin: 14px 0;
  box-shadow: 4px 4px 14px color-mix(in oklab, var(--shadow-dark) 70%, #0000),
              -4px -4px 14px var(--shadow-light);
}

#articulos h3 {
  margin-top: 0;
  color: var(--primary);
}

#articulos code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  padding: 2px 6px;
  border-radius: 8px;
  background: var(--surface-2);
  box-shadow: inset 1px 1px 3px var(--shadow-dark);
}

/* === Bloque de controles de tema (interruptor + icono) === */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 10px;
  user-select: none;
}

/* Interruptor clásico */
.switch {
  position: relative;
  display: inline-block;
  width: 56px;
  height: 32px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--surface-2);
  box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
  transition: 0.2s;
  border-radius: 999px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 24px;
  width: 24px;
  left: 4px;
  bottom: 4px;
  background: var(--surface);
  box-shadow: 2px 2px 5px color-mix(in oklab, var(--shadow-dark) 70%, #0000),
              -2px -2px 5px var(--shadow-light);
  transition: 0.2s;
  border-radius: 50%;
}

.switch input:checked + .slider {
  background: var(--primary);
}

.switch input:checked + .slider:before {
  transform: translateX(24px);
}

/* Botón de icono 🌙/☀️ */
.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: 2px 2px 6px color-mix(in oklab, var(--shadow-dark) 70%, #0000),
              -2px -2px 6px var(--shadow-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.icon-btn:hover {
  transform: translateY(-1px);
  box-shadow: 3px 3px 8px color-mix(in oklab, var(--shadow-dark) 70%, #0000),
              -3px -3px 8px var(--shadow-light);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

/* === FIX: Theme toggle alignment === */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
}

.theme-toggle #themeIconBtn,
.theme-toggle #themeLabel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  text-align: center;
}

.theme-toggle #themeIcon {
  font-size: 1.5rem;
  line-height: 1;
  width: 24px;
  height: 24px;
  display: inline-block;
  text-align: center;
}

.theme-toggle #themeLabel {
  font-size: 14px;
  min-width: 140px;
  white-space: nowrap;
}

.main-nav {
  background: var(--surface);
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  padding: 12px 0;
  margin-bottom: 20px;
  border-radius: 0 0 12px 12px;
  text-align: center;
}
.main-nav ul, .main-nav ul.menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  gap: 25px;
}

.main-nav li { position: relative; }

.main-nav .submenu {
  position: absolute;
  left: 0;
  top: 100%;               /* aparece DEBAJO del padre */
  display: none;           /* oculto por defecto */
  flex-direction: column;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 2px 0;
  min-width: 170px;
  background: var(--surface);
  border-radius: 25px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  z-index: 1000;
}

/* (C) Mostrar en hover o con teclado (accesible) */
.main-nav li.has-submenu:hover > .submenu,
.main-nav li.has-submenu:focus-within > .submenu {
  display: flex;
}

/* (D) Estilo de elementos del submenú */
.main-nav .submenu li a {
  display: block;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
}



.main-nav a {
  text-decoration: none;
  color: var(--primary);
  font-weight: bold;
  font-size: 16px;
  transition: color 0.3s;
}

.main-nav .submenu li a:hover {
  background: var(--surface-2);
  color: var(--primary);
}
.main-nav a:hover {
  color: var(--primary-hover);
}

.p{
  text-align: center;
}

.email{
    text-align: center;
  font-size: 18px;
  font-weight: bold;

}

.email > a{
  text-decoration: none;
  color:#cc0000;

}