/* Shared components: buttons, status chips, section headers. */

/* — Buttons: 44 px at least, one main call per view (§4) -------------------------------------------------------- */
.bouton {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: var(--touch-min);
    padding: 0 var(--space-4);
    border: var(--border-width) solid transparent;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    line-height: var(--leading-tight);
    text-align: center;
    white-space: nowrap;
    user-select: none;
    transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
        color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-instant) var(--ease);
}

.bouton:active { transform: scale(0.98); }
.bouton[aria-disabled="true"] { cursor: not-allowed; opacity: 0.55; }
.bouton[aria-disabled="true"]:active { transform: none; }
.bouton[aria-busy="true"] { cursor: progress; opacity: 1; }

.bouton__libelle {
    overflow: hidden;
    text-overflow: ellipsis;
}

.bouton--principal {
    background: var(--accent);
    box-shadow: var(--shadow-sm), var(--shadow-inset);
    color: var(--on-accent);
}

.bouton--principal:hover { background: var(--accent-hover); }

.bouton--secondaire {
    border-color: var(--border-subtle);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-xs);
    color: var(--text);
}

.bouton--secondaire:hover { border-color: var(--border); background: var(--paper-soft); }

.bouton--discret {
    padding: 0 var(--space-3);
    color: var(--text-soft);
}

.bouton--discret:hover { background: var(--ink-100); color: var(--text); }

.bouton--danger {
    background: var(--error);
    box-shadow: var(--shadow-sm);
    color: var(--on-error);
}

.bouton--danger:hover { background: var(--error-text); }
.bouton--alarme { color: var(--error-text); }
.bouton--alarme:hover { color: var(--error-text); }

.bouton--icone {
    width: var(--touch-min);
    padding: 0;
}

/* Working: a ring turns in place of the icon; the label says « Envoi… ». */
.bouton--attente .bouton__icone { display: none; }

.bouton--attente::before {
    content: "";
    flex: none;
    width: var(--space-4);
    height: var(--space-4);
    margin: 0 calc(var(--space-1) / 2);
    border: var(--border-width-thick) solid currentColor;
    border-right-color: transparent;
    border-radius: var(--radius-full);
    animation: rotation var(--dur-spin) linear infinite;
}

/* — Status chip: a dot and a text, never the colour alone ------------------------------------------------------- */
.puce {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    max-width: 100%;
    min-height: var(--space-6);
    padding: 0 var(--space-2);
    border: var(--border-width) solid transparent;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    line-height: var(--leading-tight);
    white-space: nowrap;
}

.puce__point {
    position: relative;
    flex: none;
    width: var(--space-2);
    height: var(--space-2);
    border-radius: var(--radius-full);
    background: currentColor;
}

.puce__texte {
    overflow: hidden;
    text-overflow: ellipsis;
}

.puce--neutre { border-color: var(--border-subtle); background: var(--ink-100); color: var(--text-on-sunken); }
.puce--neutre .puce__point { background: transparent; box-shadow: inset 0 0 0 var(--border-width-thick) currentColor; }
.puce--info { border-color: var(--info-border); background: var(--info-bg); color: var(--info-text); }
.puce--succes { border-color: var(--success-border); background: var(--success-bg); color: var(--success-text); }
.puce--alerte { border-color: var(--warning-border); background: var(--warning-bg); color: var(--warning-text); }
.puce--erreur { border-color: var(--error-border); background: var(--error-bg); color: var(--error-text); }
.puce--direct { border-color: color-mix(in srgb, var(--accent) 30%, transparent); background: var(--accent-soft); color: var(--accent-text); }

.puce--direct .puce__point::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: inherit;
    animation: pulsation var(--dur-pulse) var(--ease-out) infinite;
}

/* — Sections -------------------------------------------------------------------------------------------------------- */
.section {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-3);
    align-content: start;
    min-width: 0;
}

.section + .section { margin-top: var(--space-8); }

.section__entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    min-height: var(--space-8);
}

.section__titre {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-dim);
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-widest);
    line-height: var(--leading-tight);
    text-transform: uppercase;
}

.section__compte {
    min-width: var(--space-5);
    padding: 0 var(--space-2);
    border-radius: var(--radius-full);
    background: var(--ink-100);
    color: var(--text-soft);
    font-size: var(--text-2xs);
    letter-spacing: var(--tracking-base);
    line-height: var(--leading-loose);
    text-align: center;
}

.section__action { justify-self: start; }
.section--alerte .section__compte { background: var(--warning-bg); color: var(--warning-text); }

/* — Segmented filter (Chantiers) ----------------------------------------------------------------------------------- */
.segments {
    display: flex;
    gap: var(--space-1);
    margin: 0 calc(var(--space-4) * -1);
    padding: 0 var(--space-4) var(--space-1);
    overflow-x: auto;
    scrollbar-width: none;
    scroll-padding-inline: var(--space-4);
}

.segments::-webkit-scrollbar { display: none; }

.segments__option {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: var(--space-2);
    min-height: var(--touch-min);
    padding: 0 var(--space-4);
    border: var(--border-width) solid var(--border-subtle);
    border-radius: var(--radius-full);
    background: var(--bg-elevated);
    color: var(--text-soft);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.segments__option:hover { border-color: var(--border); color: var(--text); }
.segments__option[aria-current="true"] { border-color: var(--text); background: var(--text); color: var(--bg-elevated); }

.segments__libelle { white-space: nowrap; }

.segments__compte {
    min-width: var(--space-5);
    padding: 0 var(--space-1);
    border-radius: var(--radius-full);
    background: var(--ink-100);
    color: var(--text-soft);
    font-size: var(--text-2xs);
    line-height: var(--leading-loose);
    text-align: center;
}

.segments__option[aria-current="true"] .segments__compte { background: color-mix(in srgb, var(--bg-elevated) 22%, transparent); color: var(--bg-elevated); }
.segments__option--vide .segments__compte { background: transparent; color: var(--text-dim); }

/* — Toggle chips (feed, console sessions) ----------------------------------------------------------------------- */
.filtres {
    display: flex;
    gap: var(--space-2);
    margin: 0 calc(var(--space-4) * -1);
    padding: 0 var(--space-4);
    overflow-x: auto;
    scrollbar-width: none;
}

.filtres::-webkit-scrollbar { display: none; }

.filtres__option {
    flex: none;
    min-height: var(--touch-min);
    padding: 0 var(--space-4);
    border: var(--border-width) solid var(--border-subtle);
    border-radius: var(--radius-full);
    background: var(--bg-elevated);
    color: var(--text-soft);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.filtres__option:hover { border-color: var(--border); color: var(--text); }
.filtres__option[aria-pressed="true"] { border-color: var(--text); background: var(--text); color: var(--bg-elevated); font-weight: var(--weight-semibold); }

.filtre-actif {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    justify-self: start;
    padding-left: var(--space-3);
    border-radius: var(--radius-full);
    background: var(--accent-soft);
    color: var(--accent-text);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
}

.filtre-actif__texte { white-space: nowrap; }

.filtre-actif__retirer { display: grid; width: var(--touch-min); height: var(--touch-min); place-items: center; border-radius: var(--radius-full); }
