/*
 * apps/mortgage_calculator/static/style.css
 * ------------------------------------------
 * Charte Zero Bullshit — thème clair.
 *
 * PALETTE — toutes les couleurs sont des variables CSS.
 * Pour ajuster le branding, modifier UNIQUEMENT le bloc :root.
 * Ne jamais mettre de couleurs hardcodées en dehors de ce bloc.
 *
 * COULEURS ZB SOURCE (config/domains.php) :
 *   color         → #E4BBD6 (rose principal)
 *   color_light   → #FDF5FA (rose très pâle)
 *   text_on_color → #0D0D0D (noir ZB)
 */

/* ─── Palette Zero Bullshit — modifier ici pour tout changer ────────────────── */
:root {
  /* Marque ZB */
  --zb-pink:          #E4BBD6;   /* Rose principal — onglet actif, accents */
  --zb-pink-light:    #FDF5FA;   /* Rose très pâle — fond carte, résultat highlight */
  --zb-pink-dark:     #C48EB8;   /* Rose foncé — hover, focus, bordures actives */
  --zb-black:         #0D0D0D;   /* Noir ZB — texte sur fond rose */

  /* Surfaces */
  --bg:               #FFFFFF;
  --bg-card:          #FAFAFA;
  --bg-input:         #F4EBF2;   /* Légère teinte rose sur les champs */
  --border:           #E4BBD6;   /* = zb-pink, bordure standard */
  --border-subtle:    #EDD5E8;   /* Bordure très légère */

  /* Texte */
  --text:             #0D0D0D;
  --text-muted:       #6B5460;
  --text-subtle:      #9B7C8A;

  /* Fonctionnel — succès (taux d'effort confortable, résultat positif) */
  --green:            #1E7A45;
  --green-bg:         #E8F5EE;

  /* Fonctionnel — avertissement (taux d'effort limite) */
  --orange:           #B86A10;
  --orange-bg:        #FEF0DC;

  /* Fonctionnel — danger (taux d'effort dépassé, coût élevé) */
  --red:              #B52B2B;
  --red-bg:           #FCEAEA;

  /* Fonctionnel — info (usage futur : tooltip, note) */
  --blue:             #2058A8;
  --blue-bg:          #E8F0FB;

  /* Tokens UI */
  --radius:           10px;
  --shadow:           0 2px 12px rgba(180,120,160,.10);
}

/* ─── Reset & base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
}

/* ─── Header ────────────────────────────────────────────────────────────────── */
header {
  border-bottom: 1px solid var(--border);
  padding: 2rem 1rem 1.5rem;
  background: var(--zb-pink-light);
}

.header-inner {
  max-width: 860px;
  margin: 0 auto;
}

.brand {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--zb-pink-dark);
  margin-bottom: .5rem;
}

header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
  margin-bottom: .25rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: .95rem;
}

/* ─── Main ──────────────────────────────────────────────────────────────────── */
main {
  flex: 1;
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
  padding: 2rem 1rem;
}

/* ─── Tabs ──────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.tab {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 1.1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.tab:hover {
  border-color: var(--zb-pink-dark);
  color: var(--text);
  background: var(--zb-pink-light);
}

.tab.active {
  background: var(--zb-pink);
  border-color: var(--zb-pink-dark);
  color: var(--zb-black);
  font-weight: 600;
}

.tab-icon { font-size: 1rem; }

/* ─── Tab content ───────────────────────────────────────────────────────────── */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ─── Card ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: .5rem;
  letter-spacing: -.01em;
}

.card-desc {
  color: var(--text-muted);
  font-size: .9rem;
  margin-bottom: 1.75rem;
  line-height: 1.6;
}

/* ─── Formulaire ────────────────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

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

label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.unit {
  color: var(--text-subtle);
  font-weight: 400;
  font-size: .78rem;
}

input[type="number"],
select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: 1rem;
  padding: .6rem .85rem;
  width: 100%;
  transition: border-color .15s;
  appearance: none;
  -webkit-appearance: none;
}

input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--zb-pink-dark);
  box-shadow: 0 0 0 3px rgba(196,142,184,.18);
}

input[type="number"]::placeholder { color: var(--text-subtle); }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239B7C8A' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .85rem center;
  padding-right: 2rem;
  cursor: pointer;
}

.hint {
  font-size: .78rem;
  color: var(--text-subtle);
  line-height: 1.4;
}

/* ─── Résultats ─────────────────────────────────────────────────────────────── */
.results { animation: fadeIn .2s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

.hidden { display: none !important; }

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.result-card {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1.1rem 1.2rem;
}

/* Résultat principal : fond rose ZB */
.result-card.primary {
  border-color: var(--zb-pink-dark);
  background: var(--zb-pink-light);
}

/* Résultat positif : fond vert doux */
.result-card.highlight {
  border-color: var(--green);
  background: var(--green-bg);
}

.result-label {
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: .35rem;
}

.result-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
  margin-bottom: .25rem;
}

.result-card.primary .result-value   { color: var(--zb-black); }
.result-card.highlight .result-value { color: var(--green); }

.result-sub {
  font-size: .75rem;
  color: var(--text-subtle);
  line-height: 1.4;
}

/* ─── Empty state ───────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  color: var(--text-subtle);
  font-size: .9rem;
  padding: 2rem 0 .5rem;
}

/* ─── Barre taux d'effort ───────────────────────────────────────────────────── */
.taux-effort-bar-wrap { margin-top: .5rem; }

.taux-effort-label {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: .5rem;
  display: flex;
  align-items: center;
  gap: .6rem;
}

.taux-effort-label strong { color: var(--text); font-size: 1rem; }

.badge {
  font-size: .72rem;
  font-weight: 700;
  padding: .15rem .55rem;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.badge.green  { background: var(--green-bg);  color: var(--green); }
.badge.orange { background: var(--orange-bg); color: var(--orange); }
.badge.red    { background: var(--red-bg);    color: var(--red); }

.taux-bar-bg {
  position: relative;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 99px;
  height: 10px;
  overflow: visible;
  margin-bottom: .4rem;
}

.taux-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .3s ease, background .3s;
  background: var(--zb-pink);
}

.taux-bar-fill.green  { background: var(--green); }
.taux-bar-fill.orange { background: var(--orange); }
.taux-bar-fill.red    { background: var(--red); }

.taux-bar-limit {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  background: rgba(0,0,0,.20);
  border-radius: 2px;
}

.taux-bar-labels {
  position: relative;
  display: flex;
  font-size: .7rem;
  color: var(--text-subtle);
}

/* ─── Barre capital/intérêts ────────────────────────────────────────────────── */
.split-bar-wrap { margin: .5rem 0 1.5rem; }

.split-bar-label {
  font-size: .82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: .6rem;
}

.split-bar {
  display: flex;
  height: 14px;
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.split-bar-capital  { background: var(--zb-pink);  transition: width .3s; }
.split-bar-interets { background: var(--red);       transition: width .3s; }

.split-bar-legend {
  display: flex;
  gap: 1.5rem;
  margin-top: .5rem;
  font-size: .78rem;
}

.legend-capital::before,
.legend-interets::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: .35rem;
  vertical-align: middle;
}

.legend-capital::before  { background: var(--zb-pink); }
.legend-interets::before { background: var(--red); }

.legend-capital  { color: var(--text-muted); }
.legend-interets { color: var(--text-muted); }

/* ─── Tableau amortissement ─────────────────────────────────────────────────── */
.amortissement-wrap { margin-top: .5rem; }

.toggle-amortissement {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: .85rem;
  padding: .55rem 1rem;
  border-radius: 7px;
  cursor: pointer;
  transition: all .15s;
}

.toggle-amortissement:hover {
  border-color: var(--zb-pink-dark);
  color: var(--text);
  background: var(--zb-pink-light);
}

.amort-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .83rem;
  margin-top: 1rem;
}

.amort-table th {
  text-align: left;
  padding: .6rem .75rem;
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--border);
}

.amort-table td {
  padding: .55rem .75rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text);
}

.amort-table tr:last-child td { border-bottom: none; }
.amort-table tr:hover td { background: var(--zb-pink-light); }
.amort-table td:first-child { color: var(--text-muted); font-weight: 600; }

/* ─── Taux d'effort — explication ──────────────────────────────────────────── */
.taux-effort-explainer {
  font-size: .8rem;
  color: var(--text-subtle);
  line-height: 1.5;
  margin-top: .6rem;
}

/* ─── Disclaimer — texte simple, sans encadrement ───────────────────────────── */
.disclaimer {
  margin-top: 1.5rem;
  font-size: .78rem;
  color: var(--text-subtle);
  text-align: center;
  line-height: 1.5;
  /* Pas de background, border ou padding — texte nu intentionnellement */
}

/* ─── Footer ────────────────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 1rem;
  margin-top: auto;
  background: var(--zb-pink-light);
}

.footer-inner {
  max-width: 860px;
  margin: 0 auto;
  font-size: .78rem;
  color: var(--text-subtle);
}

/* ─── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .tabs { gap: .35rem; }
  .tab  { padding: .5rem .75rem; font-size: .82rem; }
  .tab-icon { display: none; }
  .card { padding: 1.25rem; }
  header h1 { font-size: 1.35rem; }
  .result-grid { grid-template-columns: 1fr 1fr; }
  .amort-table th:nth-child(2),
  .amort-table td:nth-child(2) { display: none; }
}

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