/* Global flash toasts */
.toast-container {
    position: fixed;
    top: 88px;
    right: 22px;
    z-index: 2100;
    width: min(420px, calc(100vw - 28px));
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast-container .app-toast {
    --toast-accent: var(--ems-primary-600);
    --toast-accent-soft: var(--ems-primary-50);
    --toast-ink: var(--ems-neutral-900);
    --toast-muted: var(--ems-neutral-500);
    position: relative;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    gap: 12px;
    align-items: start;
    width: 100%;
    min-height: 64px;
    margin: 0;
    padding: 14px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-left: 4px solid var(--toast-accent);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.98);
    color: var(--toast-ink);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
    animation: toastSlideIn 0.22s ease-out;
    overflow: hidden;
    pointer-events: auto;
}

.toast-container .app-toast::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--toast-accent), rgba(255, 255, 255, 0));
    opacity: 0.55;
}

.toast-container .app-toast--success {
    --toast-accent: #16a34a;
    --toast-accent-soft: #ecfdf3;
}

.toast-container .app-toast--danger,
.toast-container .app-toast--error {
    --toast-accent: var(--ems-danger);
    --toast-accent-soft: #fef2f2;
}

.toast-container .app-toast--warning {
    --toast-accent: var(--ems-warning-600);
    --toast-accent-soft: #fffbeb;
}

.toast-container .app-toast--info {
    --toast-accent: var(--ems-primary-600);
    --toast-accent-soft: var(--ems-primary-50);
}

.app-toast__icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--toast-accent-soft);
    color: var(--toast-accent);
    font-size: 0.9rem;
}

.app-toast__body {
    min-width: 0;
    padding-top: 2px;
    color: var(--toast-ink);
    font-size: 0.92rem;
    font-weight: 650;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.app-toast__close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--toast-muted);
    cursor: pointer;
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.app-toast__close:hover,
.app-toast__close:focus {
    background: var(--ems-neutral-100);
    color: var(--toast-ink);
    transform: translateY(-1px);
    outline: none;
}

.toast-container .app-toast.fade-out {
    animation: toastSlideOut 0.22s ease-in forwards;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(22px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(22px);
        opacity: 0;
    }
}

/* Auth səhifələri (login/logout) — navbar yoxdur, ona görə daha yuxarıda; FA
   yüklənmədiyi üçün sadə Bootstrap alert üzən toast kimi göstərilir. */
/* `.auth-body` prefiksi: mobil @media-dəki `.toast-container` override-indən
   yuxarı spesifiklik (auth toast həmişə sağ-yuxarı kompakt qalsın). */
.auth-body .auth-toast-container {
    top: 18px;
    right: 18px;
    left: auto;
    width: min(380px, calc(100vw - 36px));
}

.auth-body .auth-toast-container .auth-toast {
    margin: 0;
    pointer-events: auto;
    border-radius: 10px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
    animation: toastSlideIn 0.22s ease-out;
}

.auth-body .auth-toast-container .auth-toast.fade-out {
    animation: toastSlideOut 0.22s ease-in forwards;
}

@media (max-width: 640px) {
    .toast-container {
        top: 76px;
        right: 14px;
        left: 14px;
        width: auto;
    }

    .toast-container .app-toast {
        grid-template-columns: 32px minmax(0, 1fr) 32px;
        padding: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .toast-container .app-toast,
    .toast-container .app-toast.fade-out {
        animation: none;
    }
}
