/* ============================================================
   Page /demos — s'appuie sur css/home.css (variables et base).
   ============================================================ */

/* ---- En-tête de page (même papier quadrillé que l'accueil) ---- */
.page-intro {
    position: relative;
    padding: clamp(8rem, 14vw, 10rem) 0 clamp(2.5rem, 5vw, 3.5rem);
}
.page-intro::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(23, 23, 26, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(23, 23, 26, 0.035) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: linear-gradient(180deg, #000 45%, transparent 100%);
    -webkit-mask-image: linear-gradient(180deg, #000 45%, transparent 100%);
}
.page-intro h1 { font-size: clamp(2.1rem, 5.4vw, 3.4rem); }

/* ---- Blocs communs des démos ---- */
.demo-bloc { margin-top: 2.5rem; }

.demo-controles {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem 2.25rem;
    align-items: flex-end;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}
.controle label {
    display: block;
    font-size: .92rem;
    color: var(--muted);
    margin-bottom: .5rem;
}
.controle input[type="range"] {
    width: 220px;
    accent-color: var(--accent);
    display: block;
}
.controle input[type="number"],
.controle input[type="text"] {
    width: 120px;
    padding: .55rem .7rem;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: .95rem;
    color: var(--text);
}
.controle input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(30, 63, 174, 0.14); }
.controle-case label {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin-bottom: 0;
    color: var(--text);
    cursor: pointer;
}
.controle-case input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); }

/* ---- Indicateur de chargement ---- */
.chargement {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 1.5rem 0 0;
    color: var(--muted);
    font-family: var(--mono);
    font-size: .85rem;
}
.rouet {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    border: 2px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: rouet .8s linear infinite;
}
@keyframes rouet { to { transform: rotate(360deg); } }

/* ---- Bandeaux de résultats et messages ---- */
.demo-resultat {
    font-family: var(--mono);
    font-size: .92rem;
    color: var(--text);
    margin: 1.5rem 0 0;
}
.demo-resultat strong { color: var(--accent); font-weight: 600; }
.compteur { font-size: 1.02rem; }
.economie { color: var(--accent); font-weight: 600; }
.demo-message {
    background: var(--accent-tint);
    border: 1px solid rgba(30, 63, 174, 0.3);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin: 1.5rem 0 0;
    color: var(--text);
}

/* ---- Phrase-pont ---- */
.pont {
    margin: 2.75rem 0 1.5rem;
    font-weight: 600;
    font-size: 1.1rem;
    line-height: 1.55;
    color: var(--text);
    border-left: 3px solid var(--accent);
    padding-left: 1.2rem;
    max-width: 62ch;
}

/* ============================================================
   Démo 1 — Horaire
   ============================================================ */
.horaire-flex {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    margin-top: 1.75rem;
}
.horaire-grille-wrap { flex: 1; min-width: 0; overflow-x: auto; }
.horaire-grille {
    border-collapse: collapse;
    width: 100%;
    background: var(--surface);
}
.horaire-grille th,
.horaire-grille td {
    border: 1px solid var(--border);
    padding: .55rem .6rem;
    text-align: left;
    vertical-align: top;
    min-width: 104px;
}
.horaire-grille thead th {
    font-family: var(--mono);
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--faint);
    background: var(--bg-soft);
}
.horaire-grille tbody th {
    font-family: var(--mono);
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--faint);
    background: var(--bg-soft);
    min-width: 0;
}
.pastille {
    display: inline-flex;
    align-items: center;
    gap: .38rem;
    font-size: .84rem;
    margin: .12rem .45rem .12rem 0;
    white-space: nowrap;
    color: var(--text);
}
.pastille::before {
    content: '';
    width: 9px;
    height: 9px;
    background: var(--c, var(--accent));
    flex-shrink: 0;
}
.horaire-legende {
    width: 250px;
    flex-shrink: 0;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    font-size: .88rem;
}
.horaire-legende h4 {
    margin: 0 0 .9rem;
    font-size: .78rem;
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--faint);
    font-weight: 500;
}
.horaire-legende ul { list-style: none; margin: 0; padding: 0; }
.horaire-legende li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: .6rem;
    margin-bottom: .45rem;
}
.legende-note { color: var(--muted); font-size: .8rem; text-align: right; }
.legende-regles {
    margin: 1rem 0 0;
    padding-top: .9rem;
    border-top: 1px dashed var(--border-strong);
    color: var(--faint);
    font-size: .8rem;
}

/* ============================================================
   Démo 2 — Tournée
   ============================================================ */
.carte-tournee {
    height: 460px;
    margin-top: 1.75rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    position: relative;
    z-index: 0; /* garde les contrôles Leaflet sous la barre de navigation */
    background: var(--bg-soft);
}
.carte-note {
    font-family: var(--mono);
    font-size: .78rem;
    color: var(--faint);
    margin: .7rem 0 0;
}
.controle-cout input { width: 90px; }

/* ============================================================
   Démo 3 — Découpe
   ============================================================ */
.decoupe-controles { align-items: flex-start; }
.coupe-liste { flex: 1; min-width: 260px; }
.coupe-table { border-collapse: collapse; margin-bottom: .9rem; }
.coupe-table th {
    font-family: var(--mono);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--faint);
    font-weight: 500;
    text-align: left;
    padding: 0 .75rem .45rem 0;
}
.coupe-table td { padding: 0 .75rem .55rem 0; vertical-align: middle; }
.coupe-table input[type="text"] {
    width: 110px;
    padding: .5rem .65rem;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: .95rem;
}
.coupe-qte { white-space: nowrap; }
.coupe-qte span { display: inline-block; min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; }
.btn-qte {
    width: 30px;
    height: 30px;
    background: var(--bg-soft);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    color: var(--text);
}
.btn-qte:hover { border-color: var(--accent); color: var(--accent); }
.btn-retirer {
    width: 30px;
    height: 30px;
    background: transparent;
    border: 0;
    cursor: pointer;
    font-size: 1.15rem;
    color: var(--faint);
}
.btn-retirer:hover { color: var(--accent-deep); }
.decoupe-reglages { display: flex; flex-direction: column; gap: 1.1rem; min-width: 210px; }
.reglage-avance summary {
    cursor: pointer;
    font-size: .85rem;
    color: var(--faint);
    user-select: none;
}
.reglage-avance[open] summary { margin-bottom: .7rem; }

.onglets { display: flex; gap: .6rem; margin-top: 1.75rem; }
.onglet {
    font-family: inherit;
    font-size: .88rem;
    font-weight: 600;
    padding: .55rem 1rem;
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all .2s ease;
}
.onglet:hover { border-color: var(--text); color: var(--text); }
.onglet.actif {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.svg-decoupe {
    display: block;
    width: 100%;
    height: auto;
    margin-top: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.barre-fond { fill: var(--bg-soft); stroke: var(--border-strong); stroke-width: 1; }
.seg-texte {
    fill: #fff;
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 600;
}
.chute-texte {
    fill: var(--faint);
    font-family: var(--mono);
    font-size: 12px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 880px) {
    .horaire-flex { flex-direction: column; }
    .horaire-legende { width: 100%; }
    .carte-tournee { height: 380px; }
    .decoupe-controles { flex-direction: column; }
}
