@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&display=swap');

:root {
    --ink-900: #182828;
    --sage-600: #4b5142;
    --sage-300: #a9af9c;
    --cream-100: #f7f5ef;
    --surface-white: #ffffff;

    --radius-md: 16px;

    --font-famille: 'Open Sans', system-ui, sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-famille);
    font-weight: 400;
    background: var(--cream-100);
    color: var(--ink-900);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-famille);
    font-weight: 700;
}

h1:focus {
    outline: none;
}

a {
    color: var(--ink-900);
}

/* Écran plein cadre, fond sombre immersif (page de garde, transitions) */
.ecran-immersif {
    position: relative;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: var(--ink-900) url('img/vegetation.jpg') center / cover no-repeat;
    color: var(--surface-white);
    padding: 2rem;
}

/* Écran vertical (téléphone, tablette en portrait) : la version portrait de Carine, recadrée sur la
   droite de la scène (bananiers, oiseau de paradis), plutôt que le centre du panorama (le lac).
   Ses feuilles claires passent derrière le texte : léger voile sombre pour garder la lisibilité. */
@media (orientation: portrait) {
    .ecran-immersif {
        background-image:
            linear-gradient(rgba(24, 40, 40, 0.38), rgba(24, 40, 40, 0.38)),
            url('img/vegetation-portrait.webp');
    }
}

.ecran-immersif > * {
    position: relative;
    z-index: 1;
}

/* Filigrane du wordmark, derrière le contenu textuel */
.filigrane {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}

/* Carte de contenu (questionnaire, résultats) : fond blanc, coins arrondis, sur fond crème */
.carte {
    background: var(--surface-white);
    border-radius: var(--radius-md);
    padding: 2.5rem;
    max-width: 640px;
    margin: 2rem auto;
    box-shadow: 0 4px 24px rgba(24, 40, 40, 0.08);
}

/* Amorce au-dessus d'un titre (nom de section, "REVEAL", contexte...) */
.amorce {
    display: block;
    font-style: normal;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--sage-600);
    margin: 0 0 1.25rem;
}

/* Écran clair plein cadre (aperçu des dimensions) : pas de carte, contenu aligné à gauche */
.ecran-clair {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem;
}

.ecran-clair .contenu {
    max-width: 640px;
    margin: 0 auto;
    width: 100%;
}

/* Liste numérotée des dimensions */
.liste-dimensions {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0 2rem;
}

.liste-dimensions li {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    padding: 0.875rem 0;
    border-bottom: 1px solid rgba(24, 40, 40, 0.08);
    font-weight: 600;
}

.liste-dimensions .numero {
    font-weight: 700;
    font-size: 0.8125rem;
    color: var(--sage-600);
    min-width: 1.5rem;
}

/* Bouton principal : libellé + flèche cerclée en contour, jamais de fond plein */
.bouton-principal {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: transparent;
    border: none;
    font-family: var(--font-famille);
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    padding: 0.5rem 0;
}

.fleche {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    border: 1.5px solid currentColor;
}

.bouton-principal:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Variante empilée : libellé au-dessus, pilule flèche seule en dessous, centré (page de garde) */
.bouton-principal--pile {
    flex-direction: column;
    gap: 1rem;
}

.fleche--pilule {
    width: 4rem;
    height: 2.5rem;
    border-radius: 999px;
}

/* Sur fond sombre (ecran-immersif), le bouton est blanc ; sur fond clair, ink-900 */
.ecran-immersif .bouton-principal {
    color: var(--surface-white);
}

.carte .bouton-principal {
    color: var(--ink-900);
}

/* Bouton plein : action principale (Suivant, C'est parti) */
.bouton-plein {
    display: block;
    width: 100%;
    margin-top: 1.5rem;
    background: var(--ink-900);
    color: var(--surface-white);
    border: none;
    border-radius: 999px;
    font-family: var(--font-famille);
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    padding: 0.875rem 1.5rem;
}

.bouton-plein:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.aide-navigation {
    text-align: center;
    font-size: 0.8125rem;
    color: var(--sage-600);
    margin: 0.875rem 0 0;
}

/* Bouton retour : icône flèche seule, dans l'en-tête de progression */
.bouton-retour {
    background: transparent;
    border: none;
    padding: 0;
    margin-bottom: 1rem;
    cursor: pointer;
    color: var(--ink-900);
}

/* En-tête de progression (dimension/question courante) */
.label-progression {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--sage-600);
    margin: 0 0 0.5rem;
}

.barre-progression {
    height: 6px;
    border-radius: 999px;
    background: var(--cream-100);
    overflow: hidden;
    margin: 0 0 1.5rem;
}

.barre-progression span {
    display: block;
    height: 100%;
    background: var(--ink-900);
    border-radius: 999px;
    transition: width 0.2s ease;
}

fieldset {
    border: none;
    padding: 0;
    margin: 0 0 1.5rem;
}

/* Page d'admin : carte plus large, sections par dimension repliables */
.carte--admin {
    max-width: 900px;
}

.section-admin {
    border: 1px solid var(--sage-300);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.section-admin summary {
    font-weight: 700;
    cursor: pointer;
}

.section-admin fieldset {
    border-top: 1px solid rgba(24, 40, 40, 0.08);
    padding-top: 1rem;
    margin-top: 1rem;
}

.section-admin fieldset:first-of-type {
    border-top: none;
    padding-top: 0.5rem;
}

.option-edition {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.option-edition input[type="text"] {
    flex: 1;
}

.option-edition input[type="number"] {
    width: 5rem;
}

.bouton-supprimer {
    background: transparent;
    border: 1.5px solid var(--sage-300);
    border-radius: 8px;
    width: 2.5rem;
    font-size: 1.125rem;
    line-height: 1;
    cursor: pointer;
    color: var(--ink-900);
}

.bouton-supprimer:hover {
    border-color: #e50000;
    color: #e50000;
}

.bouton-discret {
    display: block;
    background: transparent;
    border: 1.5px dashed var(--sage-300);
    border-radius: 12px;
    padding: 0.625rem 1rem;
    margin: 0.5rem 0;
    font-family: var(--font-famille);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--sage-600);
    cursor: pointer;
}

.bouton-discret:hover {
    border-color: var(--sage-600);
}

.bouton-discret--danger {
    color: #e50000;
    border-style: solid;
    border-color: transparent;
}

.bouton-danger {
    background: #e50000;
    color: var(--surface-white);
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-family: var(--font-famille);
    font-weight: 600;
    cursor: pointer;
}

.condition-affichage {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1rem 0;
}

.condition-affichage label {
    flex: 1;
    min-width: 12rem;
}

.confirmation-suppression {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    background: var(--cream-100);
    border-radius: 12px;
    padding: 0.75rem 1rem;
}

legend {
    font-weight: 600;
    font-size: 1.25rem;
    line-height: 1.4;
    margin-bottom: 1.25rem;
    padding: 0;
}

/* Options (choix unique / multiple) : une rangée cliquable par option */
.option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border: 1.5px solid var(--sage-300);
    border-radius: 12px;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.option:hover {
    border-color: var(--sage-600);
}

.option:has(input:checked) {
    border-color: var(--sage-600);
    background: var(--cream-100);
}

/* Choix multiple limité : la limite est annoncée, les réponses hors limite sont grisées */
.aide-choix {
    font-size: 0.8125rem;
    color: var(--sage-600);
    margin: 0 0 0.75rem;
}

.option:has(input:disabled) {
    opacity: 0.5;
    cursor: not-allowed;
}

.option:has(input:disabled):hover {
    border-color: var(--sage-300);
}

.option input[type="radio"],
.option input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
    accent-color: var(--sage-600);
}

/* Échelle 0-10 : pastilles rondes, état actif plein. 11 graduations sur une ligne ;
   sur mobile, deux rangées équilibrées (6 + 5) plutôt qu'un « 10 » orphelin. */
.echelle {
    display: grid;
    grid-template-columns: repeat(11, minmax(0, 2.75rem));
    gap: 0.4rem;
    margin: 0.5rem 0 1rem;
}

@media (max-width: 520px) {
    .echelle {
        grid-template-columns: repeat(6, 2.75rem);
    }
}

.point {
    width: 100%;
    aspect-ratio: 1;
    padding: 0;
    border-radius: 50%;
    border: 1.5px solid var(--sage-300);
    background: var(--surface-white);
    color: var(--ink-900);
    font-family: var(--font-famille);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.point:hover {
    border-color: var(--sage-600);
}

.point.actif {
    background: var(--sage-600);
    border-color: var(--sage-600);
    color: var(--surface-white);
}

/* Champs texte libres */
fieldset input[type="text"],
fieldset input[type="number"],
fieldset input[type="email"],
fieldset input[type="password"],
fieldset select,
fieldset textarea,
input[type="password"],
select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--sage-300);
    border-radius: 12px;
    font-family: var(--font-famille);
    font-size: 1rem;
    color: var(--ink-900);
    background: var(--surface-white);
}

fieldset textarea {
    min-height: 6rem;
    resize: vertical;
}

fieldset input[type="text"]:focus,
fieldset input[type="number"]:focus,
fieldset input[type="email"]:focus,
fieldset input[type="password"]:focus,
fieldset select:focus,
fieldset textarea:focus,
input[type="password"]:focus,
select:focus {
    outline: none;
    border-color: var(--sage-600);
}

/* Navigation Précédent / Suivant */
.navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(24, 40, 40, 0.08);
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-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zEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

/* ---------- Rapport REVEAL (fin de parcours) ---------- */
.ecran-clair .contenu--rapport {
    max-width: 720px;
}

.rapport-etat {
    font-size: 0.9rem;
    color: var(--sage-600);
    margin: 0 0 1rem;
}

.rapport {
    display: grid;
    gap: 2.25rem;
    line-height: 1.6;
}

.rapport h1 {
    font-size: clamp(1.6rem, 4.5vw, 2.1rem);
    line-height: 1.2;
    margin: 0;
    text-wrap: balance;
}

.rapport h2 {
    font-size: 1.25rem;
    margin: 0;
}

.rapport h3 {
    font-size: 1.05rem;
    margin: 0;
}

.rapport p,
.rapport ul {
    margin: 0;
}

.rapport ul {
    padding-left: 1.25rem;
}

.rapport-entete {
    display: grid;
    gap: 0.5rem;
}

.rapport-entete .amorce {
    margin: 0;
}

.rapport-identite {
    color: var(--sage-600);
}

.rapport-imprimer {
    justify-self: start;
}

.rapport-bloc {
    display: grid;
    gap: 0.9rem;
}

.rapport-bloc > p + p,
.rapport-bloc ul + p {
    margin-top: 0.25rem;
}

.rapport-cadre {
    font-size: 0.92rem;
    color: var(--sage-600);
}

.rapport-securite {
    border-left: 3px solid var(--sage-300);
    padding: 0.25rem 0 0.25rem 1rem;
    color: var(--ink-900);
}

.rapport-securite--renforcee {
    border-left-color: var(--ink-900);
    background: var(--surface-white);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.rapport-aide {
    color: var(--sage-600);
    font-size: 0.92rem;
}

.rapport-declare {
    display: grid;
    gap: 0.25rem 0;
    margin: 0;
}

.rapport-declare dt {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--sage-600);
    margin-top: 0.5rem;
}

.rapport-declare dd {
    margin: 0;
    font-style: italic;
}

/* Radar : SVG + légende ; côte à côte sur grand écran, empilés sur mobile */
.radar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 1.5rem;
    align-items: center;
}

@media (max-width: 620px) {
    .radar {
        grid-template-columns: minmax(0, 1fr);
    }
}

.radar svg {
    width: 100%;
    max-width: 420px;
    justify-self: center;
}

.radar-grille {
    fill: none;
    stroke: var(--sage-300);
    stroke-width: 1;
    opacity: 0.6;
}

.radar-rayon {
    stroke: var(--sage-300);
    stroke-width: 1;
    opacity: 0.6;
}

.radar-zone {
    fill: var(--sage-600);
    fill-opacity: 0.18;
    stroke: var(--sage-600);
    stroke-width: 2;
    stroke-linejoin: round;
}

.radar-point {
    fill: var(--sage-600);
}

.radar-etiquette {
    fill: var(--ink-900);
    font-family: var(--font-famille);
    font-size: 13px;
    font-weight: 600;
}

.radar-legende {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.6rem;
}

.radar-legende li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 0.6rem;
    align-items: baseline;
}

.radar-legende-axe {
    font-weight: 600;
}

.radar-legende-score {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.radar-legende-score small {
    font-weight: 400;
    color: var(--sage-600);
}

.radar-legende-niveau {
    grid-column: 1 / -1;
    font-size: 0.8rem;
    color: var(--sage-600);
}

.radar-legende-niveau.niveau-eleve,
.radar-legende-niveau.niveau-treseleve {
    color: var(--ink-900);
    font-weight: 600;
}

/* Une carte par élément d'un bloc du rapport : axe principal, thème déclaré, cascade, mode, piste, point d'appui */
.rapport-cartes {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 1rem;
}

.rapport-carte {
    background: var(--surface-white);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.4rem;
    display: grid;
    gap: 0.6rem;
}

.rapport-priorite-entete {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.25rem 1rem;
}

.rapport-priorite-score {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--sage-600);
    font-variant-numeric: tabular-nums;
}

.rapport-lettre {
    border-top: 1px solid var(--sage-300);
    padding-top: 1.75rem;
}

/* Synthèse pour la consultation médicale : dernière page, sobre, à imprimer */
.rapport-medicale {
    border-top: 1px solid var(--sage-300);
    padding-top: 1.75rem;
}

.rapport-medicale h3 {
    font-size: 1rem;
    margin: 1rem 0 0.25rem;
}

.rapport-medicale-lignes {
    margin: 0;
    padding-left: 1.2rem;
}

/* Enregistrement en PDF : impression du navigateur, sans les commandes */
@media print {
    body {
        background: #fff;
    }

    .ecran-clair {
        min-height: 0;
        padding: 0;
    }

    .rapport-imprimer,
    .rapport-etat,
    .filigrane {
        display: none;
    }

    .rapport-carte {
        border: 1px solid var(--sage-300);
        break-inside: avoid;
    }

    .rapport-medicale {
        break-before: page;
        border-top: none;
        font-size: 0.85rem;
    }

    .radar {
        break-inside: avoid;
    }
}
