/* ==========================================
   Toast Notification System
   ========================================== */

/* ---- Container ---- */
.toast-container {
    position: fixed;
    z-index: 2000;
    display: grid;
    gap: 10px;
    pointer-events: none;
    top: 16px;
    right: 16px; /* Default placement */
}

.toast-top-right    { top: 16px; right: 16px; }
.toast-top-left     { top: 16px; left: 16px; }
.toast-top-center   { top: 16px; left: 50%; transform: translateX(-50%); }
.toast-bottom-right { bottom: 16px; right: 16px; }
.toast-bottom-left  { bottom: 16px; left: 16px; }

/* ---- Toast base ---- */
.toast,
.notification {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 300px;
    max-width: 400px;
    padding: 14px 14px 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    pointer-events: auto;
    overflow: hidden;

    /* Enter: slide in from right */
    opacity: 0;
    transform: translateX(110%);
    transition:
        opacity   0.28s cubic-bezier(0.215, 0.61, 0.355, 1),
        transform 0.28s cubic-bezier(0.215, 0.61, 0.355, 1);
}

/* Left-side containers slide from the left */
.toast-top-left .toast,
.toast-bottom-left .toast {
    transform: translateX(-110%);
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.hide {
    opacity: 0;
    transform: translateX(110%);
    pointer-events: none;
}

.toast-top-left .toast.hide,
.toast-bottom-left .toast.hide {
    transform: translateX(-110%);
}

/* ---- Left accent bar ---- */
.toast::before {
    content: '';
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 4px;
    background: var(--border-strong);
    border-radius: var(--radius-xs) 0 0 var(--radius-xs);
}

/* ---- Toast Content wrapper (for horizontal alignment) ---- */
.toast-content {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
}

/* ---- Icon ---- */
.toast-icon {
    flex-shrink: 0;
    font-size: 17px;
    margin-top: 1px;
}

/* ---- Body ---- */
.toast-body {
    flex: 1 1 auto;
    min-width: 0;
}

.toast-title {
    font-size: 13px;
    font-weight: 800;
    margin: 0 0 2px;
}

.toast-message {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0;
}

/* ---- Close button ---- */
.toast-close {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: inline-grid;
    place-items: center;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s ease, background 0.15s ease;
    margin-top: -2px;
}

.toast-close:hover {
    opacity: 1;
    background: var(--surface-muted);
}

/* ---- Progress bar (auto-dismiss timer) ---- */
.toast-progress {
    position: absolute;
    bottom: 0;
    inset-inline-start: 0;
    inset-inline-end: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    overflow: hidden;
    pointer-events: none;
}

.toast-progress-bar {
    height: 100%;
    width: 100%;
    background: currentColor;
    opacity: 0.7;
}

/* ==========================================
   Toast Variants
   ========================================== */

/* Success */
.toast-success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: var(--success);
}
.toast-success::before { background: var(--success); }
.toast-success .toast-message { color: var(--success-800); }

/* Warning */
.toast-warning {
    border-color: #fde68a;
    background: #fffbeb;
    color: var(--warning);
}
.toast-warning::before { background: var(--warning); }
.toast-warning .toast-message { color: var(--warning-800); }

/* Danger */
.toast-danger,
.toast-error {
    border-color: #fecaca;
    background: #fef2f2;
    color: var(--danger);
}
.toast-danger::before,
.toast-error::before { background: var(--danger); }
.toast-danger .toast-message,
.toast-error .toast-message { color: var(--danger-800); }

/* Info */
.toast-info {
    border-color: #bae6fd;
    background: #f0f9ff;
    color: var(--info);
}
.toast-info::before { background: var(--info); }
.toast-info .toast-message { color: #075985; }

/* Primary */
.toast-primary {
    border-color: var(--primary-100);
    background: var(--primary-50);
    color: var(--primary);
}
.toast-primary::before { background: var(--primary); }

/* ==========================================
   Dark Theme overrides for Toast Notifications
   ========================================== */
[data-theme="dark"] .toast,
[data-theme="dark"] .notification {
    background: var(--surface) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
    box-shadow: var(--shadow-lg) !important;
}

[data-theme="dark"] .toast-success {
    border-color: var(--status-success-border) !important;
    color: var(--status-success-text) !important;
    background: var(--surface) !important;
}
[data-theme="dark"] .toast-success .toast-message {
    color: var(--status-success-text) !important;
}

[data-theme="dark"] .toast-warning {
    border-color: var(--status-warning-border) !important;
    color: var(--status-warning-text) !important;
    background: var(--surface) !important;
}
[data-theme="dark"] .toast-warning .toast-message {
    color: var(--status-warning-text) !important;
}

[data-theme="dark"] .toast-danger,
[data-theme="dark"] .toast-error {
    border-color: var(--status-danger-border) !important;
    color: var(--status-danger-text) !important;
    background: var(--surface) !important;
}
[data-theme="dark"] .toast-danger .toast-message,
[data-theme="dark"] .toast-error .toast-message {
    color: var(--status-danger-text) !important;
}

[data-theme="dark"] .toast-info {
    border-color: var(--status-info-border) !important;
    color: var(--status-info-text) !important;
    background: var(--surface) !important;
}
[data-theme="dark"] .toast-info .toast-message {
    color: var(--status-info-text) !important;
}

[data-theme="dark"] .toast-progress {
    background: rgba(255, 255, 255, 0.08) !important;
}
[data-theme="dark"] .toast-progress-bar {
    background: currentColor !important;
}

