/* ============================================================================
   SAWYAN V3.0 — Unified Modern UI Feedback Kit (Toast, Confirm, Prompt, Alert)
   Replaces blocking browser alert()/confirm()/prompt() dialogs across portals
   ============================================================================ */

.sw-toast-stack {
    position: fixed;
    top: calc(var(--sawyan-ribbon-h, 0px) + 14px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 10095;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(92vw, 440px);
    pointer-events: none;
    direction: rtl;
    font-family: 'Tajawal', sans-serif;
}

.sw-toast {
    pointer-events: auto;
    background: #ffffff;
    color: #0f172a;
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
    border: 1.5px solid #e2e8f0;
    border-right-width: 5px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.55;
    animation: swToastIn 0.22s ease-out;
}

.sw-toast--success { border-right-color: #10b981; background: #f0fdf4; color: #064e3b; }
.sw-toast--warning { border-right-color: #f59e0b; background: #fffbeb; color: #78350f; }
.sw-toast--error   { border-right-color: #ef4444; background: #fef2f2; color: #7f1d1d; }
.sw-toast--info    { border-right-color: #0284c7; background: #f0f9ff; color: #0c4a6e; }

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

.sw-toast-body {
    flex: 1;
    word-break: break-word;
    white-space: pre-line;
}

.sw-toast-close {
    background: transparent;
    border: none;
    color: inherit;
    opacity: 0.72;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    min-width: 32px;
    min-height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sw-toast-close:hover {
    opacity: 1;
}

@keyframes swToastIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.sw-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10098;
    background: rgba(15, 23, 42, 0.62);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    direction: rtl;
    font-family: 'Tajawal', sans-serif;
}

.sw-dialog-card {
    background: #ffffff;
    border-radius: 18px;
    width: min(94vw, 440px);
    padding: 22px 20px 18px;
    box-shadow: 0 24px 55px rgba(15, 23, 42, 0.32);
    border: 1.5px solid #e2e8f0;
    animation: swDialogPop 0.18s ease-out;
}

@keyframes swDialogPop {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.sw-dialog-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.sw-dialog-badge {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    background: #ecfdf5;
}

.sw-dialog-badge--error   { background: #fef2f2; }
.sw-dialog-badge--warning { background: #fffbeb; }
.sw-dialog-badge--info    { background: #eff6ff; }

.sw-dialog-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 900;
    color: #0f172a;
}

.sw-dialog-msg {
    font-size: 0.9rem;
    color: #334155;
    line-height: 1.65;
    margin: 0 0 14px;
    white-space: pre-line;
}

.sw-dialog-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    font-size: 0.94rem;
    font-family: 'Tajawal', sans-serif;
    margin-bottom: 14px;
}

.sw-dialog-input:focus {
    outline: none;
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.14);
}

.sw-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.sw-btn {
    border: none;
    border-radius: 10px;
    padding: 9px 16px;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.12s ease, opacity 0.12s ease;
}

.sw-btn:active { transform: scale(0.98); }
.sw-btn-primary { background: #059669; color: #ffffff; }
.sw-btn-danger  { background: #dc2626; color: #ffffff; }
.sw-btn-ghost   { background: #f1f5f9; color: #334155; }
.sw-btn-outline { background: #ffffff; color: #065f46; border: 1.5px solid #10b981; }
