/* ===================================================
   Toast Notification - کامل، هماهنگ با Bootstrap 4.5.3
   بدون فضای سفید اضافی | ارتفاع خودکار | انیمیشن نرم
   =================================================== */

/* ظرف اصلی (position fixed) */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 24px;
    /* راست‌چین: در صورت نیاز right: 24px */
    z-index: 99999;
    display: block;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    /* اجازه کلیک به المان‌های زیرین */
    direction: rtl;
    /* راست‌چین */
}

/* خود toast (override ملایم Bootstrap) */
.toast {
    min-width: 280px;
    max-width: 360px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: none;
    /* حذف border پیش‌فرض */
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    /* خود toast قابل کلیک (دکمه بستن) */
    overflow: hidden;
}

/* نمایش با انیمیشن (Bootstrap کلاس .show را اضافه می‌کند) */
.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* هدر toast */
.toast-header {
    padding: 8px 15px;
    /* کاهش padding عمودی */
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

/* آیکون دایره‌ای سفارشی */
.toast-icon {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 15px;
    font-weight: bold;
    flex-shrink: 0;
}

/* بدنه (بدون فضای اضافی) */
.toast-body {
    padding: 8px 15px;
    /* عمودی کمتر */
    margin: 0;
    /* حذف margin پیش‌فرض */
    font-size: 0.85rem;
    color: #475569;
    line-height: 1.4;
    /* فشرده برای حذف شکاف عمودی */
}

/* رفع margin احتمالی در عناصر داخلی toast-body */
.toast-body p,
.toast-body span {
    margin: 0;
    line-height: inherit;
}

/* دکمه بستن (override Bootstrap) */
.toast .close {
    padding: 0;
    background: transparent;
    border: none;
    font-size: 1.2rem;
    color: #94a3b8;
    opacity: 1;
    transition: color 0.2s;
}

.toast .close:hover {
    color: #0f172a;
}

/* ===== رنگ‌بندی بر اساس نوع پیام ===== */
/* موفقیت */
.toast-success {
    border-right: 4px solid #28a745;
}

.toast-success .toast-icon {
    background: #dcfce7;
    color: #15803d;
}

.toast-success .toast-header strong {
    color: #15803d;
}

/* خطا */
.toast-error {
    border-right: 4px solid #dc3545;
}

.toast-error .toast-icon {
    background: #fee2e2;
    color: #b91c1c;
}

.toast-error .toast-header strong {
    color: #b91c1c;
}

/* هشدار */
.toast-warning {
    border-right: 4px solid #ffc107;
}

.toast-warning .toast-icon {
    background: #fef9c3;
    color: #a16207;
}

.toast-warning .toast-header strong {
    color: #a16207;
}

/* اطلاع‌رسانی */
.toast-info {
    border-right: 4px solid #17a2b8;
}

.toast-info .toast-icon {
    background: #e0f2fe;
    color: #0369a1;
}

.toast-info .toast-header strong {
    color: #0369a1;
}

/* ===== انیمیشن خروج (fade out) ===== */
.toast.fade-out {
    opacity: 0;
    transform: translateX(30px);
    max-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    transition: all 0.4s ease, max-height 0.4s ease, padding 0.4s ease;
}

/* ===== واکنش‌گرایی موبایل ===== */
@media (max-width: 576px) {
    .toast-container {
        left: 12px;
        right: 12px;
        bottom: 16px;
    }

    .toast {
        min-width: auto;
        /* تمام عرض */
        max-width: 100%;
    }

    .toast-header {
        padding: 8px 12px;
    }

    .toast-body {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}