/* ============================================================
   HIPOTECA.CSS — SimpleConvertly v1.0
   Solo estilos EXCLUSIVOS de la calculadora de hipoteca.
   tokens.css + base.css + components.css se cargan antes.
   ============================================================ */

/* ── Visualización de cuota principal ────────────────────── */
.cuota-display {
  text-align: center;
  padding: 28px 20px;
  background: linear-gradient(135deg, var(--gold-soft), rgba(212, 168, 77, 0.05));
  border: 1px solid rgba(184, 137, 42, 0.2);
  border-radius: var(--r-lg);
  margin-bottom: 24px;
}
.cuota-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  margin-bottom: 8px;
}
.cuota-val {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: -0.04em;
  line-height: 1;
}
.cuota-sub { font-size: 0.84rem; color: var(--muted); margin-top: 8px; }

/* ── Gráfico donut ────────────────────────────────────────── */
.chart-wrap {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 20px;
}
body.dark .chart-wrap,
[data-theme="dark"] .chart-wrap { background: var(--bg-2); }
.donut-svg { flex-shrink: 0; }
.chart-legend { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.legend-item  { display: flex; align-items: center; gap: 10px; }
.legend-dot   { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.legend-label { font-size: 0.82rem; color: var(--text-2); flex: 1; }
.legend-val   { font-family: var(--font-display); font-size: 0.88rem; font-weight: 700; color: var(--text); }
.legend-pct   { font-size: 0.74rem; color: var(--muted); }

/* ── Gráfico de barras capital/intereses ──────────────────── */
.barchart-section { margin-bottom: 24px; }
.barchart-title   { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 12px; }
.barchart-wrap    { overflow-x: auto; padding-bottom: 4px; }
.barchart-inner   { display: flex; align-items: flex-end; gap: 4px; height: 120px; min-width: max-content; padding: 0 2px; }
.bar-group        { display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
.bar-stack        { display: flex; flex-direction: column; justify-content: flex-end; width: 18px; border-radius: 4px 4px 0 0; overflow: hidden; }
.bar-capital      { background: var(--gold); width: 100%; transition: opacity var(--t-fast); }
.bar-interes      { background: var(--red);  width: 100%; transition: opacity var(--t-fast); }
.bar-year         { font-size: 0.6rem; color: var(--muted); font-family: var(--font-display); font-weight: 600; margin-top: 3px; }
.bar-group:hover .bar-capital,
.bar-group:hover .bar-interes { opacity: 0.8; }

/* ── Info TAE ─────────────────────────────────────────────── */
.tae-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--blue-soft);
  border: 1px solid rgba(37, 99, 235, 0.15);
  border-radius: var(--r-md);
  margin-bottom: 20px;
}
.tae-icon { font-size: 1.2rem; }
.tae-text { font-size: 0.84rem; color: var(--text-2); flex: 1; line-height: 1.5; }
.tae-text strong { color: var(--text); }

/* ── Tarjeta amortización anticipada ─────────────────────── */
.anticip-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  padding: 28px;
  margin-bottom: 28px;
  animation: fadeUp 0.5s var(--ease) 0.15s both;
}
.anticip-card h2 { font-family: var(--font-display); font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.anticip-card p  { font-size: 0.86rem; color: var(--muted); margin-bottom: 18px; }
.anticip-fields  { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.anticip-result  { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.anticip-item    { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; }
body.dark .anticip-item,
[data-theme="dark"] .anticip-item { background: var(--bg-2); }
.anticip-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 5px; }
.anticip-val   { font-family: var(--font-display); font-size: 1.1rem; font-weight: 800; }
.anticip-val.green { color: var(--green); }
.anticip-val.gold  { color: var(--gold);  }
.anticip-val.red   { color: var(--red);   }

/* ── Tabla de amortización ────────────────────────────────── */
.table-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin-bottom: 32px;
  animation: fadeUp 0.5s var(--ease) 0.2s both;
}
.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.table-header h2 { font-family: var(--font-display); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); }
.table-controls  { display: flex; gap: 8px; align-items: center; }

.show-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-2);
  border: 1.5px solid var(--border-md);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text);
  transition: all var(--t-fast);
  font-family: var(--font-body);
}
.show-all-btn:hover { border-color: var(--gold); background: var(--gold-soft); }

.dl-csv-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  transition: transform var(--t-fast);
  font-family: var(--font-display);
  box-shadow: 0 2px 8px var(--gold-glow);
}
.dl-csv-btn:hover { transform: translateY(-1px); }

.table-scroll { overflow-x: auto; max-height: 460px; overflow-y: auto; }

table        { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
thead        { position: sticky; top: 0; z-index: 2; }
thead tr     { background: var(--surface-2); }
th           { padding: 12px 16px; text-align: right; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); white-space: nowrap; }
th:first-child { text-align: left; }
td           { padding: 10px 16px; text-align: right; border-bottom: 1px solid var(--border); font-family: var(--font-display); font-size: 0.84rem; color: var(--text-2); }
td:first-child { text-align: left; color: var(--muted); font-size: 0.78rem; }
tbody tr:hover td { background: var(--bg); }
td.capital-col { color: var(--gold);  font-weight: 700; }
td.interes-col { color: var(--red);   font-weight: 600; }
td.pendiente-col{ color: var(--text); font-weight: 700; }

/* ── Responsive específico de hipoteca ───────────────────── */
@media (max-width: 900px) {
  .anticip-fields { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .cuota-val       { font-size: 2.2rem; }
  .anticip-fields  { grid-template-columns: 1fr; }
}
