/* States and small blocks: empty states, errors, skeletons at their final size, the chantier's path. */

/* — Empty state: a useful sentence and an action ----------------------------------------------------------------- */
.vide {
    display: grid;
    justify-items: center;
    gap: var(--space-2);
    padding: var(--space-8) var(--space-5);
    border: var(--border-width) dashed var(--border-subtle);
    border-radius: var(--radius-lg);
    text-align: center;
}

.vide__icone {
    display: grid;
    width: var(--space-12);
    height: var(--space-12);
    margin-bottom: var(--space-1);
    place-items: center;
    border-radius: var(--radius-lg);
    background: var(--ink-100);
    color: var(--text-mute);
}

.vide__titre { font-weight: var(--weight-semibold); }
.vide__texte { max-width: 44ch; color: var(--text-dim); font-size: var(--text-sm); }
.vide__action { margin-top: var(--space-3); }

/* — Error: a clear message and « Réessayer » ------------------------------------------------------------------------- */
.probleme {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    border: var(--border-width) solid var(--error-border);
    border-radius: var(--radius-lg);
    background: var(--error-bg);
    color: var(--error-text);
}

.probleme__icone { flex: none; }
.probleme__texte { flex: 1 1 16ch; font-size: var(--text-sm); font-weight: var(--weight-medium); }

/* — Skeletons: the final size, a soft breathing (opacity only) ----------------------------------------------------- */
.squelette {
    border-radius: var(--radius-lg);
    background: var(--ink-100);
    animation: respiration var(--dur-shimmer) var(--ease) infinite;
}

.squelette--titre { width: 40%; height: var(--space-4); border-radius: var(--radius-sm); }
.squelette--ligne { height: var(--space-12); }
.squelette--carte { height: calc(var(--space-24) + var(--space-8)); }
.squelette--bloc { height: calc(var(--space-24) + var(--space-16)); }
.squelette--agent { height: calc(var(--space-6) * 2 + var(--space-1) + var(--space-3) * 2); border-radius: 0; }

.squelette-vue {
    display: grid;
    gap: var(--space-4);
}

.squelette-vue__agents {
    display: grid;
    gap: var(--space-px);
    overflow: hidden;
    border: var(--border-width) solid var(--border-subtle);
    border-radius: var(--radius-lg);
}

.chargement {
    display: grid;
    gap: var(--space-3);
}

/* — The chantier's path: five steps, the current one alive ---------------------------------------------------------- */
.parcours {
    display: grid;
    gap: var(--space-2);
}

.parcours__etapes {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--space-1);
}

.parcours__etape {
    display: grid;
    gap: var(--space-2);
    min-width: 0;
}

.parcours__trait {
    position: relative;
    height: var(--space-1);
    overflow: hidden;
    border-radius: var(--radius-full);
    background: var(--border-subtle);
}

.parcours__etape--a-venir .parcours__trait { background: var(--border-subtle); }
.parcours__etape--faite .parcours__trait { background: var(--text-soft); }
.parcours__etape--courante .parcours__trait { background: var(--accent); }
.parcours__etape--bloquee .parcours__trait { background: var(--error); }
.parcours__etape--attente .parcours__trait { background: var(--warning); }

.parcours__etape--courante .parcours__trait::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--bg-elevated);
    opacity: 0.5;
    transform: translateX(-100%);
    animation: balayage var(--dur-pulse) var(--ease) infinite;
}

.parcours__nom {
    display: none;
    overflow: hidden;
    color: var(--text-mute);
    font-size: var(--text-2xs);
    font-weight: var(--weight-medium);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.parcours__etape--faite .parcours__nom { color: var(--text-dim); }
.parcours__etape--courante .parcours__nom { color: var(--accent-text); font-weight: var(--weight-bold); }
.parcours__etape--bloquee .parcours__nom { color: var(--error-text); font-weight: var(--weight-bold); }
.parcours__etape--attente .parcours__nom { color: var(--warning-text); font-weight: var(--weight-bold); }

.parcours__texte {
    color: var(--text-soft);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
}

.parcours--noms .parcours__texte { font-size: var(--text-base); font-weight: var(--weight-semibold); color: var(--text); }

@keyframes balayage {
    to {
        transform: translateX(100%);
    }
}

/* A note of the detail views (« Aucune tâche récente. »). */
.fiche__note {
    color: var(--text-dim);
    font-size: var(--text-sm);
}

/* — Toasts: the outcome of an action -------------------------------------------------------------------------------- */
.toasts {
    position: fixed;
    right: 0;
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--space-3));
    left: 0;
    z-index: var(--z-toast);
    display: grid;
    justify-items: center;
    gap: var(--space-2);
    padding: 0 var(--space-4);
    pointer-events: none;
}

.defilement-bloque .toasts { bottom: calc(var(--touch-min) * 2 + var(--space-10) + env(safe-area-inset-bottom)); }

.toast {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: var(--space-3);
    align-items: center;
    width: 100%;
    max-width: var(--sheet-w);
    padding: var(--space-2) var(--space-1) var(--space-2) var(--space-3);
    border: var(--border-width) solid var(--border-subtle);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-xl);
    color: var(--text);
    pointer-events: auto;
    animation: apparition var(--dur-slow) var(--ease-spring);
}

.toast--sortie { animation: disparition var(--dur) var(--ease-in) forwards; }

.toast__icone {
    width: var(--space-8);
    height: var(--space-8);
    padding: var(--space-2);
    border-radius: var(--radius-full);
}

.toast--succes .toast__icone { background: var(--success-bg); color: var(--success-text); }
.toast--erreur .toast__icone { background: var(--error-bg); color: var(--error-text); }
.toast--alerte .toast__icone { background: var(--warning-bg); color: var(--warning-text); }
.toast--info .toast__icone { background: var(--info-bg); color: var(--info-text); }
.toast__texte { font-size: var(--text-sm); font-weight: var(--weight-medium); line-height: var(--leading-snug); }

.toast__fermer {
    display: grid;
    width: var(--touch-min);
    height: var(--touch-min);
    place-items: center;
    border-radius: var(--radius-md);
    color: var(--text-mute);
}

.toast__fermer:hover { background: var(--ink-100); color: var(--text); }

@media (min-width: 768px) {
    .toasts,
    .defilement-bloque .toasts {
        right: var(--space-6);
        bottom: var(--space-6);
        left: auto;
        width: var(--sheet-w);
        justify-items: end;
        padding: 0;
    }
}
