/* ============================================================================
   VARIABLES DE DISEÑO Y TIPOGRAFÍA
   ============================================================================ */

:root {
  --bg: #fef5f3;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #666666;
  --accent: #E63946;
  --accent-soft: #ffe5e5;
  --danger: #d62828;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ============================================================================
   RESET Y CONFIGURACIÓN GLOBAL
   ============================================================================ */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  /* background: radial-gradient(circle at top, #ffe0db 0%, var(--bg) 40%); */
  background: var(--bg);
  color: var(--text);
}

/* ============================================================================
   LAYOUT PRINCIPAL
   ============================================================================ */

.page {
  max-width: 2000px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}

header h1 {
  font-size: clamp(2rem, 2.8vw, 3rem);
  margin: 0;
  line-height: 1.05;
}

/* ============================================================================
   COMPONENTES: LOGO
   ============================================================================ */

.logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 250px;
  height: auto;
  object-fit: contain;
}

/* ============================================================================
   COMPONENTES: SECCIONES (INTRO Y CARDS)
   ============================================================================ */

.intro {
  background: var(--card);
  border-radius: 24px;
  padding: 20px 30px;
  box-shadow: 0 24px 60px rgba(230, 57, 70, 0.08);
  border: 1px solid rgba(230, 57, 70, 0.16);
  margin-bottom: 20px;
}

.intro p,
.intro ul,
.intro ol,
.intro li {
  margin: 0;
  line-height: 1.5;
  color: var(--muted);
  font-size: 1rem;
  font-family: inherit;
}

.intro ul,
.intro ol {
  padding-left: 2rem;
  margin: 5px 0 10px;
}

.intro li {
  margin-bottom: 0rem;
}

.intro ol li::marker {
  font-weight: bold;
}

.card {
  background: var(--card);
  border-radius: 28px;
  padding: 20px 30px;
  box-shadow: 0 24px 60px rgba(230, 57, 70, 0.06);
  border: 1px solid rgba(230, 57, 70, 0.16);
  margin-bottom: 20px;
}

.calculator-header {
  margin-bottom: 24px;
}

.calculator-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.mode-button {
  border: 1px solid rgba(230, 57, 70, 0.24);
  border-radius: 999px;
  padding: 12px 20px;
  background: white;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.mode-button.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.calculator-note,
.calculator-instructions {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.95rem;
}

.hidden {
  display: none !important;
}

/* ============================================================================
   FORMULARIOS: CAMPOS Y ETIQUETAS
   ============================================================================ */

.field-group {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

label {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 8px;
  display: inline-block;
}

input[type="date"], input[type="number"], select {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 1rem;
  background: #f8fafc;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="date"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(230, 57, 70, 0.12);
}

/* ============================================================================
   BOTONES Y ACCIONES
   ============================================================================ */

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin-top: 8px;
}

button {
  border: none;
  border-radius: 16px;
  padding: 14px 22px;
  font-size: 1rem;
  font-weight: 700;
  color: white;
  background: var(--accent);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 14px 25px rgba(230, 57, 70, 0.22);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 30px rgba(230, 57, 70, 0.24);
}

/* ============================================================================
   RESULTADOS Y MENSAJES
   ============================================================================ */

.result-box {
  margin-top: 24px;
  padding: 24px;
  border-radius: 22px;
  background: linear-gradient(135deg, #ffe5e5 0%, #ffffff 100%);
  border: 1px solid rgba(230, 57, 70, 0.16);
  min-height: 96px;
  display: grid;
  place-content: center;
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 600;
  text-align: center;
}

.breakdown-details {
  margin-top: 20px;
  border-radius: 20px;
  border: 1px solid rgba(230, 57, 70, 0.16);
  background: #fff5f5;
  padding: 18px;
}

.breakdown-summary {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
}

.breakdown-info {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

.breakdown-scroll {
  overflow-x: auto;
}

.breakdown-matrix-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 100%;
}

.breakdown-matrix-table th,
.breakdown-matrix-table td {
  text-align: center;
  padding: 10px 8px;
  border: 1px solid rgba(230, 57, 70, 0.12);
  font-size: 0.9rem;
}

.breakdown-matrix-table th {
  background: rgba(230, 57, 70, 0.12);
  color: var(--text);
  font-weight: 700;
}

.breakdown-matrix-table td.month-label {
  text-align: left;
  font-weight: 600;
  background: rgba(230, 57, 70, 0.06);
}

.breakdown-matrix-table td.amount-cell {
  background: white;
}

.breakdown-matrix-table tr:nth-child(even) td.amount-cell {
  background: #f8fafc;
}

.breakdown-matrix-table td.amount-cell:not(:contains('-')) {
  color: var(--accent);
  font-weight: 600;
}

/* ============================================================================
   PIE DE PÁGINA Y TEXTO SECUNDARIO
   ============================================================================ */

.disclaimer {
  margin-top: 26px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.7;
}

footer {
  margin-top: 26px;
  text-align: center;
  color: #94a3b8;
  font-size: 0.9rem;
}

/* ============================================================================
   DISEÑO RESPONSIVO
   ============================================================================ */

@media (max-width: 720px) {
  header {
    flex-direction: column;
    align-items: flex-start;
  }

  .logo {
    max-width: 250px;
  }
}

/* ============================================================================
   SECCIÓN DE REDES SOCIALES
   ============================================================================ */
.social-section {
  margin-top: 18px;
  padding: 20px 18px;
  background: transparent; /* sección limpia, sin sombreado */
}

.social-inner {
  max-width: 920px;
  margin: 0 auto;
  text-align: center;
}

.social-inner h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.social-inner .small {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.95rem;
}

.social-icons {
  display: flex;
  gap: 14px;
  justify-content: center;
  align-items: center;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  color: var(--accent);
  background: white;
  box-shadow: 0 6px 15px rgba(15,23,42,0.06);
  border: 1px solid rgba(148,163,184,0.08);
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.social-link:hover {
  background: var(--accent-soft);
}

.social-link svg {
  width: 20px;
  height: 20px;
}

/* ============================================================================
   TABLA DE CONTENIDOS / ÍNDICE
   ============================================================================ */

.table-of-contents {
  margin: 0 0 40px 0;
  padding: 28px 24px;
  background: linear-gradient(135deg, var(--accent-soft) 0%, rgba(230, 57, 70, 0.08) 100%);
  border-radius: 20px;
  border: 1px solid rgba(230, 57, 70, 0.2);
  box-shadow: 0 8px 20px rgba(230, 57, 70, 0.1);
}

.toc-container {
  max-width: 920px;
  margin: 0 auto;
}

.table-of-contents h2 {
  margin-top: 0;
  margin-bottom: 18px;
  color: var(--accent);
  font-size: 1.3rem;
}

.toc-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-nav > ul > li {
  margin-bottom: 12px;
}

.toc-nav > ul > li > a {
  display: block;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  padding: 8px 12px;
  border-left: 3px solid var(--accent);
  padding-left: 15px;
  transition: all 0.2s ease;
}

.toc-nav > ul > li > a:hover {
  color: var(--accent);
  padding-left: 20px;
  background: rgba(230, 57, 70, 0.08);
  border-radius: 6px;
}

.toc-nav > ul > li > ul {
  margin: 8px 0 0 0;
  padding-left: 24px;
  border-left: 2px solid rgba(230, 57, 70, 0.3);
  margin-left: 6px;
}

.toc-nav > ul > li > ul > li {
  margin-bottom: 6px;
}

.toc-nav > ul > li > ul > li > a {
  display: block;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 6px 10px;
  transition: all 0.2s ease;
  border-radius: 4px;
}

.toc-nav > ul > li > ul > li > a:hover {
  color: var(--accent);
  background: rgba(230, 57, 70, 0.1);
  padding-left: 15px;
}

/* Smooth scroll behavior */
html {
  scroll-behavior: smooth;
}
