/* ============================================================
   TOAST NOTIFICATIONS
   Shared by the public site (layouts/app) and the admin panel
   (layouts/admin). Uses only literals + --main/--secondary so it
   renders identically in both contexts.

   The item class is .toast-item, NOT .toast, on purpose: the admin
   loads Bootstrap 5, whose own .toast component ships
   `.toast:not(.show){display:none}`. A bare .toast here would lose
   that specificity fight and every notification would render
   invisibly, in the DOM but never on screen.
   ============================================================ */

.toast-rail {
    position: fixed;
    top: var(--toast-top, 1.25rem);
    right: 1.25rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    width: min(92vw, 380px);
    pointer-events: none;
}

/* The public site has a fixed header — sit clear of it. */
.toast-rail.is-site {
    --toast-top: calc(76px + 1rem);
}

.toast-item {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.9rem 1rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(var(--secondary-rgb), 0.07);
    box-shadow: 0 26px 60px rgba(var(--secondary-rgb), 0.12);
    font-family: var(--font-body, system-ui), system-ui, sans-serif;
    font-size: 0.9rem;
    color: var(--ink);
    animation: toastIn 0.38s cubic-bezier(0.2, 0, 0, 1) both;
}

.toast-item.is-success {
    border-left: 3px solid var(--success);
}

.toast-item.is-danger {
    border-left: 3px solid var(--danger);
}

.toast-item.is-warning {
    border-left: 3px solid var(--warning);
}

.toast-item.is-info {
    border-left: 3px solid var(--main, var(--main));
}

.toast-item .toast-icon {
    font-size: 1.15rem;
    line-height: 1.3;
    flex-shrink: 0;
}

.toast-item.is-success .toast-icon {
    color: var(--success);
}

.toast-item.is-danger .toast-icon {
    color: var(--danger);
}

.toast-item.is-warning .toast-icon {
    color: var(--warning);
}

.toast-item.is-info .toast-icon {
    color: var(--main, var(--main));
}

.toast-item .toast-text {
    flex: 1;
    line-height: 1.5;
    color: var(--secondary, var(--secondary));
}

.toast-item .toast-close {
    background: none;
    border: 0;
    padding: 0;
    line-height: 1;
    font-size: 1rem;
    color: var(--muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.2s;
}

.toast-item .toast-close:hover {
    color: var(--secondary);
}

.toast-item .toast-close:focus-visible {
    outline: 2px solid var(--main, var(--main));
    outline-offset: 2px;
    border-radius: 4px;
}

.toast-item.is-leaving {
    animation: toastOut 0.3s cubic-bezier(0.2, 0, 0, 1) forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(24px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateX(24px) scale(0.97);
    }
}

@media (max-width: 991px) {
    .toast-rail.is-site {
        --toast-top: calc(64px + 0.75rem);
    }
}

@media (max-width: 600px) {
    .toast-rail {
        left: 1rem;
        right: 1rem;
        width: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .toast-item,
    .toast-item.is-leaving {
        animation: none !important;
    }
}
