/* ===================================================================
   Toast Notification System
   =================================================================== */
.toast-container {
    position: fixed;
    top: 80px;
    left: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 420px;
    pointer-events: none;
}

[dir="rtl"] .toast-container {
    left: auto;
    right: 20px;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--c-surface);
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
    border-right: 4px solid var(--c-primary);
    pointer-events: auto;
    animation: toast-slide-in 0.25s ease-out;
    min-width: 280px;
    color: var(--c-text);
}

@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

[dir="rtl"] .toast {
    border-right: 0;
    border-left: 4px solid var(--c-primary);
    animation-name: toast-slide-in-rtl;
}

@keyframes toast-slide-in-rtl {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-icon {
    flex-shrink: 0;
    font-size: 24px;
    color: var(--c-primary);
}

.toast-body {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 2px;
}

.toast-msg {
    font-size: 13px;
    line-height: 1.4;
    color: var(--c-text-soft);
    word-wrap: break-word;
}

.toast-close {
    flex-shrink: 0;
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 2px;
    color: var(--c-text-muted);
    border-radius: 4px;
    transition: background 0.15s;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--c-text);
}

.toast-close .material-symbols-rounded {
    font-size: 18px;
}

/* ===== Color variants ===== */
.toast-success {
    border-color: #16a34a;
}
.toast-success .toast-icon {
    color: #16a34a;
}

.toast-error {
    border-color: #dc2626;
}
.toast-error .toast-icon {
    color: #dc2626;
}

.toast-warning {
    border-color: #f59e0b;
}
.toast-warning .toast-icon {
    color: #f59e0b;
}

.toast-info {
    border-color: #3b82f6;
}
.toast-info .toast-icon {
    color: #3b82f6;
}

/* ===== Action button + progress (Undo etc.) ===== */
.toast.with-action { padding-inline-end: 8px; }
.toast-action {
    background: rgba(255, 255, 255, .15);
    color: white;
    border: 1px solid rgba(255, 255, 255, .25);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    transition: all .15s;
    margin-inline-start: 8px;
}
.toast-action:hover:not(:disabled) {
    background: rgba(255, 255, 255, .28);
    transform: translateY(-1px);
}
.toast-action:disabled { opacity: .6; cursor: not-allowed; }
.toast-action .material-symbols-rounded { font-size: 16px; }

/* الـ action button داخل toasts success/info — يبقى مرئياً على خلفية ملوّنة */
.toast-success .toast-action,
.toast-info .toast-action,
.toast-warning .toast-action,
.toast-error .toast-action { background: rgba(0, 0, 0, .18); border-color: rgba(0, 0, 0, .2); color: white; }
.toast-success .toast-action:hover:not(:disabled),
.toast-info .toast-action:hover:not(:disabled),
.toast-warning .toast-action:hover:not(:disabled),
.toast-error .toast-action:hover:not(:disabled) { background: rgba(0, 0, 0, .3); }

/* Countdown progress bar في الأسفل */
.toast { position: relative; overflow: hidden; }
.toast-progress {
    position: absolute;
    inset-inline-start: 0;
    inset-block-end: 0;
    height: 3px;
    width: 100%;
    background: rgba(255, 255, 255, .35);
    transform-origin: inset-inline-start center;
    animation-name: toastProgress;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}
@keyframes toastProgress {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}
