/*
 * apps/_shared/static/css/zbs.css
 * --------------------------------
 * Composants CSS mutualisés de la marque ZeroBullshit — servis sur
 * /shared-static/css/zbs.css par TOUTES les apps ZBS (montage via
 * apps._shared.templating.mount_shared_static).
 *
 * PÉRIMÈTRE :
 * - Tokens couleur / typo ZB (miroir des enquêtes theme-blanc)
 * - Layout : skip-link, en-tête (nav-link, tool-switch)
 * - Composants : cartes, tableaux, badges, formulaires, boutons, tuiles stat
 * - Typographie éditoriale : .title-editorial, .eyebrow, .lede
 * - Impression
 *
 * NE GÈRE PAS :
 * - Le layout de page (→ Tailwind CDN, config dans templates/zbs/base.html)
 * - Les specificités d'une app (→ son propre /static/css)
 * - Les graphiques (→ Chart.js, configuré dans les templates)
 *
 * PIÈGE : les tokens couleur DOIVENT rester en phase avec
 *   front_theme_WP/brands/zerobullshit/style.css (site WP principal).
 * Toute divergence = incohérence visuelle entre le site et les outils.
 */

/* ── Tokens ZB ────────────────────────────────────────────────────────────── */
:root {
    --zb-bg:         #FAFAF8;
    --zb-mod-bg:     #F2F1ED;
    --zb-rose-300:   #E4BBD6;
    --zb-rose-500:   #C98CB7;
    --zb-rose-700:   #8E5880;
    --zb-rose-900:   #472940;
    --zb-bleu-200:   #D4F0F0;
    --zb-bleu-700:   #2D7A7A;
    --zb-noir:       #0D0D0D;
    --zb-border:     rgba(13, 13, 13, 0.09);
    --zb-border-str: rgba(13, 13, 13, 0.16);
    --zb-txt-dim:    rgba(13, 13, 13, 0.72);
    --zb-txt-muted:  rgba(13, 13, 13, 0.38);

    /* États — versions désaturées, lisibles sur fond crème */
    --zb-vert:       #2F6F4F;
    --zb-vert-bg:    #E4F0E8;
    --zb-ambre:      #8A6410;
    --zb-ambre-bg:   #F6ECD5;
    --zb-rouge:      #A33A3A;
    --zb-rouge-bg:   #F6E1E1;

    --zb-radius:     6px;
    --zb-radius-lg:  10px;
}

/* ── Base ─────────────────────────────────────────────────────────────────── */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

main {
    flex: 1 0 auto;
}

.font-mono,
.font-mono *,
.tabular {
    font-variant-numeric: tabular-nums;
}

/* Accessibilité : anneau de focus clavier visible sur toute la marque */
*:focus-visible {
    outline: 2px solid var(--zb-rose-700);
    outline-offset: 2px;
}

/* Scrollbar discrète, accordée au fond crème */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--zb-mod-bg); }
::-webkit-scrollbar-thumb { background: var(--zb-rose-300); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--zb-rose-500); }

/* Accessibilité : lien d'évitement, visible uniquement au focus clavier */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100;
    padding: 10px 16px;
    background: var(--zb-noir);
    color: #fff;
    font-family: 'DM Mono', ui-monospace, monospace;
    font-size: 12px;
    text-decoration: none;
}

.skip-link:focus {
    left: 8px;
    top: 8px;
}

/* ── En-tête : liens de navigation ────────────────────────────────────────── */
.nav-link {
    padding: 6px 12px;
    font-family: 'DM Mono', ui-monospace, monospace;
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(13, 13, 13, 0.5);
    border-radius: 4px;
    transition: color .2s;
    text-decoration: none;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--zb-rose-700);
}

header nav a[aria-current="page"],
header nav a.active {
    color: var(--zb-rose-700);
}

/* ── En-tête : sélecteur « Nos outils » ───────────────────────────────────── */
.tool-switch {
    position: relative;
}

.tool-switch-btn {
    font-family: 'DM Mono', ui-monospace, monospace;
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(13, 13, 13, 0.5);
    background: none;
    border: 0;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: color .2s, background-color .2s;
}

.tool-switch-btn:hover,
.tool-switch-btn[aria-expanded="true"] {
    color: var(--zb-rose-700);
    background: var(--zb-mod-bg);
}

.tool-switch-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 60;
    min-width: 280px;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--zb-border);
    border-radius: var(--zb-radius-lg);
    box-shadow: 0 12px 32px rgba(13, 13, 13, 0.10);
}

.tool-switch-item {
    display: block;
    padding: 8px 10px;
    border-radius: var(--zb-radius);
    text-decoration: none;
    transition: background-color .15s;
}

.tool-switch-item:hover {
    background: var(--zb-mod-bg);
}

.tool-switch-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--zb-noir);
}

.tool-switch-blurb {
    display: block;
    font-size: 11px;
    color: var(--zb-txt-muted);
    margin-top: 1px;
}

/* ── Typographie éditoriale ───────────────────────────────────────────────── */
.title-editorial {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--zb-noir);
}

.title-editorial em {
    font-style: italic;
    color: var(--zb-rose-700);
}

.eyebrow {
    font-family: 'DM Mono', ui-monospace, monospace;
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--zb-rose-700);
}

.lede {
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--zb-txt-dim);
}

/* Cartouche de page — bandeau titre au-dessus du contenu */
.page-header {
    border-bottom: 1px solid var(--zb-border);
    background: var(--zb-bg);
}

.page-header-inner {
    max-width: 72rem;
    margin: 0 auto;
    padding: 40px 16px 32px;
}

/* ── Cartes ───────────────────────────────────────────────────────────────── */
.zb-card {
    background: #fff;
    border: 1px solid var(--zb-border);
    border-radius: var(--zb-radius-lg);
    padding: 20px 22px;
}

.zb-card-flat {
    background: var(--zb-mod-bg);
    border: 1px solid var(--zb-border);
    border-radius: var(--zb-radius-lg);
    padding: 20px 22px;
}

.zb-card-title {
    font-family: 'DM Mono', ui-monospace, monospace;
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--zb-rose-700);
    margin-bottom: 10px;
}

/* Tuile de statistique (compteurs de tête de page) */
.zb-stat {
    background: #fff;
    border: 1px solid var(--zb-border);
    border-radius: var(--zb-radius-lg);
    padding: 18px 20px;
}

.zb-stat-value {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 900;
    font-size: 2rem;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--zb-noir);
    font-variant-numeric: tabular-nums;
}

.zb-stat-label {
    font-family: 'DM Mono', ui-monospace, monospace;
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--zb-txt-muted);
    margin-top: 6px;
}

/* ── Tableaux ─────────────────────────────────────────────────────────────── */
table {
    border-spacing: 0;
}

.zb-table {
    width: 100%;
    background: #fff;
    border: 1px solid var(--zb-border);
    border-radius: var(--zb-radius-lg);
    overflow: hidden;
}

.zb-table thead th {
    font-family: 'DM Mono', ui-monospace, monospace;
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--zb-txt-muted);
    text-align: left;
    padding: 12px 16px;
    background: var(--zb-mod-bg);
    border-bottom: 1px solid var(--zb-border);
    white-space: nowrap;
}

.zb-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--zb-border);
    font-size: 14px;
    color: var(--zb-txt-dim);
}

.zb-table tbody tr:last-child td {
    border-bottom: 0;
}

.zb-table tbody tr:hover td {
    background: var(--zb-mod-bg);
    transition: background-color 0.1s ease;
}

.zb-table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Conteneur scrollable : un tableau large ne doit jamais élargir la page */
.zb-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── Badges d'état ────────────────────────────────────────────────────────── */
.zb-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-family: 'DM Mono', ui-monospace, monospace;
    font-size: 10px;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    white-space: nowrap;
}

.zb-badge-neutre  { background: var(--zb-mod-bg);   color: var(--zb-txt-dim); }
.zb-badge-succes  { background: var(--zb-vert-bg);  color: var(--zb-vert); }
.zb-badge-attente { background: var(--zb-ambre-bg); color: var(--zb-ambre); }
.zb-badge-alerte  { background: var(--zb-rouge-bg); color: var(--zb-rouge); }
.zb-badge-info    { background: var(--zb-bleu-200); color: var(--zb-bleu-700); }
.zb-badge-marque  { background: var(--zb-rose-300); color: var(--zb-rose-900); }

/* ── Formulaires ──────────────────────────────────────────────────────────── */
.zb-label {
    display: block;
    font-family: 'DM Mono', ui-monospace, monospace;
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--zb-txt-muted);
    margin-bottom: 6px;
}

.zb-input,
.zb-select {
    width: 100%;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    color: var(--zb-noir);
    background: #fff;
    border: 1px solid var(--zb-border-str);
    border-radius: var(--zb-radius);
    transition: border-color .2s, box-shadow .2s;
}

.zb-hint {
    font-size: 11px;
    color: var(--zb-txt-muted);
    margin-top: 4px;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(142, 88, 128, 0.18) !important;
    border-color: var(--zb-rose-700) !important;
}

/* Chevron rose sur les select (l'apparence native casse la charte) */
select {
    appearance: none;
    -webkit-appearance: none;
    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='%238E5880' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

input[type="range"] {
    accent-color: var(--zb-rose-700);
}

/* ── Boutons ──────────────────────────────────────────────────────────────── */
.zb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-family: 'DM Mono', ui-monospace, monospace;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    border: 1px solid var(--zb-noir);
    border-radius: var(--zb-radius);
    background: var(--zb-noir);
    color: #fff;
    cursor: pointer;
    text-decoration: none;
    transition: background-color .2s, color .2s, border-color .2s;
}

.zb-btn:hover {
    background: var(--zb-rose-900);
    border-color: var(--zb-rose-900);
}

.zb-btn-ghost {
    background: transparent;
    color: var(--zb-noir);
    border-color: var(--zb-border-str);
}

.zb-btn-ghost:hover {
    background: var(--zb-mod-bg);
    color: var(--zb-rose-700);
    border-color: var(--zb-rose-700);
}

.zb-btn:disabled,
.zb-btn[aria-disabled="true"] {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Onglets (mortgage_calculator, next_tracker) */
.zb-tab {
    padding: 10px 16px;
    font-family: 'DM Mono', ui-monospace, monospace;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--zb-txt-muted);
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color .2s, border-color .2s;
}

.zb-tab:hover {
    color: var(--zb-rose-700);
}

.zb-tab.active,
.zb-tab[aria-selected="true"] {
    color: var(--zb-noir);
    border-bottom-color: var(--zb-rose-700);
}

/* ── Liens de contenu ─────────────────────────────────────────────────────── */
.zb-link {
    color: var(--zb-rose-700);
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-thickness: 1px;
    transition: color .2s;
}

.zb-link:hover {
    color: var(--zb-noir);
}

/* ── Animations ───────────────────────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0);    }
}

.zb-fade-in {
    animation: fadeInUp 0.3s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Impression ───────────────────────────────────────────────────────────── */
@media print {
    header,
    footer,
    .tool-switch,
    .no-print {
        display: none !important;
    }

    body {
        font-size: 11pt;
        color: #000;
        background: #fff;
    }

    .zb-card,
    .zb-table {
        border-color: #ccc;
        box-shadow: none;
    }

    table {
        font-size: 10pt;
    }
}
