/* ─────────────────────────────────────────────────────────────────────────────
   toast.css — BRAIN Toast Notifications
   Minimal, calm, consistent with app design system.
   ───────────────────────────────────────────────────────────────────────────── */

/* ── Container ─────────────────────────────────────────────────────────────── */

#toast-container {
    position: fixed;
    top: 1.25rem;
    inset-inline-end: 1.25rem;
    z-index: var(--z-toast, 9999);
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    width: 320px;
}

/* ── Base Toast ─────────────────────────────────────────────────────────────── */

.toast {
    pointer-events: all;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 8px;
    position: relative;
    overflow: hidden;

    background: rgba(9, 14, 24, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-inline-start: 3px solid var(--toast-accent, #2b7fff);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);

    font-family: var(--font-sans);
    cursor: default;
    user-select: none;

    opacity: 0;
    transform: translateY(-5px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

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

.toast.toast--hiding {
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.14s ease, transform 0.14s ease;
}

/* ── Icon ───────────────────────────────────────────────────────────────────── */

.toast__icon {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.toast__icon svg {
    width: 14px;
    height: 14px;
    stroke: var(--toast-accent, #2b7fff);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── Body ───────────────────────────────────────────────────────────────────── */

.toast__body {
    flex: 1;
    min-width: 0;
}

.toast__title {
    font-size: var(--text-sm, 0.8rem);
    font-weight: 600;
    color: var(--text-primary, #f0f5ff);
    line-height: 1.35;
}

.toast__message {
    font-size: var(--text-xs, 0.69rem);
    font-weight: 400;
    color: var(--text-secondary, #8aafc8);
    line-height: 1.4;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Close ──────────────────────────────────────────────────────────────────── */

.toast__close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 1px;
    border-radius: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.28;
    transition: opacity 0.12s;
    padding: 0;
}

.toast__close:hover {
    opacity: 0.75;
}

.toast__close svg {
    width: 11px;
    height: 11px;
    stroke: var(--text-primary, #f0f5ff);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
}

/* ── Variants ───────────────────────────────────────────────────────────────── */

.toast--success { --toast-accent: #22c55e; }
.toast--error   { --toast-accent: #f43f5e; }
.toast--warning { --toast-accent: #f59e0b; }
.toast--info    { --toast-accent: #2b7fff; }
.toast--loading { --toast-accent: #60a5fa; }

/* ── Spinner (loading only) ─────────────────────────────────────────────────── */

.toast__spinner {
    width: 14px;
    height: 14px;
    border: 1.5px solid rgba(96, 165, 250, 0.2);
    border-top-color: #60a5fa;
    border-radius: 50%;
    animation: toast-spin 0.7s linear infinite;
}

@keyframes toast-spin {
    to { transform: rotate(360deg); }
}

/* ── Mobile ─────────────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    #toast-container {
        top: auto;
        bottom: 1rem;
        inset-inline-end: 0.75rem;
        inset-inline-start: 0.75rem;
        width: auto;
    }

    .toast {
        transform: translateY(6px);
    }
    .toast.toast--visible  { transform: translateY(0); }
    .toast.toast--hiding   { transform: translateY(5px); }
}

/* ── Reduced motion ─────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .toast { transition: opacity 0.12s ease !important; transform: none !important; }
    .toast__spinner { animation: none !important; }
}
