/* =========================================================================
   Toast flottants
   Rendus via components/_toasts.html.twig + toast_controller.js
   ========================================================================= */

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    max-width: min(420px, calc(100vw - 2rem));
    pointer-events: none; /* le container laisse passer les clics */
}

.toast {
    pointer-events: auto; /* chaque toast recupere les clics */
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: .625rem;
    padding: .875rem 2.25rem .875rem 1rem;
    background: #fff;
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(15, 23, 42, 0.06);
    font-size: .9rem;
    line-height: 1.4;
    color: var(--color-text, #0f172a);
    overflow: hidden;

    /* Etat initial : hors ecran a droite + transparent */
    opacity: 0;
    transform: translateX(110%);
    transition: opacity 220ms ease, transform 220ms cubic-bezier(.2, .8, .2, 1);
}

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

.toast.is-leaving {
    opacity: 0;
    transform: translateX(110%);
}

.toast__icon {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: .8rem;
    font-weight: 700;
    color: #fff;
    margin-top: 1px;
}

.toast__message {
    flex: 1 1 auto;
    word-break: break-word;
}

.toast__close {
    position: absolute;
    top: .5rem;
    right: .5rem;
    background: transparent;
    border: 0;
    color: var(--color-text-muted, #6b7280);
    font-size: 1.1rem;
    line-height: 1;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    cursor: pointer;
    padding: 0;
    transition: background-color .12s ease, color .12s ease;
}

.toast__close:hover,
.toast__close:focus-visible {
    background: rgba(15, 23, 42, 0.08);
    color: var(--color-text, #0f172a);
    outline: none;
}

.toast__progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: currentColor;
    transform-origin: left center;
    transform: scaleX(1);
    opacity: .45;
}

/* ---- Variantes ------------------------------------------------------------ */
.toast--success {
    border-left: 4px solid #059669;
    color: #065f46;
}
.toast--success .toast__icon { background: #059669; }

.toast--error {
    border-left: 4px solid #dc2626;
    color: #991b1b;
}
.toast--error .toast__icon { background: #dc2626; }

.toast--warning {
    border-left: 4px solid #d97706;
    color: #92400e;
}
.toast--warning .toast__icon { background: #d97706; }

.toast--info {
    border-left: 4px solid #1d4ed8;
    color: #1e3a8a;
}
.toast--info .toast__icon { background: #1d4ed8; }

/* ---- Responsive ----------------------------------------------------------- */
@media (max-width: 640px) {
    .toast-container {
        top: .5rem;
        right: .5rem;
        left: .5rem;
        max-width: none;
    }
}

/* ---- Respecte prefers-reduced-motion ------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .toast {
        transition: opacity 120ms ease;
        transform: none;
    }
    .toast.is-leaving { transform: none; }
    .toast__progress { transition: none !important; }
}
