/* ═══════════════════════════════════════════════════════════════
   پدیده سرخ — Toast System
   نسخه: ۱.۰
   مستقل از توکن‌ها — کار در تم تیره و روشن
   ═══════════════════════════════════════════════════════════════ */

.toast-container {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 420px;
    width: calc(100% - 32px);
    padding: 0;
}

@media (min-width: 640px) {
    .toast-container {
        left: auto;
        right: 22px;
        transform: none;
        max-width: 400px;
        width: auto;
    }
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 14px;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.7;
    color: #ffffff;
    background: rgba(15, 20, 35, 0.94);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35),
                0 0 0 1px rgba(0, 0, 0, 0.1);
    pointer-events: auto;
    animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    word-break: break-word;
}

/* ─── خط رنگی بالای toast ─── */
.toast::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 3px;
}

.toast-error::before,
.toast-danger::before {
    background: linear-gradient(90deg, transparent, #EF4444, transparent);
}
.toast-success::before {
    background: linear-gradient(90deg, transparent, #10B981, transparent);
}
.toast-warning::before {
    background: linear-gradient(90deg, transparent, #F59E0B, transparent);
}
.toast-info::before,
.toast-debug::before {
    background: linear-gradient(90deg, transparent, #3B82F6, transparent);
}

/* ─── آیکون ─── */
.toast-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}
.toast-icon svg {
    width: 100%;
    height: 100%;
}

.toast-error .toast-icon,
.toast-danger .toast-icon { color: #FCA5A5; }
.toast-success .toast-icon { color: #6EE7B7; }
.toast-warning .toast-icon { color: #FCD34D; }
.toast-info .toast-icon,
.toast-debug .toast-icon { color: #93C5FD; }

/* ─── متن ─── */
.toast-body {
    flex: 1;
    min-width: 0;
    padding-top: 1px;
}

/* ─── دکمه بستن ─── */
.toast-close {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.5);
    transition: color 0.2s, transform 0.2s;
    border-radius: 6px;
    margin-top: 1px;
    font-family: inherit;
}
.toast-close:hover {
    color: #ffffff;
    transform: scale(1.15);
}
.toast-close svg {
    width: 15px;
    height: 15px;
    pointer-events: none;
}

/* ─── انیمیشن ورود ─── */
@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ─── انیمیشن خروج ─── */
.toast-leaving {
    animation: toastOut 0.35s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
        max-height: 300px;
        padding-top: 14px;
        padding-bottom: 14px;
        margin-top: 0;
    }
    to {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        margin-top: -10px;
    }
}

/* ─── موبایل ─── */
@media (max-width: 480px) {
    .toast {
        padding: 12px 14px;
        font-size: 13px;
        border-radius: 12px;
    }
    .toast-icon { width: 20px; height: 20px; }
    .toast-close { width: 20px; height: 20px; }
    .toast-close svg { width: 14px; height: 14px; }
}

/* ─── حالت کم‌تحرک ─── */
@media (prefers-reduced-motion: reduce) {
    .toast,
    .toast-leaving {
        animation-duration: 0.01ms !important;
    }
}
