/* ACOUSTICALC — habillage (complète Bootstrap 5).
   Code couleur repris des classeurs : jaune = saisie, gris = intermédiaire, vert = résultat, bleu foncé = titres. */

:root {
    --bleu: #1f3864;
    --bleu-clair: #dbe5f1;
    --saisie: #fff9d6;
    --saisie-bord: #e3cf6d;
    --intermediaire: #f1f2f4;
    --resultat: #e2f0d9;
    --resultat-bord: #a9cf93;
    --vert: #2e7d32;
    --jaune: #8a6d00;
    --orange: #c55a11;
    --rouge: #c00000;
}

body {
    background: #f5f6f8;
    font-size: 0.925rem;
}

/* --- Navigation ------------------------------------------------------------ */
.barre-principale {
    background: var(--bleu);
}

.navbar-brand,
.marque {
    font-weight: 700;
    letter-spacing: 0.04em;
}

.marque {
    color: var(--bleu);
}

.pied {
    padding: 1rem 0.75rem 2rem;
    border-top: 1px solid #dee2e6;
    margin-top: 2rem;
}

/* --- Connexion ------------------------------------------------------------- */
.page-connexion {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(160deg, var(--bleu) 0%, #2f5597 100%);
}

.connexion {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.page-connexion .text-muted.text-center {
    color: rgba(255, 255, 255, 0.75) !important;
}

/* --- Accueil --------------------------------------------------------------- */
.entete-accueil {
    background: var(--bleu);
    color: #fff;
    border-radius: 0.5rem;
    padding: 1.25rem 1.5rem;
}

.titre-categorie {
    color: var(--bleu);
    border-bottom: 2px solid var(--bleu);
    padding-bottom: 0.25rem;
}

.carte-module {
    text-decoration: none;
    color: inherit;
    border-left: 4px solid var(--bleu);
    transition: box-shadow 0.15s, transform 0.15s;
}

.carte-module:hover,
.carte-module:focus-visible {
    box-shadow: 0 0.35rem 0.9rem rgba(31, 56, 100, 0.18);
    transform: translateY(-1px);
}

.carte-module h3 {
    color: var(--bleu);
}

.legende-couleurs .pastille {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 0.25rem;
    margin-right: 0.35rem;
    border: 1px solid #ced4da;
}

/* --- Modules --------------------------------------------------------------- */
.barre-module {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: #f5f6f8;
    padding: 0.6rem 0;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 0.75rem;
}

.liste-etudes {
    max-height: 60vh;
    overflow-y: auto;
    min-width: 18rem;
}

.titre-module {
    margin-bottom: 1rem;
}

.titre-module h1 {
    color: var(--bleu);
}

.section {
    margin-bottom: 1rem;
    border-color: #d5d9e0;
}

.section > .card-header,
.titre-bloc {
    background: var(--bleu);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    margin: 0;
    padding: 0.5rem 0.9rem;
}

.titre-bloc {
    border-radius: 0.375rem;
    margin: 1.25rem 0 0.75rem;
}

.section-avis > .card-header {
    background: #385723;
}

.ligne {
    margin-bottom: 0.4rem;
}

.ligne .col-form-label {
    padding-top: 0.15rem;
    padding-bottom: 0.15rem;
}

/* Cellules : saisie (jaune), intermédiaire (gris), résultat (vert) */
.saisie,
.saisie:focus {
    background-color: var(--saisie);
    border-color: var(--saisie-bord);
}

.pastille.saisie {
    background: var(--saisie);
}

.intermediaire {
    background: var(--intermediaire);
}

.resultat,
div.intermediaire {
    border-radius: 0.25rem;
    padding: 0.25rem 0.6rem;
    min-height: 1.95rem;
    font-variant-numeric: tabular-nums;
}

.resultat {
    background: var(--resultat);
    border: 1px solid var(--resultat-bord);
    font-weight: 600;
}

div.intermediaire {
    border: 1px solid #dcdfe4;
}

.resultat-cellule {
    background: var(--resultat);
    font-weight: 600;
}

td.coefficient {
    background: var(--bleu-clair);
}

.unite {
    font-weight: 400;
    font-size: 0.85em;
    color: #555;
}

.grand-resultat {
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--bleu);
    font-variant-numeric: tabular-nums;
}

.grand-resultat .unite {
    font-size: 1rem;
}

/* États 🟢🟡🟠🔴 */
.etat {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 0.3rem;
    font-weight: 600;
    font-size: 0.875rem;
    border: 1px solid transparent;
}

.etat-vert { background: #e2f0d9; border-color: #a9cf93; color: #1e4d20; }
.etat-jaune { background: #fff2cc; border-color: #e8cf7a; color: #5c4700; }
.etat-orange { background: #fbe5d6; border-color: #f0b48a; color: #7a3a0b; }
.etat-rouge { background: #f8d7da; border-color: #e9a1a8; color: #7a0c14; }
.etat-neutre { background: var(--intermediaire); border-color: #dcdfe4; }

.recommandation {
    border-left: 4px solid var(--bleu);
    background: #eef2f8;
    padding: 0.6rem 0.9rem;
    border-radius: 0 0.25rem 0.25rem 0;
}

.recommandation.etat-vert { border-left-color: var(--vert); background: #eef7ea; }
.recommandation.etat-jaune { border-left-color: #d4a900; background: #fff8e1; }
.recommandation.etat-orange { border-left-color: var(--orange); background: #fdf1e8; }
.recommandation.etat-rouge { border-left-color: var(--rouge); background: #fcebed; }

.avis {
    font-size: 0.95rem;
    line-height: 1.55;
}

/* Tableaux de calcul */
.tableau-calcul,
.tableau-registre,
.tableau-reference {
    font-size: 0.82rem;
    background: #fff;
}

.tableau-calcul thead th,
.tableau-registre thead th,
.tableau-reference thead th {
    background: var(--bleu-clair);
    vertical-align: middle;
    white-space: nowrap;
}

.tableau-calcul td.calcule {
    min-width: 3.2rem;
    font-variant-numeric: tabular-nums;
}

.col-element { min-width: 8.5rem; }
.col-materiau { min-width: 15rem; }
.col-quantite { min-width: 6.5rem; }
.col-court { min-width: 4.5rem; }

.tableau-reference tr.categorie th {
    background: var(--bleu);
    color: #fff;
    font-weight: 600;
}

.tableau-registre .alertes .etat {
    font-size: 0.75rem;
    margin-bottom: 0.15rem;
    white-space: nowrap;
}

/* Sources de bruit : le bloc non retenu est atténué */
.source-inactive {
    opacity: 0.6;
}

.source-inactive:hover,
.source-inactive:focus-within {
    opacity: 1;
}

.source-active.section,
.bloc-aeroport.source-active .section {
    border-color: var(--bleu);
}

/* Indice de qualité */
.indice {
    height: 1.4rem;
}

.indice-valeur {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-top: 0.5rem;
}

.indice-appreciation {
    text-align: center;
    font-size: 1.15rem;
    font-weight: 600;
}

/* Tableau de bord du registre */
.indicateur {
    background: #fff;
    border: 1px solid #d5d9e0;
    border-left: 4px solid var(--bleu);
    border-radius: 0.3rem;
    padding: 0.5rem 0.75rem;
    height: 100%;
}

.indicateur .valeur {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--bleu);
    line-height: 1.1;
}

.indicateur .libelle {
    font-size: 0.78rem;
    color: #555;
}

.lien-registre {
    background: #e8f1fb;
    border: 1px solid #b6cfee;
    border-radius: 0.3rem;
    padding: 0.6rem 0.75rem;
}

.questions li {
    padding: 0.15rem 0;
}

.graphique-cadre {
    position: relative;
    width: 100%;
}

/* Schéma de l'écran antibruit */
.schema-ecran {
    width: 100%;
    max-height: 220px;
    font-size: 11px;
}

.schema-ecran .sol { stroke: #555; stroke-width: 2; }
.schema-ecran .ecran { fill: #7f7f7f; }
.schema-ecran .batiment { fill: var(--bleu-clair); stroke: var(--bleu); }
.schema-ecran .source { fill: var(--rouge); }
.schema-ecran .recepteur { fill: var(--bleu); }
.schema-ecran .trajet { fill: none; stroke: var(--orange); stroke-width: 1.5; }
.schema-ecran .direct { stroke: #999; stroke-width: 1; stroke-dasharray: 4 3; }

/* --- Guide utilisateur ----------------------------------------------------- */
.sommaire-aide {
    background: #fff;
    border: 1px solid #d5d9e0;
    border-radius: 0.375rem;
    overflow: hidden;
}

@media (min-width: 992px) {
    .sommaire-aide {
        position: sticky;
        top: 1rem;
    }
}

.sommaire-titre {
    background: var(--bleu);
    color: #fff;
    font-weight: 600;
    padding: 0.5rem 0.9rem;
}

.sommaire-rubrique {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #5b6472;
    padding: 0.7rem 0.9rem 0.25rem;
}

.sommaire-aide .list-group-item {
    border: 0;
    padding: 0.35rem 0.9rem;
}

.sommaire-aide .list-group-item.active {
    background: var(--bleu-clair);
    color: var(--bleu);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--bleu);
}

.aide {
    max-width: 54rem;
    line-height: 1.6;
}

.aide h1 {
    color: var(--bleu);
}

.aide h2 {
    font-size: 1.15rem;
    color: var(--bleu);
    border-bottom: 1px solid #d5d9e0;
    padding-bottom: 0.25rem;
    margin-top: 1.75rem;
}

.aide h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 1.25rem;
}

.aide .chapeau {
    font-size: 1.02rem;
    color: #3a424e;
}

.aide thead th {
    background: var(--bleu-clair);
}

.aide .note {
    border-left: 4px solid var(--bleu);
    background: #eef2f8;
    padding: 0.6rem 0.9rem;
    border-radius: 0 0.25rem 0.25rem 0;
    margin: 1rem 0;
}

.aide .note-alerte {
    border-left-color: #d4a900;
    background: #fff8e1;
}

.aide .formule {
    font-family: SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9rem;
    background: var(--intermediaire);
    border-radius: 0.25rem;
    padding: 0.4rem 0.75rem;
    overflow-x: auto;
}

.legende-aide li {
    margin-bottom: 0.35rem;
}

.legende-aide .pastille {
    display: inline-block;
    min-width: 4rem;
    text-align: center;
    padding: 0.1rem 0.5rem;
    border-radius: 0.25rem;
    border: 1px solid #ced4da;
    margin-right: 0.4rem;
}

/* --- Impression (rapport) -------------------------------------------------- */
@media print {
    body {
        background: #fff;
        font-size: 0.8rem;
    }

    .section {
        break-inside: avoid;
    }

    .source-inactive {
        opacity: 1;
    }

    .saisie,
    .resultat,
    .etat,
    .section > .card-header,
    .titre-bloc {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
