/* Estilos compartidos por todas las herramientas de la Calculadora financiera */

:root {
  --fondo: #0a0a0a;
  --tarjeta: #121212;
  --tarjeta-2: #171717;
  --campo: #1e1e1e;
  --campo-hover: #242424;
  --borde: rgba(255, 255, 255, 0.08);
  --borde-fuerte: rgba(255, 255, 255, 0.16);

  --texto: #f4f4f4;
  --texto-2: #a3a3a3;
  --texto-3: #6e6e6e;

  --oro: #d6b46a;
  --oro-claro: #f0d48f;
  --oro-fondo: rgba(214, 180, 106, 0.14);
  --verde: #3ccf76;
  --rojo: #f05252;
  --ambar: #f2a93b;

  --radio: 22px;
  --radio-sm: 12px;
  --sombra: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 24px 48px -24px rgba(0, 0, 0, 0.9);

  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--fondo);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 120px 120px;
  color: var(--texto);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, p {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
}

svg.icono {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:focus-visible {
  outline: 2px solid var(--oro);
  outline-offset: 2px;
}

/* ---------- Página ---------- */

.pagina {
  max-width: 1400px;
  margin: 0 auto;
  padding:
    calc(20px + env(safe-area-inset-top))
    calc(16px + env(safe-area-inset-right))
    calc(48px + env(safe-area-inset-bottom))
    calc(16px + env(safe-area-inset-left));
}

@media (min-width: 768px) {
  .pagina {
    padding-top: calc(40px + env(safe-area-inset-top));
    padding-left: calc(32px + env(safe-area-inset-left));
    padding-right: calc(32px + env(safe-area-inset-right));
  }
}

.volver {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 8px 0;
  color: var(--texto-2);
  font-size: 15px;
  text-decoration: none;
  transition: color 0.15s;
}

.volver:hover {
  color: var(--texto);
}

.volver svg.icono {
  width: 18px;
  height: 18px;
}

/* ---------- Tarjetas y secciones ---------- */

.tarjeta {
  background: linear-gradient(180deg, var(--tarjeta-2), var(--tarjeta));
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 20px;
}

@media (min-width: 768px) {
  .tarjeta {
    padding: 24px;
  }
}

.seccion {
  margin-top: 40px;
  scroll-margin-top: calc(16px + env(safe-area-inset-top));
}

.seccion-titulo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  font-size: 20px;
  font-weight: 650;
}

.num {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--oro-claro), var(--oro));
  color: #1a1408;
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--texto-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-oro {
  background: var(--oro-fondo);
  color: var(--oro-claro);
}

.badge-oro::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ---------- Campos ---------- */

.campos {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px 20px;
}

@media (min-width: 360px) {
  .campos {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 600px) {
  .campos {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.campo-cab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 26px;
  margin-bottom: 8px;
}

.campo-cab label,
.etiqueta {
  overflow: hidden;
  color: var(--texto-2);
  font-size: 15px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.etiqueta-mayus {
  display: block;
  margin-bottom: 8px;
  color: var(--texto-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.quitar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--texto-3);
  cursor: pointer;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}

.quitar:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--texto);
}

.quitar svg.icono {
  width: 16px;
  height: 16px;
}

@media (hover: hover) {
  .campo .quitar {
    opacity: 0;
  }

  .campo:hover .quitar,
  .campo:focus-within .quitar {
    opacity: 1;
  }
}

.entrada {
  position: relative;
}

.entrada input {
  width: 100%;
  height: 50px;
  padding: 0 40px 0 14px;
  border: 1.5px solid transparent;
  border-radius: var(--radio-sm);
  background: var(--campo);
  color: var(--texto);
  font: inherit;
  font-size: 17px; /* ≥ 16px evita el zoom automático de iOS */
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.entrada input:hover {
  background: var(--campo-hover);
}

.entrada input:focus {
  border-color: var(--oro);
  background: var(--campo-hover);
  box-shadow: 0 0 0 4px var(--oro-fondo);
}

.sufijo {
  position: absolute;
  top: 50%;
  right: 14px;
  color: var(--texto-3);
  font-size: 15px;
  pointer-events: none;
  transform: translateY(-50%);
}

/* ---------- Botones ---------- */

.anadir {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px dashed var(--borde-fuerte);
  border-radius: var(--radio-sm);
  background: transparent;
  color: var(--texto-2);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.anadir:hover {
  border-color: var(--oro);
  background: var(--oro-fondo);
  color: var(--texto);
}

.anadir-input {
  width: min(100%, 320px);
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--oro);
  border-radius: var(--radio-sm);
  background: var(--campo-hover);
  color: var(--texto);
  font: inherit;
  font-size: 16px;
  outline: none;
  box-shadow: 0 0 0 4px var(--oro-fondo);
}

.boton-sec {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--borde-fuerte);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.boton-sec:hover:not(:disabled) {
  border-color: var(--oro);
  background: var(--oro-fondo);
}

.boton-sec:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---------- Información (i) ---------- */

.con-info {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.info {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid rgba(214, 180, 106, 0.5);
  border-radius: 50%;
  background: transparent;
  color: var(--oro);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  font-style: italic;
  font-weight: 700;
  cursor: pointer;
}

.info[aria-expanded="true"] {
  background: var(--oro-fondo);
}

.info-pop {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 10;
  width: min(340px, calc(100vw - 48px));
  padding: 14px 16px;
  border: 1px solid var(--borde-fuerte);
  border-radius: var(--radio-sm);
  background: #1c1c1c;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  color: var(--texto-2);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: normal;
  text-transform: none;
}

/* ---------- Estados ---------- */

.positivo {
  color: var(--verde) !important;
}

.negativo {
  color: var(--rojo) !important;
}

.aviso {
  color: var(--ambar) !important;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
