/* ═══════════════════════════════════════
   toast.css — Suivi Colis
   Système de notifications toast avec animations
   À inclure sur toutes les pages
   ═══════════════════════════════════════ */

/* ── Conteneur ── */
#toast-container {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

/* ── Toast de base ── */
.toast {
    pointer-events: all;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    max-width: 380px;
    padding: 13px 14px;
    border-radius: 11px;
    border: 1.5px solid transparent;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.4;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;

    /* État initial — invisible et décalé */
    opacity: 0;
    transform: translateX(24px);
    transition: opacity 0.3s ease, transform var(--transition-bounce);
}

.toast.toast-visible {
    opacity: 1;
    transform: translateX(0);
}

.toast.toast-hiding {
    opacity: 0;
    transform: translateX(24px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

/* ── Variantes ── */
.toast-success {
    background: var(--color-success-light);
    border-color: var(--color-success-border);
    color: var(--color-success);
}

.toast-error {
    background: var(--color-error-light);
    border-color: var(--color-error-border);
    color: var(--color-error);
}

.toast-info {
    background: var(--color-primary-light);
    border-color: #90b4f0;
    color: #1a3a6a;
}

.toast-warning {
    background: #fff8e1;
    border-color: #ffb74d;
    color: #e65100;
}

/* ── Icône ── */
.toast-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.toast-icon svg {
    width: 18px;
    height: 18px;
}

/* ── Message ── */
.toast-message {
    flex: 1;
}

/* ── Bouton fermer ── */
.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    opacity: 0.5;
    display: flex;
    align-items: center;
    transition: opacity var(--transition-base);
    color: inherit;
}

.toast-close:hover {
    opacity: 1;
}

.toast-close:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
    border-radius: 4px;
    opacity: 1;
}

.toast-close svg {
    width: 14px;
    height: 14px;
}

/* ── Barre de progression ── */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    border-radius: 0 0 11px 11px;
    transform-origin: left;
    transform: scaleX(1);
}

.toast-success .toast-progress {
    background: #43a047;
}

.toast-error .toast-progress {
    background: #e53935;
}

.toast-info .toast-progress {
    background: var(--color-primary);
}

.toast-warning .toast-progress {
    background: var(--color-warning);
}

.toast-progress.toast-progress-run {
    animation: toastProgress linear forwards;
}

@keyframes toastProgress {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

/* ══ MODE SOMBRE ══ */
[data-theme="dark"] .toast-success {
    background: #0f2a18;
    border-color: var(--color-success);
    color: #a5d6a7;
}

[data-theme="dark"] .toast-error {
    background: #2a0f0f;
    border-color: var(--color-error);
    color: #ef9a9a;
}

[data-theme="dark"] .toast-info {
    background: #0f1e3a;
    border-color: #1a4a8a;
    color: #90b4f0;
}

[data-theme="dark"] .toast-warning {
    background: #2a1f0a;
    border-color: #f57c00;
    color: #ffb74d;
}

/* ══ RESPONSIVE ══ */
@media (max-width: 640px) {
    #toast-container {
        bottom: var(--spacing-md);
        right: var(--spacing-md);
        left: var(--spacing-md);
    }

    .toast {
        min-width: unset;
        max-width: 100%;
    }
}