/* ==========================================================================
   Speedy Admin — Toast notifications
   Accent-coded cards with a draining progress line that times the dismissal.
   Hovering a toast pauses the line (and therefore the countdown).
   ========================================================================== */

.toast-root {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 120;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
    pointer-events: none;
}

.toast {
    --t-accent: var(--primary);
    --t-soft: var(--primary-soft);
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 13px 14px 15px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg), 0 0 0 3px var(--t-soft);
    font-size: 13.5px;
    overflow: hidden;
    pointer-events: auto;
    animation: toast-in 0.32s cubic-bezier(0.21, 1.02, 0.55, 1.2);
}

.toast-success { --t-accent: var(--success); --t-soft: var(--success-soft); }
.toast-error   { --t-accent: var(--danger);  --t-soft: var(--danger-soft); }
.toast-warning { --t-accent: var(--warning); --t-soft: var(--warning-soft); }
.toast-info    { --t-accent: var(--info);    --t-soft: var(--info-soft); }

.toast.leaving { animation: toast-out 0.22s ease forwards; }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(32px) scale(0.95); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toast-out {
    from { opacity: 1; transform: translateX(0) scale(1); }
    to   { opacity: 0; transform: translateX(32px) scale(0.95); }
}

/* ---------- Icon ---------- */
.toast-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    background: var(--t-soft);
    color: var(--t-accent);
    animation: toast-icon-pop 0.4s cubic-bezier(0.21, 1.02, 0.55, 1.35) 0.08s backwards;
}

@keyframes toast-icon-pop {
    from { transform: scale(0.4); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

/* ---------- Content ---------- */
.toast-content { flex: 1; min-width: 0; padding-top: 1px; }
.toast-title { font-weight: 700; line-height: 1.35; }
.toast-message { margin-top: 1px; color: var(--text-2); font-size: 12.5px; line-height: 1.45; word-break: break-word; }

/* ---------- Close ---------- */
.toast-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
    flex-shrink: 0;
    transition: color var(--transition), background var(--transition);
}
.toast-close:hover { color: var(--text); background: var(--surface-3); }

/* ---------- Progress line (the timer) ---------- */
.toast-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: var(--t-soft);
}
.toast-progress-bar {
    display: block;
    height: 100%;
    background: var(--t-accent);
    transform-origin: left;
    animation-name: toast-drain;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}
/* Hover = pause the line = pause the dismissal countdown */
.toast:hover .toast-progress-bar { animation-play-state: paused; }

@keyframes toast-drain {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

@media (max-width: 640px) {
    .toast-root { left: 16px; right: 16px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
    .toast, .toast-icon { animation-duration: 0.01s; }
}
