/* ===== PAGE SIMULATEUR DÉTAILLÉE ===== */

.sim-page-hero {
  padding: var(--space-lg) 0 var(--space-md);
  position: relative;
  background:
    radial-gradient(circle at 90% 10%, rgba(47,175,110,0.14), transparent 45%),
    radial-gradient(circle at 4% 90%, rgba(47,175,110,0.08), transparent 40%),
    var(--color-cream);
  overflow: hidden;
}

.sim-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: var(--space-lg);
  align-items: start;
}

/* Empêche le tableau d'amortissement (largeur minimale interne) de forcer
   toute la grille à s'élargir au-delà de l'écran sur mobile/tablette */
.sim-layout > div {
  min-width: 0;
}

/* Panneau de contrôle (réutilise .sim-card mais en version claire) */
.sim-panel {
  background: white;
  border: 1px solid var(--color-cream-dark);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  position: sticky;
  top: 90px;
  box-shadow: var(--shadow-card);
}

.sim-panel h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--color-navy-950);
  margin-bottom: var(--space-md);
}

.sim-panel .sim-field label {
  color: var(--color-navy-700);
}

.sim-panel input[type="range"] {
  accent-color: var(--color-navy-900);
}

.sim-summary {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-cream-dark);
}

.sim-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: var(--fs-small);
  color: var(--color-navy-700);
}

.sim-summary-row.total {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--color-navy-950);
  font-weight: 600;
  border-top: 1px dashed var(--color-cream-dark);
  margin-top: 8px;
  padding-top: 12px;
}

.print-btn {
  width: 100%;
  margin-top: var(--space-md);
  background: var(--color-gold);
  color: var(--color-navy-950);
  font-weight: 600;
  padding: 14px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-base);
}
.print-btn:hover { background: var(--color-gold-light); }

/* Légende couleurs */
.legend {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
  font-size: var(--fs-small);
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend-swatch.capital { background: var(--color-navy-500); }
.legend-swatch.interet { background: var(--color-gold); }

/* Barre de répartition capital / intérêts par ligne */
.repartition-bar {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  background: var(--color-cream-dark);
}
.repartition-bar .part-capital { background: var(--color-navy-500); }
.repartition-bar .part-interet { background: var(--color-gold); }

/* Tableau d'amortissement */
.table-wrapper {
  background: white;
  border: 1px solid var(--color-cream-dark);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

table.amortissement {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-small);
}

table.amortissement thead th {
  background: var(--color-navy-950);
  color: var(--color-cream);
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  position: sticky;
  top: 0;
}

table.amortissement tbody td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-cream-dark);
  font-family: var(--font-mono);
  color: var(--color-navy-900);
}

table.amortissement tbody tr:nth-child(even) {
  background: var(--color-cream);
}

table.amortissement tbody tr:hover {
  background: var(--color-gold-light);
  opacity: 0.9;
}

.table-scroll {
  max-height: 560px;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.amortissement { min-width: 640px; }

.col-interet { color: var(--color-gold) !important; font-weight: 600; }
.col-capital { color: var(--color-navy-500) !important; font-weight: 600; }

/* ===== IMPRESSION ===== */
@media print {
  .site-header, .menu-toggle, .sim-panel, .site-footer,
  .disclaimer, .no-print {
    display: none !important;
  }

  body { background: white; }

  .sim-layout { display: block; }

  .table-scroll { max-height: none; overflow: visible; }

  table.amortissement thead th {
    background: #eee !important;
    color: #000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .col-interet, .col-capital { color: #000 !important; }

  .print-header {
    display: block !important;
    margin-bottom: var(--space-md);
  }
}

.print-header { display: none; }

@media (max-width: 900px) {
  .sim-layout { grid-template-columns: 1fr; }
  .sim-panel { position: static; }
}
