/* ============================================================================
   theme.css — jegeremonfric.fr
   Design System unifié (Mode Clair / Light Mode modernisé)
   ========================================================================== */

:root {
    --bg: #f8fafc;
    --surface-low: #f1f5f9;
    --surface: #ffffff;
    --panel: #ffffff;
    --surface-high: #f8fafc;
    --surface-highest: #e2e8f0;
    --card-inner: #f1f5f9;

    --on-surface: #0f172a;
    --on-surface-variant: #475569;
    --text: #0f172a;
    --muted: #64748b;
    --outline: #94a3b8;
    --outline-variant: #cbd5e1;
    --border: #e2e8f0;

    --primary: #0284c7;
    --accent: #0284c7;
    --on-primary: #ffffff;
    --primary-container: #e0f2fe;
    --on-primary-container: #0369a1;

    --success: #16a34a;
    --warning: #d97706;
    --error: #dc2626;
    --danger: #dc2626;
    --on-error-container: #7f1d1d;
    --purple: #9333ea;
    --purple-bg: rgba(147, 51, 234, 0.08);

    --r-xs: 4px;
    --r-s: 8px;
    --r-m: 12px;
    --r-l: 16px;
    --r-full: 999px;

    --ease: cubic-bezier(.2, 0, 0, 1);
    --elev-1: 0 1px 3px rgba(0, 0, 0, .1), 0 1px 2px rgba(0, 0, 0, .06);
    --elev-2: 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -1px rgba(0, 0, 0, .06);
    --elev-3: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -2px rgba(0, 0, 0, .05);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--on-surface);
    margin: 0;
    padding: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ── Navigation (<nav-header>) ───────────────────────────────────────────── */
nav-header { display: block; width: 100%; }
.main-header {
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    margin: -1.5rem -1.5rem 1.5rem -1.5rem;
    padding: 0 1.5rem;
    box-shadow: var(--elev-1);
}
.nav-container {
    max-width: 1480px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
}
.brand-logo { font-size: 1.1rem; font-weight: 800; color: var(--text); text-decoration: none; letter-spacing: -0.5px; }
.brand-logo span { color: var(--primary); }
.nav-menu { display: flex; gap: 1rem; align-items: center; }
.nav-item { position: relative; }
.nav-link, .dropdown-toggle {
    background: transparent; border: none; color: var(--muted); font-size: 0.85rem; font-weight: 500;
    cursor: pointer; text-decoration: none; padding: 6px 10px; border-radius: 6px;
    display: inline-flex; align-items: center; gap: 4px; font-family: inherit; transition: color 0.2s, background 0.2s;
}
.nav-link:hover, .dropdown-toggle:hover { color: var(--text); background: var(--surface-low); }
.dropdown-menu {
    display: none; position: absolute; top: 100%; left: 0; background: var(--panel);
    border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--elev-3);
    min-width: 220px; padding: 6px; z-index: 1000;
}
.dropdown-menu a, .dropdown-menu button {
    display: block; width: 100%; text-align: left; background: transparent; border: none;
    color: var(--text); font-size: 0.8rem; text-decoration: none; padding: 7px 10px;
    border-radius: 6px; cursor: pointer; font-family: inherit;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-low); color: var(--primary); }
.dropdown:hover .dropdown-menu { display: block; }
.badge-profile { background: var(--primary-container); color: var(--on-primary-container); border: 1px solid rgba(2, 132, 199, 0.2); }

/* ── Grilles & Conteneurs ────────────────────────────────────────────────── */
.wrapper { width: 100%; max-width: 1480px; margin: 0 auto; }
.layout-immo { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.5rem; align-items: start; }
.grid-layout { display: grid; grid-template-columns: 440px 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 1050px) { .layout-immo, .grid-layout { grid-template-columns: 1fr; } }

.header-title { margin-bottom: 1.5rem; }
.header-title h1 { font-size: 1.65rem; font-weight: 700; color: var(--text); margin: 0 0 0.35rem; display: flex; align-items: center; gap: 0.6rem; }
.header-title p { color: var(--muted); margin: 0; font-size: 0.9rem; max-width: 85ch; }

/* ── Cartes & Composants ─────────────────────────────────────────────────── */
.card { 
    background: var(--panel); 
    padding: 1.25rem; 
    border-radius: 12px; 
    border: 1px solid var(--border); 
    box-shadow: var(--elev-1);
    margin-bottom: 1.25rem; 
}
.card h2 {
    font-size: 1.02rem; border-bottom: 1px solid var(--border); padding-bottom: 0.55rem;
    margin: 0 0 1rem 0; color: var(--primary); display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
}

.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
@media (max-width: 650px) { .form-grid { grid-template-columns: 1fr; } }
.form-group { display: flex; flex-direction: column; margin-bottom: 0.85rem; }
.form-group label { font-size: 0.78rem; color: var(--muted); margin-bottom: 0.3rem; display: flex; justify-content: space-between; align-items: center; }
.aide { font-size: 0.74rem; color: var(--muted); margin-top: 0.35rem; }

input, select {
    background: var(--surface); border: 1px solid var(--border); color: var(--text);
    padding: 8px 10px; border-radius: 8px; font-size: 0.88rem; width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--primary); border-color: transparent; }
input[type="range"] { accent-color: var(--primary); padding: 0; cursor: pointer; height: 6px; background: var(--surface-highest); border-radius: 3px; border: none; }

button.btn-primary, .btn-propager {
    background: var(--primary); color: var(--on-primary); font-weight: 700; border: none;
    padding: 9px 14px; border-radius: 8px; cursor: pointer; font-size: 0.84rem; transition: background 0.15s;
}
.btn-propager { width: 100%; margin-top: 1rem; }
button.btn-primary:hover, .btn-propager:hover { opacity: 0.92; }
button.btn-del { background: transparent; color: var(--danger); border: 1px solid var(--danger); padding: 3px 8px; border-radius: 6px; cursor: pointer; font-size: 0.72rem; }
button.btn-del:hover { background: var(--danger); color: #fff; }

.badge, span.tag { font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; font-weight: 600; display: inline-block; }
.badge-tns, span.tag { background: var(--primary-container); color: var(--on-primary-container); }
.badge-sasu { background: #fef3c7; color: #b45309; }
.badge-micro { background: var(--surface-highest); color: var(--muted); }
.val-badge { font-weight: 700; color: var(--primary); font-size: 0.84rem; }

/* ── Lignes de listes & Résultats ────────────────────────────────────────── */
.items-container { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.6rem; }
.rev-line { display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 0.75rem; background: var(--card-inner); border: 1px solid var(--border); border-radius: 8px; padding: 0.55rem 0.75rem; font-size: 0.82rem; }
.rev-line .rl-nom { font-weight: 600; color: var(--text); }
.rev-line .rl-meta { font-size: 0.7rem; color: var(--muted); }
.rev-line .rl-montant { text-align: right; }
.empty { font-size: 0.8rem; color: var(--muted); text-align: center; padding: 0.8rem; border: 1px dashed var(--border); border-radius: 8px; }

.output-row { display: flex; justify-content: space-between; padding: 0.38rem 0; border-bottom: 1px solid var(--border); font-size: 0.83rem; }
.output-row span:last-child { font-weight: 700; color: var(--primary); }
.output-row.highlight { background: var(--primary-container); padding: 0.5rem 0.45rem; border-radius: 6px; }
.output-row.highlight span:last-child { font-size: 0.98rem; color: var(--on-primary-container); }

.gauge-container { margin: 0.75rem 0; }
.gauge-bar-bg { width: 100%; height: 12px; background: var(--surface-highest); border-radius: 6px; overflow: hidden; position: relative; }
.gauge-bar-fill { height: 100%; width: 0%; transition: width 0.3s, background-color 0.3s; }
.gauge-limit-marker { position: absolute; top: 0; left: 35%; bottom: 0; width: 2px; background: var(--on-surface); z-index: 2; }

table.simu-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; margin-top: 0.6rem; }
table.simu-table th, table.simu-table td { text-align: right; padding: 6px 4px; border-bottom: 1px solid var(--border); }
table.simu-table th:first-child, table.simu-table td:first-child { text-align: left; }

/* ── Cartes Comparateur Statuts ──────────────────────────────────────────── */
.holding-box { background: var(--purple-bg); border: 1px solid rgba(147, 51, 234, 0.2); border-radius: 8px; padding: 0.85rem 1rem; }
.holding-title { font-weight: 700; color: var(--purple); font-size: 0.9rem; }
.cards-comparison { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
@media (max-width: 900px) { .cards-comparison { grid-template-columns: 1fr; } }

.col-statut { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 1.15rem; display: flex; flex-direction: column; box-shadow: var(--elev-1); }
.col-statut.best { border-color: var(--success); box-shadow: 0 0 14px rgba(22, 163, 74, 0.15); }
.statut-name { font-size: 1.2rem; font-weight: 800; color: var(--text); margin: 0.3rem 0 0; }
.final-pockets { background: var(--card-inner); border-radius: 8px; padding: 0.8rem; margin: 0.7rem 0; display: flex; flex-direction: column; gap: 0.45rem; border: 1px solid var(--border); }
.pocket-row { display: flex; justify-content: space-between; align-items: baseline; }
.pocket-label { font-size: 0.76rem; color: var(--muted); }
.pocket-val { font-size: 1.1rem; font-weight: 800; color: var(--text); }
.pocket-val.green { color: var(--success); }
.pocket-val.purple { color: var(--purple); }
.pocket-sub { font-size: 0.68rem; color: var(--muted); text-align: right; margin-top: -3px; }
.total-box { border-top: 1px solid var(--border); padding-top: 0.45rem; }

.breakdown-list { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.78rem; margin-top: auto; }
.b-row { display: flex; justify-content: space-between; padding: 2px 0; border-bottom: 1px solid var(--border); }
.b-row span:first-child { color: var(--muted); }
.b-row.minus span:last-child { color: var(--danger); font-weight: 600; }

.snackbar {
    position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%);
    background: #0f172a; color: #f8fafc; padding: 10px 18px; border-radius: 8px;
    box-shadow: var(--elev-3); font-weight: 600; font-size: .85rem; z-index: 2000; transition: transform .25s ease;
}
.snackbar.show { transform: translate(-50%, 0); }

/* ── Header : menus au clic / tap, page active, séparateurs ─────────────── */
.dropdown.open .dropdown-menu { display: block; }
.dropdown-label { padding: 4px 10px; font-size: 0.7rem; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.dropdown-sep { border-top: 1px solid var(--border); margin: 4px 0; }
.nav-link.active, .dropdown-toggle.active { color: var(--primary); background: var(--primary-container); }
.dropdown-menu a.active { color: var(--primary); font-weight: 600; }
.dropdown-toggle:focus-visible, .nav-link:focus-visible, .dropdown-menu a:focus-visible, .dropdown-menu button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (max-width: 800px) {
    .nav-container { height: auto; flex-wrap: wrap; padding: 8px 0; gap: 0.5rem; }
    .nav-menu { flex-wrap: wrap; gap: 0.25rem; }
}