/**
 * Estilos canónicos de la Calculadora de Bonos, Duración y Convexidad
 * Fijate Tools • Fixed Income Studio
 */

:root {
  --bg-body: #0a0e17;
  --bg-card: #121826;
  --bg-card-subtle: #182234;
  --bg-card-hover: #1f2c42;
  --border-color: #26334d;
  --border-focus: #3b82f6;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #ff8507;
  --accent-glow: rgba(255, 133, 7, 0.18);
  --curve-line: #38bdf8;
  --tangent-line: #f43f5e;
  --taylor-line: #10b981;
  --spot-color: #f59e0b;
  --green: #10b981;
  --yellow: #f59e0b;
  --red: #f43f5e;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --font-mono: 'JetBrains Mono', monospace;
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="light"] {
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-card-hover: #e2e8f0;
  --border-color: #cbd5e1;
  --border-focus: #2563eb;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --accent: #ea580c;
  --accent-glow: rgba(234, 88, 12, 0.12);
  --curve-line: #0284c7;
  --tangent-line: #e11d48;
  --taylor-line: #059669;
  --spot-color: #d97706;
  --green: #059669;
  --yellow: #d97706;
  --red: #e11d48;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-wrapper.tool-layout {
  max-width: 1360px;
  margin: 1rem auto 3rem;
  padding: 0 1rem;
  width: 100%;
  flex: 1;
}

.tool-with-sidebar {
  display: flex;
  gap: 1.75rem;
  align-items: flex-start;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Presets Bar */
.card-presets {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.presets-header {
  margin-bottom: 0.65rem;
}

.presets-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.presets-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-preset {
  background: var(--bg-card-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
}

.btn-preset:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.btn-preset.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* Parámetros del Bono */
.card-bond-params {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.section-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.bond-inputs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 900px) {
  .bond-inputs-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .bond-inputs-grid {
    grid-template-columns: 1fr;
  }
}

.field-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.input-with-suffix {
  position: relative;
  display: flex;
  align-items: center;
}

.form-input {
  width: 100%;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 2.75rem 0.5rem 0.75rem;
  color: var(--text-main);
  font-size: 0.95rem;
  min-height: 40px;
  outline: none;
}

.form-input:focus {
  border-color: var(--border-focus);
}

.input-suffix {
  position: absolute;
  right: 0.75rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.form-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  color: var(--text-main);
  font-size: 0.88rem;
  min-height: 40px;
  outline: none;
}

/* TARJETAS HERO DE MÉTRICAS */
.cards-metrics-hero {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

@media (max-width: 1024px) {
  .cards-metrics-hero {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .cards-metrics-hero {
    grid-template-columns: 1fr;
  }
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.card-price { border-top: 4px solid var(--accent); }
.card-dmod { border-top: 4px solid var(--red); }
.card-convex { border-top: 4px solid var(--green); }

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.metric-tag {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.badge-status {
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.badge-subtle {
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.badge-accent {
  background: rgba(244, 63, 94, 0.15);
  color: var(--red);
  border: 1px solid var(--red);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.badge-glow {
  background: rgba(16, 185, 129, 0.15);
  color: var(--green);
  border: 1px solid var(--green);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.metric-val-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.hero-val {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

.metric-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.metric-footer-note {
  border-top: 1px solid var(--border-color);
  padding-top: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* SHOCK DE TIPOS: TAYLOR */
.card-taylor-shock {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.shock-tag {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--accent);
}

.taylor-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 800px) {
  .taylor-grid {
    grid-template-columns: 1fr;
  }
}

.taylor-cell {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.cell-real { border-left: 4px solid var(--curve-line); }
.cell-linear { border-left: 4px solid var(--tangent-line); }
.cell-taylor { border-left: 4px solid var(--taylor-line); }

.taylor-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.taylor-cell strong {
  font-size: 1.35rem;
  color: var(--text-main);
}

.taylor-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ESCENARIO GRÁFICO SVG DE PRECIO VS RENTABILIDAD */
.card-curve-stage {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stage-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.legend-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.badge-legend {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  border: 1px solid;
}

.badge-curve { background: rgba(56, 189, 248, 0.15); border-color: var(--curve-line); color: var(--curve-line); }
.badge-tangent { background: rgba(244, 63, 94, 0.15); border-color: var(--tangent-line); color: var(--tangent-line); }
.badge-spot { background: rgba(245, 158, 11, 0.15); border-color: var(--spot-color); color: var(--spot-color); }

.curve-svg-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  overflow: hidden;
}

#bond-curve-svg {
  width: 100%;
  height: auto;
  min-height: 380px;
  display: block;
}

/* INMUNIZACIÓN REDINGTON */
.card-immunization {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.immunization-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1.25rem;
  align-items: center;
}

@media (max-width: 800px) {
  .immunization-grid {
    grid-template-columns: 1fr;
  }
}

.immun-input-box {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.immun-result-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.immun-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.immun-result-box strong {
  font-size: 1rem;
  color: var(--accent);
}

.immun-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* TABLA DE FLUJOS */
.card-cashflows-table {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.table-responsive-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.bond-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.bond-table th, .bond-table td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border-color);
}

.bond-table th {
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  font-weight: 600;
}

.font-mono {
  font-family: var(--font-mono);
}

.font-bold {
  font-weight: 700;
}

/* Modales */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
}

.modal-dialog-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-body {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.25rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  min-height: 40px;
}
