/* ==========================================================================
   SeeU — Feuille de styles principale
   CDC §4.2 : mobile-first, un seul code pour smartphone, tablette et desktop.
   CDC §4.3 : interface moderne, claire, rassurante, sans surcharge graphique.

   Organisation :
     1. Jetons de design
     2. Réinitialisation
     3. Structure
     4. Composants
     5. Utilitaires
     6. Points de rupture
   ========================================================================== */

/* 1. Jetons de design ---------------------------------------------------- */

:root {
    /* Couleurs reprises du logo SeeU (dégradé teal → violet → magenta).
       Échantillonnées sur dossier_cdc/SeeU_logo.png : le teal de tête vaut
       #01a084, mais il ne tient que 3,3:1 sur blanc — insuffisant derrière du
       texte blanc. Il est donc assombri en #07775f, qui donne 5,5:1 (AA).
       Vérifiable par : php tests/helpers/contrast.php */
    --color-brand:        #07775f;
    --color-brand-dark:   #055c49;
    --color-brand-light:  #e4f4f0;

    /* Fin du dégradé. Le magenta du logo (#e92377) plafonne à 4,2:1 : la
       variante assombrie est la seule utilisable derrière du texte blanc.
       Le violet médian sert aux aplats décoratifs.
       L'ancien accent orange a disparu avec l'ancien logo. */
    --color-accent-magenta: #c4176a;
    --color-accent-violet:  #715f88;

    --color-text:         #1b1e23;
    --color-text-muted:   #6b7280;
    --color-border:       #e2e5ea;
    --color-surface:      #ffffff;
    --color-background:   #f6f7f9;

    --color-success:      #1f7a4d;
    --color-success-bg:   #e6f4ec;
    --color-warning:      #8a5b00;
    --color-warning-bg:   #fdf3e0;
    --color-error:        #b3261e;
    --color-error-bg:     #fdeceb;
    --color-info:         #14558a;
    --color-info-bg:      #e8f1f8;

    --radius-sm:   6px;
    --radius-md:  10px;
    --radius-lg:  16px;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;

    --shadow-sm: 0 1px 2px rgba(27, 30, 35, 0.06);
    --shadow-md: 0 2px 12px rgba(27, 30, 35, 0.08);

    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --header-height: 72px;
    --bottom-nav-height: 60px;
    --content-max: 1100px;
}

/* 2. Réinitialisation ---------------------------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-background);

    /* Réserve la place de la navigation inférieure mobile. */
    padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
}

h1, h2, h3, h4 {
    margin: 0 0 var(--space-3);
    line-height: 1.25;
    font-weight: 600;
}

p {
    margin: 0 0 var(--space-4);
}

a {
    color: var(--color-brand);
}

img {
    max-width: 100%;
    height: auto;
}

/* Visible au clavier uniquement : indispensable à l'accessibilité. */
:focus-visible {
    outline: 3px solid var(--color-brand);
    outline-offset: 2px;
}

/* 3. Structure ----------------------------------------------------------- */

.header {
    position: sticky;
    top: 0;
    z-index: 20;
    height: var(--header-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.header__inner {
    max-width: var(--content-max);
    height: 100%;
    margin: 0 auto;
    padding: 0 var(--space-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.header__brand {
    display: inline-flex;
    align-items: center;
    flex: none;
    text-decoration: none;
}

/* Le logo est une composition VERTICALE : broche au-dessus, mot en dessous.
   À 32 px — la hauteur de l'ancien logo horizontal — le mot « SeeU » ne
   mesurerait que 8 px et serait illisible. La barre passe donc à 72 px de haut
   pour lui laisser 50 px, soit 11 px de respiration au-dessus et en dessous.
   Le fichier est servi en 119 x 128 (2,6x) pour rester net sur écran haute
   densité ; c'est le CSS qui fixe la taille d'affichage. */
.header__brand img {
    height: 50px;
    width: auto;
    display: block;
}

.main {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--space-5) var(--space-4);
}

.footer {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--space-5) var(--space-4) var(--space-6);
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.footer p {
    margin: 0;
}

.footer__links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
    margin-bottom: var(--space-3);
}

/* Liens du pied de page : vert du site, sans soulignement (souligné seulement
   au survol et au clavier, pour rester repérables). */
.footer__links a {
    color: var(--color-brand);
    text-decoration: none;
}

.footer__links a:hover,
.footer__links a:focus-visible {
    text-decoration: underline;
}

/* Bandeau d'information ---------------------------------------------------
   Fixe en bas, au-dessus du contenu mais SANS voile : il informe, il ne
   bloque pas. Un bandeau modal pour un cookie de session serait une entrave
   disproportionnee - et pousse a cliquer n'importe quoi pour s'en debarrasser.

   La marge basse laisse passer la navigation inferieure du mobile, qui occupe
   deja le bas de l'ecran. */
.cookie-notice {
    position: fixed;
    left: var(--space-3);
    right: var(--space-3);
    /* Mobile d abord : la navigation inferieure occupe le bas de l ecran, le
       bandeau se pose au-dessus. Le decalage est retire au point de rupture
       tablette, ou cette navigation disparait. */
    bottom: calc(var(--bottom-nav-height) + var(--space-2));
    z-index: 60;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
    font-size: 0.85rem;
}

.cookie-notice[hidden] {
    display: none;
}

.cookie-notice__text {
    flex: 1 1 18rem;
    margin: 0;
    color: var(--color-text-muted);
}

.cookie-notice__link {
    white-space: nowrap;
}

/* A partir de la tablette, la navigation inferieure disparait : le bandeau
   reprend sa place au ras du bas. */
@media (min-width: 768px) {
    .cookie-notice {
        bottom: var(--space-3);
    }
}

/* Pages d'information : du texte brut, rendu lisible, sur toute la largeur
   de la carte (choix de l'exploitant). */
.legal__body {
    white-space: normal;
    line-height: 1.7;
}

/* Mise en page simple produite par SimpleMarkup. */
.legal__body > :first-child {
    margin-top: 0;
}

.legal__body h2,
.legal__body h3,
.legal__body h4 {
    margin: var(--space-5) 0 var(--space-2);
    line-height: 1.3;
}

.legal__body h2 {
    font-size: 1.375rem;
}

.legal__body h3 {
    font-size: 1.125rem;
}

.legal__body h4 {
    font-size: 1rem;
}

.legal__body ul,
.legal__body ol {
    margin: 0 0 var(--space-3);
    padding-left: 1.5rem;
}

.legal__body hr {
    margin: var(--space-5) 0;
    border: 0;
    border-top: 1px solid var(--color-border);
}

/* 4. Composants ---------------------------------------------------------- */

/* 4.1 Sélecteur de langue */

.lang {
    display: flex;
    gap: var(--space-1);
}

.lang__item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 36px;
    padding: 0 var(--space-2);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-decoration: none;
    color: var(--color-text-muted);
}

.lang__item:hover {
    background: var(--color-background);
}

.lang__item.is-active {
    background: var(--color-brand-light);
    color: var(--color-brand-dark);
}

/* 4.2 Navigation inférieure mobile (CDC §4.2) */

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
}

.bottom-nav__item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--color-text-muted);
}

.bottom-nav__item.is-active {
    color: var(--color-brand);
    font-weight: 600;
    box-shadow: inset 0 2px 0 var(--color-brand);
}

.bottom-nav__item.is-disabled {
    opacity: 0.4;
    cursor: default;
}

/* La déconnexion est un bouton dans un formulaire POST, pas un lien : le
   formulaire prend la place d'un élément de la barre pour que les entrées
   restent de largeur égale. */
.bottom-nav__form {
    flex: 1;
    display: flex;
    margin: 0;
}

.bottom-nav__button {
    width: 100%;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    color: inherit;
    cursor: pointer;
}

/* 4.3 Bloc d'introduction */

.hero {
    padding: var(--space-6) 0 var(--space-5);
}

.hero--compact {
    padding: var(--space-4) 0;
}

.hero__title {
    font-size: 1.7rem;
}

.hero__lead {
    font-size: 1.05rem;
    color: var(--color-brand-dark);
    font-weight: 500;
}

.hero__text {
    color: var(--color-text-muted);
}

/* 4.4 Carte de contenu */

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-5);
    margin-bottom: var(--space-5);
}

.card__title {
    font-size: 1.05rem;
    margin-bottom: var(--space-3);
}

.card > *:last-child {
    margin-bottom: 0;
}

/* 4.5 Boutons — cible tactile d'au moins 44px (CDC §4.2) */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 var(--space-5);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: var(--color-brand);
    color: #fff;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.button:hover {
    background: var(--color-brand-dark);
}

.button--ghost {
    background: transparent;
    border-color: var(--color-border);
    color: var(--color-text);
}

.button--ghost:hover {
    background: var(--color-surface);
}

.button--block {
    width: 100%;
}

/* 4.6 Alertes et messages flash */

.flash-stack {
    margin-bottom: var(--space-4);
}

.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    margin-bottom: var(--space-4);
    font-size: 0.95rem;
}

.alert--success { background: var(--color-success-bg); border-color: #bfe3cf; color: var(--color-success); }
.alert--error   { background: var(--color-error-bg);   border-color: #f5c9c6; color: var(--color-error); }
.alert--warning { background: var(--color-warning-bg); border-color: #f0dcb4; color: var(--color-warning); }
.alert--info    { background: var(--color-info-bg);    border-color: #c3ddf0; color: var(--color-info); }

/* 4.7 Badges (statuts, niveaux professionnels — CDC §11.2) */

.badge {
    display: inline-block;
    padding: 2px var(--space-3);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge--ok      { background: var(--color-success-bg); color: var(--color-success); }
.badge--warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge--error   { background: var(--color-error-bg);   color: var(--color-error); }
.badge--neutral { background: var(--color-background);  color: var(--color-text-muted); }

/* Pastille de couleur d'un badge professionnel. La couleur vient de la base,
   validée en amont contre /^#[0-9a-f]{6}$/. */
.badge-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: var(--space-2);
    vertical-align: baseline;
}

/* 4.8 Tableaux */

/* Un tableau large défile dans son propre conteneur : la page, elle, ne
   défile jamais horizontalement sur mobile. */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.table th,
.table td {
    padding: var(--space-3);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

.table thead th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    border-bottom-width: 2px;
}

.table tbody tr:last-child th,
.table tbody tr:last-child td {
    border-bottom: none;
}

.table .note {
    display: block;
    font-weight: 400;
    font-size: 0.82rem;
}

/* 4.9 Formulaires */

.field {
    margin-bottom: var(--space-4);
}

.field__label {
    display: block;
    margin-bottom: var(--space-2);
    font-size: 0.9rem;
    font-weight: 600;
}

.field__control {
    width: 100%;
    min-height: 44px;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    font: inherit;
    color: inherit;
}

.field__control:focus {
    border-color: var(--color-brand);
}

.field__error {
    margin: var(--space-2) 0 0;
    font-size: 0.85rem;
    color: var(--color-error);
}

/* 4.10 Navigation d'en-tête (état de connexion) */

.header__actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.header-nav {
    display: none; /* Sur mobile, l'accès au compte passe par la barre inférieure. */
    align-items: center;
    gap: var(--space-2);
}

.header-nav__link {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 var(--space-3);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text);
    text-decoration: none;
    white-space: nowrap;
}

.header-nav__link:hover {
    background: var(--color-background);
}

.header-nav__link--strong {
    background: var(--color-brand-light);
    color: var(--color-brand-dark);
    font-weight: 600;
}

.header-nav__form {
    margin: 0;
}

.header-nav__button {
    border: 0;
    background: none;
    font: inherit;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    cursor: pointer;
}

/* 4.11 Écrans d'authentification */

.auth {
    max-width: 460px;
    margin: 0 auto;
}

.auth__title {
    font-size: 1.6rem;
    text-align: center;
}

.auth__lead {
    text-align: center;
    color: var(--color-text-muted);
    margin-bottom: var(--space-5);
}

.auth__switch {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

.fieldset {
    border: 0;
    padding: 0;
    margin: 0 0 var(--space-4);
}

/* Deux champs côte à côte dès qu'il y a la place, empilés sur mobile. */
.field-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0 var(--space-4);
}

/* 4.12 Choix exclusifs (rôle à l'inscription) */

.choice-group {
    display: grid;
    gap: var(--space-3);
    margin-top: var(--space-2);
}

.choice {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    cursor: pointer;
}

.choice:hover {
    border-color: var(--color-brand);
}

/* :has() n'est pas supporté partout ; le contour au focus suffit à signaler
   l'élément actif, la case radio restant la source de vérité. */
.choice input {
    margin-top: 4px;
    width: 18px;
    height: 18px;
    flex: none;
    accent-color: var(--color-brand);
}

.choice__body {
    display: flex;
    flex-direction: column;
}

.choice__title {
    font-weight: 600;
}

.choice__text {
    font-size: 0.88rem;
    color: var(--color-text-muted);
}

/* 4.13 Tuiles de statistiques (back-office) */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.stat {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}

.stat__value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
    color: var(--color-brand);
}

.stat__label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.stat__hint {
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

/* Tuile cliquable : la bordure signale l'interaction sans changer la mise en
   page, pour que la grille reste alignée. */
.stat--link {
    text-decoration: none;
    color: inherit;
}

.stat--link:hover {
    border-color: var(--color-brand);
}

/* Une tuile « alert » réclame une action. La couleur ne porte pas seule
   l'information : la valeur y est de toute façon non nulle et le libellé
   explicite. */
.stat--alert {
    border-color: var(--color-warning);
    background: var(--color-warning-bg);
}

.stat--alert .stat__value {
    color: var(--color-warning);
}

/* 4.14 Back-office */

.admin-nav {
    display: flex;
    gap: var(--space-1);
    overflow-x: auto;
    padding-bottom: var(--space-2);
    margin-bottom: var(--space-5);
    border-bottom: 1px solid var(--color-border);
    -webkit-overflow-scrolling: touch;
}

/*
 * Navigation regroupée. Sur mobile la barre défile horizontalement : chaque
 * groupe reste d'un seul tenant, on ne coupe jamais un intitulé de sa liste.
 */
.admin-nav__group {
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-right: var(--space-3);
    border-right: 1px solid var(--color-border);
}

.admin-nav__group:last-child {
    border-right: 0;
    padding-right: 0;
}

.admin-nav__legend {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    padding: 0 var(--space-3);
}

/* La barre passe en ligne dès qu'il y a la place : les groupes se suivent. */
@media (min-width: 768px) {
    .admin-nav__group {
        flex-direction: row;
        align-items: center;
        gap: var(--space-1);
    }

    .admin-nav__legend {
        padding: 0 var(--space-2) 0 0;
    }
}

.admin-nav__item {
    flex: none;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none;
    white-space: nowrap;
}

.admin-nav__item:hover {
    background: var(--color-surface);
    color: var(--color-text);
}

.admin-nav__item.is-active {
    background: var(--color-brand-light);
    color: var(--color-brand-dark);
    font-weight: 600;
}

.admin-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.admin-head .hero__title {
    margin: 0;
    font-size: 1.5rem;
}

/* Actions de ligne : les formulaires POST doivent s'aligner comme des boutons. */
.row-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

.row-actions form {
    margin: 0;
}

.button--small {
    min-height: 34px;
    padding: 0 var(--space-3);
    font-size: 0.85rem;
}

.button--danger {
    background: var(--color-error);
    color: #fff;
}

.button--danger:hover {
    background: #8f1e17;
}

/* Le bouton principal reprend le dégradé du logo sur les appels à l'action
   pleine largeur : recherche, publication, paiement.
   Le dégradé s'arrête au magenta : prolongé jusqu'à l'orange du logo, le
   texte blanc tomberait à 2,9:1 de contraste sur la fin du bouton. */
.button--block {
    background: linear-gradient(90deg, var(--color-brand) 0%, var(--color-accent-magenta) 100%);
    border: 0;
}

.button--block:hover {
    filter: brightness(1.08);
}

.button--block[disabled]:hover {
    filter: none;
}

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    cursor: pointer;
}

.checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--color-brand);
}

/* Villes d'intervention : une grille qui s'adapte au nombre de villes plutot
   qu'une colonne interminable. auto-fill avec un minimum de 11rem donne une
   seule colonne sur telephone et jusqu'a quatre sur un grand ecran, sans
   point de rupture a maintenir. */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 0 var(--space-4);
    margin-top: var(--space-2);
}

.checkbox-grid .checkbox {
    margin-bottom: var(--space-2);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-5);
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-3);
}

.filter-bar .field {
    flex: 1 1 220px;
    margin-bottom: 0;
}

/* Bloc de saisie d'une langue dans un formulaire traduisible. */
.translation-block {
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-background);
}

.translation-block__head {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.translation-block .field:last-child {
    margin-bottom: 0;
}

.commission-summary {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.commission-summary > div {
    display: flex;
    flex-direction: column;
    padding: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-background);
}

.commission-summary__rate {
    font-size: 1.6rem;
    color: var(--color-brand);
}

.field__control--color {
    height: 44px;
    padding: var(--space-1);
}

/* 4.15 Espace professionnel */

/* Liste des conditions de publication. */
.checklist {
    list-style: none;
    margin: 0 0 var(--space-4);
    padding: 0;
}

.checklist__item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-border);
}

.checklist__item:last-child {
    border-bottom: 0;
}

.checklist__mark {
    flex: none;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
}

.checklist__item--done .checklist__mark {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.checklist__item--todo .checklist__mark {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.checklist__item--todo {
    color: var(--color-text);
}

/* Un bouton désactivé doit se voir : sans cela, l'utilisateur clique dans le
   vide sans comprendre pourquoi. */
.button[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

.button[disabled]:hover {
    background: var(--color-brand);
}

.avatar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--space-5);
}

.avatar-row__forms {
    flex: 1 1 260px;
}

.avatar-row__forms form + form {
    margin-top: var(--space-3);
}

.avatar {
    flex: none;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--color-brand-light);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar__placeholder {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-brand-dark);
    text-transform: uppercase;
}

/* 4.16 Recherche et résultats */

.hero--search {
    text-align: center;
    padding: var(--space-7) 0 var(--space-5);
}

/* Filet décoratif reprenant le dégradé complet du logo, orange compris.
   Purement ornemental : aucun texte ne repose dessus, l'orange n'ayant que
   2,9:1 de contraste avec le blanc. */
.hero--search .hero__title::after {
    content: '';
    display: block;
    width: 72px;
    height: 4px;
    margin: var(--space-3) auto 0;
    border-radius: 2px;
    background: linear-gradient(
        90deg,
        var(--color-brand) 0%,
        var(--color-accent-violet) 55%,
        var(--color-accent-magenta) 100%
    );
}

.search-form .field:last-of-type {
    margin-bottom: var(--space-5);
}

.search-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-3);
}

.search-filters .field {
    flex: 1 1 180px;
    margin-bottom: 0;
}

/* Onglets Liste / Carte (maquette §11.2). */
.view-tabs {
    display: inline-flex;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-surface);
}

.view-tabs__item {
    padding: var(--space-2) var(--space-4);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none;
}

.view-tabs__item.is-active {
    background: var(--color-brand);
    color: #fff;
    font-weight: 600;
}

.view-tabs__item.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pro-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

/* Carte de prestataire — lisible sur smartphone (CDC §4.2). */
.pro-card {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: var(--space-4);
    padding: var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.pro-card__avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--color-brand-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pro-card__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Colonne de droite de la fiche. min-width: 0 est indispensable : sans lui,
   un élément de grille refuse de descendre sous la largeur de son contenu, et
   une description longue sans espace élargit toute la carte. */
.pro-card__body {
    min-width: 0;
}

/* Foire aux questions -----------------------------------------------------
   Bâtie sur <details>/<summary> : le dépliage est natif, donc il fonctionne
   sans JavaScript, se navigue au clavier et s'annonce correctement aux
   lecteurs d'écran sans le moindre attribut ARIA. */

.faq {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
}

.faq__item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.faq__item[open] {
    border-color: var(--color-brand);
}

.faq__question {
    padding: var(--space-4);
    font-weight: 600;
    cursor: pointer;
    /* La flèche par défaut de Chrome se place mal sur un bloc à padding :
       on la retire et on dessine la nôtre. */
    list-style: none;
    position: relative;
    padding-right: var(--space-7);
}

.faq__question::-webkit-details-marker {
    display: none;
}

.faq__question::after {
    content: "+";
    position: absolute;
    right: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.3rem;
    font-weight: 400;
    color: var(--color-brand);
    line-height: 1;
}

.faq__item[open] .faq__question::after {
    content: "\2212"; /* signe moins, pas un trait d'union */
}

.faq__question:hover {
    background: var(--color-brand-light);
}

.faq__question:focus-visible {
    outline: 2px solid var(--color-brand);
    outline-offset: -2px;
}

.faq__answer {
    padding: 0 var(--space-4) var(--space-4);
    color: var(--color-text-muted);
    line-height: 1.6;
}

.pro-card__name {
    margin: 0 0 var(--space-1);
    font-size: 1.05rem;
}

.pro-card__name a {
    color: var(--color-text);
    text-decoration: none;
}

.pro-card__name a:hover {
    color: var(--color-brand);
}

.pro-card__badge {
    display: flex;
    align-items: center;
    margin: 0 0 var(--space-1);
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.pro-card__location {
    margin: 0 0 var(--space-2);
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

/* « Intervient aussi a Paris » : affiche quand le resultat vient d une ville
   d intervention et non de l adresse. Legerement mis en avant, parce que c est
   la reponse a la question que le client vient de poser. */
.pro-card__coverage {
    margin: 0 0 var(--space-2);
    font-size: 0.9rem;
    color: var(--color-brand);
}

.pro-card__text {
    margin: 0;
    font-size: 0.9rem;
}

.pro-card__aside {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-border);
}

.pro-card__price {
    margin: 0;
    margin-right: auto;
}

.pro-card__price strong {
    font-size: 1.1rem;
    color: var(--color-brand);
}

.pro-card__aside p {
    margin: 0;
}

.breadcrumb {
    font-size: 0.9rem;
}

.profile-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-5);
}

.profile-header__body {
    flex: 1 1 240px;
}

.profile-header__body .hero__title {
    margin-bottom: var(--space-2);
}

.avatar--large {
    width: 128px;
    height: 128px;
}

.steps {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--color-text-muted);
}

.steps li {
    margin-bottom: var(--space-2);
}

/* Pagination */
.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    margin: var(--space-5) 0;
}

.pagination__item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
    padding: 0 var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    font-size: 0.9rem;
    color: var(--color-text);
    text-decoration: none;
}

.pagination__item:hover {
    border-color: var(--color-brand);
}

.pagination__item.is-active {
    background: var(--color-brand);
    border-color: var(--color-brand);
    color: #fff;
    font-weight: 600;
}

.pagination__item.is-disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination__ellipsis {
    padding: 0 var(--space-1);
    color: var(--color-text-muted);
}

/* 4.17 Carte (Lot 6) */

.map {
    height: 60vh;
    min-height: 340px;
    margin-bottom: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    /* Leaflet pose ses tuiles en absolu : sans overflow caché, elles
       dépasseraient des angles arrondis. */
    overflow: hidden;
    background: var(--color-background);
}

/* Leaflet applique ses propres styles aux contrôles et popups ; on ne
   surcharge que le contenu que nous produisons nous-mêmes. */
.map-popup {
    min-width: 160px;
}

.map-popup p {
    margin: 0 0 var(--space-1);
}

.map-popup__name {
    font-weight: 600;
    font-size: 1rem;
}

.map-popup__badge {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.map-popup__city,
.map-popup__offers {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.map-popup__price strong {
    color: var(--color-brand);
}

.map-popup .button {
    margin-top: var(--space-2);
}

/* Le lien de la popup Leaflet ne doit pas hériter du soulignement global. */
.map-popup a.button {
    text-decoration: none;
    color: #fff;
}

/* 4.18 Messagerie (maquette §11.6) */

.thread {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    max-height: 420px;
    overflow-y: auto;
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    -webkit-overflow-scrolling: touch;
}

.thread__empty {
    margin: 0;
    text-align: center;
}

/* Bulle reçue à gauche, bulle envoyée à droite : la position porte
   l'information autant que la couleur, pour rester lisible sans distinction
   chromatique. */
.bubble {
    max-width: 78%;
    align-self: flex-start;
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    border-bottom-left-radius: 2px;
}

.bubble--mine {
    align-self: flex-end;
    background: var(--color-brand-light);
    border-color: transparent;
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: 2px;
}

.bubble p {
    margin: 0;
}

.bubble__author {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: var(--space-1);
}

.bubble__body {
    font-size: 0.95rem;
    /* Une URL ou un mot très long ne doit pas élargir la bulle. */
    overflow-wrap: anywhere;
}

.bubble__time {
    margin-top: var(--space-1);
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-align: right;
}

.composer {
    display: flex;
    align-items: flex-end;
    gap: var(--space-3);
}

.composer textarea {
    flex: 1;
    resize: vertical;
    min-height: 44px;
}

.header-nav__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    margin-left: var(--space-1);
    padding: 0 5px;
    border-radius: 999px;
    background: var(--color-error);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
}

/* 4.19 Panier et paiement (maquettes §11.7 et §11.8) */

.cart-line {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3);
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--color-border);
}

.cart-line:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.cart-line p {
    margin: 0;
}

/* Colonne de gauche d'une ligne de panier. Même raison que pro-card__body :
   sans min-width: 0, un libellé de prestation long élargit la ligne au lieu
   de se replier. */
.cart-line__body {
    min-width: 0;
}

.cart-line__name {
    font-weight: 600;
}

.cart-line__amounts p {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    font-size: 0.9rem;
}

.cart-line__total {
    padding-top: var(--space-2);
    margin-top: var(--space-2) !important;
    border-top: 1px solid var(--color-border);
    font-size: 1.05rem !important;
    font-weight: 700;
    color: var(--color-brand);
    justify-content: flex-end !important;
}

/* Ligne de total d'un tableau : elle doit se distinguer des lignes de détail
   sans recourir à la seule couleur. */
.table__total th,
.table__total td {
    border-top: 2px solid var(--color-border);
    font-size: 1.05rem;
}

.checkout {
    text-align: center;
}

.checkout__label {
    margin-bottom: var(--space-1);
    color: var(--color-text-muted);
}

.checkout__amount {
    margin: 0 0 var(--space-2);
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1;
    color: var(--color-brand);
}

.checkout form {
    margin-bottom: var(--space-3);
}

/* 4.20 Page d'erreur */

.error-page {
    text-align: center;
    padding: var(--space-7) var(--space-4);
}

.error-page__code {
    margin: 0;
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--color-brand);
}

.error-page__title {
    font-size: 1.3rem;
    margin-top: var(--space-3);
}

.error-page__text {
    color: var(--color-text-muted);
}

/* 5. Utilitaires --------------------------------------------------------- */

.muted {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* 6. Points de rupture --------------------------------------------------- */

@media (min-width: 768px) {
    body {
        /* La navigation inférieure disparaît : plus besoin de réserver la place. */
        padding-bottom: 0;
    }

    .bottom-nav {
        display: none;
    }

    .main {
        padding: var(--space-6) var(--space-5);
    }

    .hero__title {
        font-size: 2.1rem;
    }

    .header-nav {
        display: flex;
    }

    .field-row {
        grid-template-columns: 1fr 1fr;
    }

    .stat-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .commission-summary {
        grid-template-columns: 1fr 1fr;
    }

    /* Sur écran large, la carte de prestataire passe sur une seule ligne :
       avatar, informations, puis tarif et action à droite. */
    .pro-card {
        grid-template-columns: 64px 1fr auto;
        align-items: center;
    }

    .pro-card__aside {
        grid-column: auto;
        flex-direction: column;
        align-items: flex-end;
        padding-top: 0;
        border-top: 0;
        text-align: right;
    }

    .pro-card__price {
        margin-right: 0;
    }

    .cart-line {
        grid-template-columns: 1fr auto auto;
        align-items: center;
        gap: var(--space-5);
    }

    .cart-line__amounts {
        min-width: 220px;
    }
}

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

/* 8. Pieces justificatives -------------------------------------------------
   Recu de paiement et releve de versement. Mise en page nue, pensee pour
   l'impression : le PDF se fabrique par la fonction « Enregistrer au format
   PDF » du navigateur, le projet n'embarquant aucune bibliotheque. */

.document-page {
    background: var(--color-surface);
}

.document {
    max-width: 48rem;
    margin: 0 auto;
    padding: var(--space-5) var(--space-4);
}

.document__head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom: 2px solid var(--color-text);
}

.document__issuer {
    margin: 0;
    font-weight: 700;
    font-size: 1.05rem;
}

.document__lines {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.document__meta {
    text-align: right;
}

.document__title {
    margin: 0;
    font-size: 1.3rem;
}

/* Le numero est ce qu'on cherche en premier sur une piece classee : il merite
   d'etre lisible d'un coup d'oeil, en chiffres a chasse fixe pour qu'une pile
   de recus s'aligne. */
.document__number {
    margin: var(--space-1) 0;
    font-family: ui-monospace, Consolas, monospace;
    font-size: 1.1rem;
    font-weight: 700;
}

.document__parties {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-5);
    margin: var(--space-5) 0;
}

.document__parties > div {
    flex: 1 1 14rem;
}

.document__subtitle {
    margin: 0 0 var(--space-1);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--color-text-muted);
}

.document__table {
    margin-bottom: var(--space-5);
}

.document__footnotes {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.document__footnotes p {
    margin: 0 0 var(--space-2);
}

/* La mention qui distingue un recu d'une facture : encadree, parce qu'un
   client qui la manque croira tenir sa piece comptable. */
.document__notice {
    padding: var(--space-3);
    border-left: 3px solid var(--color-brand);
    background: var(--color-bg);
    color: var(--color-text);
}

.document__warning {
    padding: var(--space-3);
    border: 1px solid #b42318;
    border-radius: var(--radius-md);
    color: #b42318;
    font-weight: 600;
}

.document__actions {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
    padding: 0 var(--space-4) var(--space-6);
}

@media print {
    /* Tout ce qui ne fait pas partie de la piece disparait : boutons, liens
       de retour, bandeau. Une feuille imprimee n'a pas de bouton. */
    .no-print {
        display: none;
    }

    .document {
        max-width: none;
        padding: 0;
    }

    body {
        background: #fff;
        color: #000;
    }

    /* Une piece tient sur une page : on evite qu'un tableau soit coupe en
       deux par un saut de page. */
    .document__table,
    .document__parties {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* Lien vers une piece justificative, sous le volet financier d'une demande.
   Discret mais trouvable : c'est la qu'on cherche son recu apres avoir paye. */
.document-link {
    margin: var(--space-3) 0 0;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

/* Bordereau des versements : une section par mode de reglement. */
.document__section {
    margin-bottom: var(--space-5);
    break-inside: avoid;
    page-break-inside: avoid;
}

/* L'IBAN se lit chiffre par chiffre au moment de le recopier dans la banque :
   chasse fixe, et pas de retour a la ligne au milieu d'un groupe. */
.document__iban {
    font-family: ui-monospace, Consolas, monospace;
    white-space: nowrap;
}

/* Invitation à installer l'application (PWA) ------------------------------
   Même place que le bandeau d'information, qu'elle ne croise jamais (le
   script attend qu'il soit fermé). Masquée par défaut ; pwa.js décide. */
.install-prompt {
    position: fixed;
    left: var(--space-3);
    right: var(--space-3);
    bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + var(--space-2));
    z-index: 61;
    max-width: 30rem;
    margin: 0 auto;
    padding: var(--space-3) var(--space-4) var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: 0 10px 32px rgba(0, 0, 0, .2);
    opacity: 0;
    transform: translateY(1rem);
    transition: opacity .3s ease, transform .3s ease;
}

.install-prompt[hidden] {
    display: none;
}

.install-prompt.is-visible {
    opacity: 1;
    transform: none;
}

.install-prompt__main {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.install-prompt__icon {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.install-prompt__text {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.install-prompt__title {
    font-size: 0.95rem;
}

.install-prompt__lead {
    color: var(--color-text-muted);
    font-size: 0.8125rem;
    line-height: 1.4;
}

.install-prompt__close {
    flex: 0 0 auto;
    align-self: flex-start;
    width: 2rem;
    height: 2rem;
    margin: calc(var(--space-1) * -1) calc(var(--space-2) * -1) 0 0;
    border: 0;
    background: none;
    color: var(--color-text-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.install-prompt__actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.install-prompt__actions[hidden],
.install-prompt__ios[hidden] {
    display: none;
}

.install-prompt__actions .button {
    flex: 1 1 0;
}

.install-prompt__steps {
    margin: var(--space-3) 0 0;
    padding-left: 1.25rem;
    font-size: 0.875rem;
    line-height: 1.6;
}

.install-prompt__share {
    vertical-align: -4px;
    color: var(--color-brand);
}

@media (min-width: 768px) {
    .install-prompt {
        bottom: var(--space-3);
    }
}

@media (prefers-reduced-motion: reduce) {
    .install-prompt {
        transition: none;
    }
}
