/* Composant toast (spec 01 §7) et fenêtre de confirmation (§7.6), chargés par les deux
   gabarits. Couleurs du thème (app.css). */

/* Toasts (spec 01 §7) : en haut à droite sur ordinateur, en bas sur téléphone */
.toast-stack {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: min(24rem, calc(100vw - 2rem));
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 0.5rem 0.75rem 0.75rem;
    border-radius: var(--radius);
    border: 1px solid currentColor;
    box-shadow: 0 4px 12px rgb(0 0 0 / 0.18);
    cursor: pointer;
    touch-action: pan-y;
    animation: toast-in 180ms ease-out;
}
.toast-message { flex: 1 1 auto; margin: 0; }
.toast-count { font-weight: 700; }
.toast button { margin: 0; min-height: 24px; }
.toast-action { align-self: center; color: inherit; font-weight: 700; }
.toast-close {
    min-width: 32px;
    padding: 0 0.25rem;
    border: 0;
    background: none;
    color: inherit;
    font-size: 1.25rem;
    line-height: 1;
}
/* Le type se lit aussi par l'icône : la couleur seule ne suffit pas (§7.2) */
.toast-icon { flex: none; width: 1.25rem; font-weight: 700; text-align: center; }
.toast-success { background: var(--color-success-bg); color: var(--color-success-text); }
.toast-success .toast-icon::before { content: "\2713"; }
.toast-info { background: var(--color-info-bg); color: var(--color-info-text); }
.toast-info .toast-icon::before { content: "i"; }
.toast-warning { background: var(--color-warning-bg); color: var(--color-warning-text); }
.toast-warning .toast-icon::before { content: "!"; }
.toast-error { background: var(--color-error-bg); color: var(--color-error-text); }
.toast-error .toast-icon::before { content: "\2715"; }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-0.5rem); }
    to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .toast { animation: none; }
}
@media (max-width: 720px) {
    .toast-stack { top: auto; bottom: 1rem; left: 1rem; right: 1rem; width: auto; flex-direction: column-reverse; }
    html { scroll-padding-bottom: calc(var(--toast-offset, 0px) + 1rem); }
    body { padding-bottom: calc(var(--toast-offset, 0px) + 1rem); }
}

/* Fenêtre de confirmation avant une action destructrice (§7.6) */
.confirm-dialog {
    max-width: min(28rem, calc(100vw - 2rem));
    padding: 1.25rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
}
.confirm-dialog::backdrop { background: rgb(0 0 0 / 0.45); }
.confirm-dialog h2 { margin: 0 0 0.5rem; font-size: 1.15rem; }
.confirm-dialog .actions-row { justify-content: flex-end; }
