/**
 * ظاهر اعلان‌های گوشه‌ی صفحه (toast).
 *
 * چون RTL است، اعلان‌ها در گوشه‌ی پایین-چپ می‌نشینند تا با محتوای اصلی
 * (که راست‌چین است) تداخل کمتری داشته باشند.
 */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(360px, calc(100vw - 40px));
    pointer-events: none;
}

.toast {
    --toast-surface: var(--bg-card, var(--auth-surface, #ffffff));
    --toast-text: var(--text-primary, var(--auth-text, #1f2933));
    --toast-muted: var(--text-muted, var(--auth-muted, #667085));
    --toast-border: var(--border-color, var(--auth-line, #e3e8ef));

    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--toast-surface);
    border: 1px solid var(--toast-border);
    border-inline-start: 4px solid var(--toast-accent, #6b7280);
    box-shadow: 0 8px 24px rgba(16, 24, 40, 0.14);
    font-size: 13px;
    line-height: 1.9;
    color: var(--toast-text);
    cursor: pointer;

    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

html[data-theme="dark"] .toast {
    --toast-surface: var(--bg-card, var(--auth-surface, #1b1e2d));
    --toast-text: var(--text-primary, var(--auth-text, #f2f3f8));
    --toast-muted: var(--text-muted, var(--auth-muted, #a8aec2));
    --toast-border: var(--border-color, var(--auth-line, #303448));
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.38);
}

.toast.is-in { opacity: 1; transform: translateY(0); }
.toast.is-leaving { opacity: 0; transform: translateY(-10px); }

.toast__icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    background: var(--toast-accent, #6b7280);
    margin-top: 1px;
}

.toast__body { flex: 1; min-width: 0; word-break: break-word; color: inherit; }
.toast__body > div { color: inherit; }
.toast__title { font-weight: 700; margin-bottom: 2px; }

.toast__close {
    flex-shrink: 0;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    color: var(--toast-muted);
    padding: 0 2px;
}
.toast__close:hover { color: var(--toast-text); }

/* رنگ هر نوع */
.toast--success { --toast-accent: #16a34a; }
.toast--error   { --toast-accent: #dc2626; }
.toast--warning { --toast-accent: #d97706; }
.toast--info    { --toast-accent: #2563eb; }

@media (max-width: 480px) {
    .toast-container { left: 10px; right: 10px; bottom: 10px; max-width: none; }
}
