/* ========================================
   COMPONENTS — boutons, bouton ✕, pastilles, badges, alertes, icône d'état, ligne de prix, compteur,
   boîte de confirmation
   Les cartes vivent dans cards.css, les champs et .custom-select dans forms.css.
   Un seul système de noms, BEM : bloc, bloc__element, bloc--variante.
   ======================================== */

/* ---------- Boutons ----------
   <a class="btn btn--primary">…</a>   variantes : --primary (orange), --dark (marine),
   --outline, --outline-orange, --outline-clair (sur photo), --ghost, --danger ; tailles : --sm, --lg ;
   --block (pleine largeur) ; chevron : --precedent (avant le libellé), --suivant (après).
   En pilule, comme dans la maquette Kley Connect. */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 24px;
    border: 1.5px solid transparent;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--color-text);
    font-size: var(--font-size-md);
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease),
                box-shadow 0.2s var(--ease), color 0.2s var(--ease), transform 0.1s var(--ease);
}

.btn:active {
    transform: scale(0.97);
}

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

/* Texte blanc sur l'orange profond (4,5:1) : sur l'orange de la maquette, il tomberait à 3,3:1 */
.btn--primary {
    background-color: var(--color-primary-strong);
    color: var(--color-on-primary);
    box-shadow: 0 4px 12px rgba(180, 95, 30, 0.25);
}

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

.btn--dark {
    background-color: var(--color-dark);
    color: var(--color-on-dark);
}

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

.btn--outline {
    background-color: var(--color-bg);
    border-color: var(--color-text);
    color: var(--color-text);
}

.btn--outline:hover {
    background-color: var(--color-surface);
}

/* Contour orange (client, 22 nov. 2026 : « Trouver un logement » de Mes réservations vide),
   plein d'orange au survol */
.btn--outline-orange {
    background-color: var(--color-bg);
    border-color: var(--color-primary-strong);
    color: var(--color-primary-text);
}

.btn--outline-orange:hover {
    background-color: var(--color-primary-strong);
    color: var(--color-on-primary);
}

/* Contour blanc, posé sur une photo assombrie (boutons du hero) */
.btn--outline-clair {
    background-color: rgba(20, 33, 61, 0.35);
    border-color: var(--color-on-dark);
    color: var(--color-on-dark);
}

.btn--outline-clair:hover {
    background-color: rgba(20, 33, 61, 0.6);
}

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

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

/* Chevron avant (« Précédent », mois précédent) ou après (« Suivant ») le libellé */
.btn--precedent::before,
.btn--suivant::after {
    content: "";
    flex-shrink: 0;
    width: 12px;
    height: 12px;
    background: currentColor;
    -webkit-mask: var(--icone-chevron-gauche) center / contain no-repeat;
    mask: var(--icone-chevron-gauche) center / contain no-repeat;
}

.btn--suivant::after {
    -webkit-mask-image: var(--icone-chevron-droite);
    mask-image: var(--icone-chevron-droite);
}

/* Formulaire parti (main.js, envoi unique) : le bouton cliqué attend la page suivante */
.btn.is-envoi {
    opacity: 0.6;
    cursor: progress;
    pointer-events: none;
}

.btn--danger {
    background-color: var(--color-bg);
    border-color: var(--color-danger);
    color: var(--state-danger-fg);
}

.btn--danger:hover {
    background-color: var(--state-danger-bg);
}

.btn--sm {
    min-height: 36px;
    padding: 8px 16px;
    font-size: var(--font-size-sm);
}

.btn--lg {
    min-height: 56px;
    padding: 16px 32px;
    font-size: 17px;
}

.btn--block {
    display: flex;
    width: 100%;
}

/* Cible tactile ≥ 44px même pour les petits boutons */
@media (max-width: 767px) {
    .btn--sm {
        min-height: 44px;
    }
}

/* Groupe de boutons côte à côte (un <form> d'un seul bouton s'y range comme un lien) */
.actions-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

/* ---------- Pastilles (filtres, choix) ----------
   <button class="chip [chip--active]">Nice</button> */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 16px;
    border: 1px solid var(--color-surface-2);
    border-radius: var(--radius-pill);
    background: var(--color-bg);
    color: var(--color-text);
    font-size: var(--font-size-sm);
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.chip:hover {
    border-color: var(--color-text);
}

.chip--active,
.chip[aria-pressed="true"] {
    border-color: var(--color-dark);
    background: var(--color-dark);
    color: var(--color-on-dark);
}

@media (max-width: 767px) {
    .chip {
        min-height: 44px;
    }
}

/* ---------- Badges de statut ----------
   <span class="badge badge--success">Payée</span> ; variantes --success, --warning,
   --danger, --info, --neutral. Le statut d'un objet passe par
   components/badge_statut.html, qui tient la correspondance statut → variante. */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
}

.badge--success {
    background: var(--state-success-bg);
    color: var(--state-success-fg);
}

.badge--warning {
    background: var(--state-warning-bg);
    color: var(--state-warning-fg);
}

.badge--danger {
    background: var(--state-danger-bg);
    color: var(--state-danger-fg);
}

.badge--info {
    background: var(--state-info-bg);
    color: var(--state-info-fg);
}

.badge--neutral {
    background: var(--state-neutral-bg);
    color: var(--state-neutral-fg);
}

/* ---------- Alertes et messages Django ----------
   <div class="alert alert--error">…</div> ; variantes --success, --error, --warning, --info.
   Les messages Django passent par components/messages.html (alert--{{ message.level_tag }}). */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 24px;
    padding: 14px 18px;
    border: 1px solid var(--color-surface-2);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.alert--success {
    background: var(--state-success-bg);
    border-color: var(--state-success-border);
    color: var(--state-success-fg);
}

.alert--error {
    background: var(--state-danger-bg);
    border-color: var(--state-danger-border);
    color: var(--state-danger-fg);
}

.alert--warning {
    background: var(--state-warning-bg);
    border-color: var(--state-warning-border);
    color: var(--state-warning-fg);
}

.alert--info {
    background: var(--state-info-bg);
    border-color: var(--state-info-border);
    color: var(--state-info-fg);
}

/* ---------- Icône d'état (pages de confirmation) ----------
   <span class="status-icon status-icon--success [status-icon--lg]" aria-hidden="true">svg</span>
   variantes : --primary (orange : message envoyé, inscription reçue), --success,
   --wait, --error ; --lg : 72px au lieu de 64px. Centrée par le text-align du parent. */
.status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
    border-radius: 50%;
    background: var(--color-surface);
    color: var(--color-text);
}

.status-icon--lg {
    width: 72px;
    height: 72px;
    margin-bottom: 24px;
}

.status-icon--primary {
    background: var(--color-primary-light);
    color: var(--color-primary-strong);
}

.status-icon--success {
    background: var(--state-success-bg);
    color: var(--state-success-fg);
}

.status-icon--wait {
    background: var(--state-warning-bg);
    color: var(--state-warning-fg);
}

.status-icon--error {
    background: var(--state-danger-bg);
    color: var(--state-danger-fg);
}

/* ---------- Ligne de prix (fiche logement, tunnel de réservation) ----------
   <div class="price-row [price-row--discount|--total]"><span>Libellé</span><span>Montant</span></div> */
.price-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 6px 0;
    font-size: var(--font-size-base);
}

.price-row[hidden] {
    display: none;
}

.price-row--discount {
    color: var(--state-success-fg);
}

.price-row--total {
    margin-top: 16px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
    font-weight: 800;
}

/* Bouton rond − / + d'un compteur, le seul du site (voyageurs : recherche, fiche,
   réservation ; capacité d'un bien). En butée : aria-disabled, qui garde le focus clavier
   (disabled le ferait tomber sur la page). Masqué sans JS : il ne ferait rien. */
.counter-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--color-border-strong);
    border-radius: 50%;
    background: var(--color-bg);
    color: var(--color-text-light);
    cursor: pointer;
    transition: border-color 0.15s var(--ease), color 0.15s var(--ease);
}

/* Zone tactile de 44 px autour du disque de 32 px */
.counter-btn::before {
    content: "";
    position: absolute;
    inset: -6px;
}

.counter-btn:hover:not([aria-disabled="true"]) {
    border-color: var(--color-text);
    color: var(--color-text);
}

.counter-btn[aria-disabled="true"] {
    opacity: 0.35;
    cursor: not-allowed;
}

.counter-btn:focus-visible {
    outline: 2px solid var(--color-text);
    outline-offset: 2px;
}

html:not(.js) .counter-btn {
    display: none;
}

/* ---------- Boîte de confirmation ----------
   components/dialogue.html, ouverte par dialogue.js à la place du confirm() natif.
   <dialog> en showModal() : au-dessus de tout (top layer), fond par ::backdrop. */
.dialogue {
    width: min(440px, calc(100vw - 2 * var(--page-gutter)));
    max-width: none;
    padding: 0;
    margin: auto;
    border: 0;
    border-radius: var(--radius-2xl);
    background: var(--color-bg);
    color: var(--color-text);
    box-shadow: var(--shadow-float);
}

.dialogue[open] {
    animation: dialogueEntree 0.2s var(--ease);
}

@keyframes dialogueEntree {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
}

.dialogue::backdrop {
    background: var(--color-overlay);
}

.dialogue__boite {
    padding: 28px 24px 24px;
}

.dialogue__texte {
    margin: 0 0 24px;
    font-size: var(--font-size-base);
    line-height: 1.5;
}

.dialogue__actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
}

@media (max-width: 479px) {
    .dialogue__actions .btn {
        flex: 1 1 0;
    }
}

/* Icône « lien externe » après le texte d'un lien en nouvel onglet
   (components/nouvel_onglet.html) */
.lien-externe {
    display: inline-block;
    flex-shrink: 0;
    margin-left: 4px;
    vertical-align: -1px;
    opacity: 0.7;
}

/* ---------- Lien de retour ----------
   components/lien_retour.html : chevron (--icone-chevron-gauche, base.css) puis libellé ;
   --icone : chevron seul dans un rond de 44 px, le libellé en nom accessible. */
.lien-retour {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    color: var(--color-text-light);
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-decoration: none;
}

.lien-retour::before {
    content: "";
    flex-shrink: 0;
    width: 12px;
    height: 12px;
    background: currentColor;
    -webkit-mask: var(--icone-chevron-gauche) center / contain no-repeat;
    mask: var(--icone-chevron-gauche) center / contain no-repeat;
}

.lien-retour:hover {
    color: var(--color-text);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.lien-retour--icone {
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: var(--color-text);
    transition: background-color 0.15s var(--ease);
}

.lien-retour--icone::before {
    width: 16px;
    height: 16px;
}

.lien-retour--icone:hover {
    background: var(--color-surface);
}

/* ---------- Pastille de compteur ----------
   Nombre de notifications ou de messages non lus (cloche, menu ☰, onglet mobile) : blanc
   sur l'orange foncé (--color-primary-strong, fait pour porter du texte blanc). */
.pastille {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--radius-pill);
    background: var(--color-primary-strong);
    color: var(--color-on-dark);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.pastille[hidden] {
    display: none;
}

/* Posée sur le coin d'une icône (cloche, onglet) */
.pastille--coin {
    position: absolute;
    top: -2px;
    right: -4px;
}

/* ---------- Avatar ----------
   components/avatar.html : la taille, le fond et la police viennent de la classe de
   placement (navbar__avatar, mon-compte__avatar…) ; la photo remplit le rond. */
.avatar {
    overflow: hidden;
}

.avatar__photo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Logo d'une conciergerie : rond, rempli par l'image, sans anneau. La classe de placement
   donne la taille ; cette variante retire la bordure de l'avatar. */
.avatar.avatar--logo {
    border: none;
    border-radius: var(--radius-logo);
    background: var(--color-bg);
}

/* En tête d'une page ouverte depuis le menu (Contact, Boîte à idées, Compte…), au-dessus du
   titre : le chevron s'aligne sur le texte, le rond déborde dans la marge. */
.lien-retour--page {
    margin: 0 0 4px -12px;
}

/* ---------- Bouton ✕ de fermeture ----------
   components/bouton_fermer.html : le même pour toutes les couches. Chaque couche ne garde
   que son placement (classe en plus) ; --sombre sur fond noir (visionneuse). */
.btn-fermer {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--color-text);
    cursor: pointer;
    transition: background-color 0.2s var(--ease);
}

.btn-fermer:hover {
    background: var(--color-surface);
}

.btn-fermer:focus-visible {
    outline: 2px solid var(--color-text);
    outline-offset: 2px;
}

.btn-fermer--sombre {
    background: rgba(255, 255, 255, 0.15);
    color: var(--color-on-dark);
}

.btn-fermer--sombre:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-fermer--sombre:focus-visible {
    outline-color: var(--color-on-dark);
}

/* ---------- Bascule (contrôle segmenté de liens) ----------
   <nav class="bascule"><a class="bascule__option bascule__option--active" aria-current="page">…</a>…</nav>
   Deux pages sœurs (inscription propriétaire / conciergerie) : l'option active en orange plein. */
.bascule {
    display: grid;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    padding: 0;
    border: 1.5px solid var(--color-dark);
    border-radius: var(--radius-pill);
    background: var(--color-bg);
    overflow: hidden;
}

.bascule__option {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    color: var(--color-text);
    font-size: var(--font-size-md);
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
    transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

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

.bascule__option--active,
.bascule__option--active:hover {
    background: var(--color-primary-strong);
    color: var(--color-on-primary);
}

/* Quatre options (inscription : propriétaire, voyageur, étudiant, conciergerie) : deux par
   ligne sur un téléphone, où une seule ligne coupait les libellés */
@media (max-width: 479px) {
    .bascule:has(> :nth-child(4)) {
        grid-auto-flow: row;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        border-radius: var(--radius-xl);
    }

    .bascule:has(> :nth-child(4)) .bascule__option {
        border-radius: var(--radius-lg);
    }
}

/* ---------- Étiquette d'accent ----------
   Petite pastille orange pleine (zone d'une conciergerie sur sa carte) */
.etiquette {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: var(--color-primary-strong);
    color: var(--color-on-primary);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

/* Puce grise d'un service, d'un équipement */
.puce {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: var(--radius-pill);
    background: var(--color-surface-2);
    color: var(--color-text);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
}

/* ---------- Épingle de carte (Kley.epingle) ----------
   Goutte de la maquette du client. Fond --color-primary-strong : le numéro blanc y tient
   4,5:1, pas sur l'orange clair. Active (ligne survolée, clic) : marine et agrandie. */
.epingle {
    background: none;
    border: 0;
}

.epingle__corps {
    position: relative;
    display: block;
    transform-origin: 50% 100%;
    transition: transform 0.2s var(--ease);
}

.epingle svg {
    display: block;
    overflow: visible;
    filter: drop-shadow(0 2px 3px rgba(20, 33, 61, 0.35));
}

.epingle path {
    fill: var(--color-primary-strong);
    stroke: var(--color-bg);
    stroke-width: 2;
    transition: fill 0.2s;
}

.epingle circle {
    fill: var(--color-bg);
}

.epingle__numero {
    position: absolute;
    top: 7px;
    left: 0;
    right: 0;
    color: var(--color-on-primary);
    font-family: var(--font-main);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    pointer-events: none;
}

.epingle--active .epingle__corps {
    transform: scale(1.15);
}

.epingle--active path {
    fill: var(--color-dark);
}

/* Conciergeries de la page Conciergerie : en bleu marine, orange une fois actives (client,
   25 nov. 2026 : « les conciergeries en bleu », la maison du bien en orange) */
.epingle--bleue path {
    fill: var(--color-dark);
}

.epingle--bleue.epingle--active path {
    fill: var(--color-primary-strong);
}

/* « Votre bien » (Kley.maison) : petite maison blanche dans un rond orange */
.repere-maison {
    background: none;
    border: 0;
}

.repere-maison__rond {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 2px solid var(--color-bg);
    border-radius: 50%;
    background: var(--color-primary-strong);
    box-shadow: 0 2px 6px rgba(20, 33, 61, 0.35);
}

.repere-maison__rond path {
    fill: var(--color-on-primary);
}

/* Déplaçable (repère du wizard et de la page Modifier, carte_repere.js) : la main, un
   anneau au focus clavier, et le rond qui se soulève pendant qu'on le fait glisser */
.repere-maison.leaflet-marker-draggable {
    cursor: grab;
}

.repere-maison.leaflet-marker-draggable:focus-visible {
    outline: none;
}

.repere-maison.leaflet-marker-draggable:focus-visible .repere-maison__rond {
    outline: 3px solid var(--color-dark);
    outline-offset: 2px;
}

.repere-maison.leaflet-drag-target,
.repere-maison.leaflet-drag-target .repere-maison__rond {
    cursor: grabbing;
}

.repere-maison.leaflet-drag-target .repere-maison__rond {
    box-shadow: 0 6px 14px rgba(20, 33, 61, 0.4);
    transform: scale(1.08);
}

@media (prefers-reduced-motion: reduce) {
    .epingle__corps,
    .epingle path {
        transition: none;
    }
}

/* Champ du logo d'une conciergerie (concierges/widget_logo.html) : aperçu, case Retirer */
.champ-logo {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.champ-logo__apercu {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-logo);
    background: var(--color-bg);
    object-fit: cover;
}

.champ-logo__retirer {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-size-md);
}

/* Logo d'une conciergerie : un rond rempli par l'image, sans liseré ni marge blanche
   (client, 26 nov. 2026 ; le rond à liseré du 24 nov. avait été jugé moche) */
.logo-rond {
    border-radius: var(--radius-logo);
    background: var(--color-bg);
    object-fit: cover;
}

/* ---------- Avis Google d'une conciergerie (components/avis_google.html) ---------- */
.avis-google {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: var(--font-size-sm);
    color: var(--color-text);
    text-decoration: none;
}

.avis-google:hover .avis-google__texte {
    text-decoration: underline;
}

.avis-google__etoile {
    color: var(--color-ampoule);
}

.avis-google__note {
    font-weight: 700;
}

.avis-google__texte {
    color: var(--color-text-light);
}
