/* ==========================================================
   Toastify — Brand-Aligned Design
   Palette: --ul-primary (#041C33), --ul-secondary (#0D6DFD)
   ========================================================== */

/* ==========================================================
   1. BASE CONTAINER
========================================================== */

.toastify {
    /* ========== Layout ========== */
    position: fixed !important;
    z-index: 9999999 !important;

    top: 24px !important;
    right: 24px !important;
    left: auto !important;
    bottom: auto !important;

    direction: rtl;
    font-family: iranyekan, -apple-system, BlinkMacSystemFont, sans-serif;

    /* ========== Size ========== */
    max-width: 420px;
    min-width: 320px;
    width: max-content;

    padding: 0 !important;
    margin: 0 !important;

    /* ========== Appearance ========== */
    background: linear-gradient(135deg, #041c33 0%, #0a2d4d 100%) !important;

    border-radius: 20px;
    border: 1px solid rgba(13, 109, 253, 0.15);
    border-right: 4px solid #0d6dfd;

    overflow: hidden;

    box-shadow:
        0 24px 55px -12px rgba(4, 28, 51, 0.45),
        0 8px 20px -6px rgba(4, 28, 51, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);

    /* ========== Animation ========== */
    animation: toastSlideIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
    transition: transform 0.3s ease, box-shadow 0.3s ease;

    /* ========== Misc ========== */
    user-select: none;
    will-change: transform, opacity;

    /* ========== Glow decoration ========== */
    isolation: isolate;
}

.toastify::before {
    content: "";
    position: absolute;
    top: -60px;
    inset-inline-end: -60px;
    width: 180px;
    height: 180px;
    background: radial-gradient(
        circle,
        rgba(13, 109, 253, 0.35) 0%,
        transparent 70%
    );
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
}

.toastify:hover {
    transform: translateY(-4px);
    box-shadow:
        0 32px 70px -14px rgba(4, 28, 51, 0.55),
        0 12px 28px -8px rgba(4, 28, 51, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}


/* ==========================================================
   2. CONTENT LAYOUT — فیکس شده (ضربدر کنار متن)
========================================================== */

.toast-content {
    display: flex;
    align-items: center;
    gap: 14px;

    padding: 16px 18px;

    width: 100%;
    box-sizing: border-box;
}


/* ==========================================================
   3. ICON — حلقه آبی برند
========================================================== */

.toast-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;

    border-radius: 50%;

    display: grid;
    place-items: center;

    background: rgba(13, 109, 253, 0.12);
    border: 1.5px solid rgba(13, 109, 253, 0.25);
    color: #3d8bff;

    flex-shrink: 0;
    box-sizing: border-box;

    transition: transform 0.3s ease, background 0.3s ease;
}

.toast-icon i {
    font-size: 18px;
    line-height: 1;
    color: inherit;
}

.toast-icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.toastify:hover .toast-icon {
    transform: scale(1.08) rotate(-6deg);
}


/* ==========================================================
   4. TEXT
========================================================== */

.toast-text {
    flex: 1;
    min-width: 0;

    display: flex;
    flex-direction: column;
    gap: 3px;

    padding-inline-end: 4px;
}

.toast-text .title {
    display: block;

    font-family: iranyekan, sans-serif;
    font-size: 14.5px;
    font-weight: 800;
    line-height: 1.4;

    color: #ffffff !important;

    margin: 0;
    padding: 0;

    letter-spacing: 0.2px;
}

.toast-text .message {
    display: block;

    font-family: iranyekan, sans-serif;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.65;

    color: rgba(255, 255, 255, 0.78) !important;

    margin: 0;
    padding: 0;
    word-break: break-word;
    overflow-wrap: break-word;
}


/* ==========================================================
   5. CLOSE BUTTON — دقیقاً گوشه بالا-چپ
========================================================== */

.toast-close {
    /* ========== Size ========== */
    width: 28px;
    height: 28px;
    min-width: 28px;

    /* ========== Shape ========== */
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.08);

    /* ========== Appearance ========== */
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.65);

    /* ========== Layout ========== */
    display: grid;
    place-items: center;

    cursor: pointer;
    padding: 0;
    flex-shrink: 0;

    box-sizing: border-box;
    outline: none;

    /* ========== Position within flex ========== */
    align-self: flex-start;
    margin-top: 0;

    /* ========== Transition ========== */
    transition: all 0.25s ease;
}

.toast-close i {
    font-size: 11px;
    line-height: 1;
    color: inherit;

    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.toast-close:focus-visible {
    outline: 2px solid rgba(13, 109, 253, 0.6);
    outline-offset: 2px;
}


/* ==========================================================
   6. VARIANTS — با پالت برند
========================================================== */

/* ---------- SUCCESS — سبز ---------- */
.toast-success {
    background: linear-gradient(135deg, #041c33 0%, #064e3b 100%) !important;
    border-right-color: #34d399;
    border-color: rgba(52, 211, 153, 0.15);
}

.toast-success::before {
    background: radial-gradient(
        circle,
        rgba(52, 211, 153, 0.35) 0%,
        transparent 70%
    );
}

.toast-success .toast-icon {
    color: #34d399;
    background: rgba(52, 211, 153, 0.12);
    border-color: rgba(52, 211, 153, 0.25);
}

/* ---------- ERROR — قرمز ---------- */
.toast-error {
    background: linear-gradient(135deg, #041c33 0%, #7f1d1d 100%) !important;
    border-right-color: #f87171;
    border-color: rgba(248, 113, 113, 0.15);
}

.toast-error::before {
    background: radial-gradient(
        circle,
        rgba(248, 113, 113, 0.35) 0%,
        transparent 70%
    );
}

.toast-error .toast-icon {
    color: #f87171;
    background: rgba(248, 113, 113, 0.12);
    border-color: rgba(248, 113, 113, 0.25);
}

/* ---------- WARNING — طلایی ---------- */
.toast-warning {
    background: linear-gradient(135deg, #041c33 0%, #78350f 100%) !important;
    border-right-color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.15);
}

.toast-warning::before {
    background: radial-gradient(
        circle,
        rgba(251, 191, 36, 0.35) 0%,
        transparent 70%
    );
}

.toast-warning .toast-icon {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.12);
    border-color: rgba(251, 191, 36, 0.25);
}

/* ---------- INFO — آبی برند ---------- */
.toast-info {
    background: linear-gradient(135deg, #041c33 0%, #0a2d4d 100%) !important;
    border-right-color: #0d6dfd;
    border-color: rgba(13, 109, 253, 0.15);
}

.toast-info::before {
    background: radial-gradient(
        circle,
        rgba(13, 109, 253, 0.35) 0%,
        transparent 70%
    );
}

.toast-info .toast-icon {
    color: #3d8bff;
    background: rgba(13, 109, 253, 0.12);
    border-color: rgba(13, 109, 253, 0.25);
}


/* ==========================================================
   7. FORCE TEXT COLORS
========================================================== */

.toastify .title {
    color: #ffffff !important;
}

.toastify .message {
    color: rgba(255, 255, 255, 0.78) !important;
}


/* ==========================================================
   8. ANIMATIONS
========================================================== */

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.94);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-30px) scale(0.94);
    }
}

.toastify.removing {
    animation: toastSlideOut 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}


/* ==========================================================
   9. RESPONSIVE
========================================================== */

@media (max-width: 991.98px) {
    .toastify {
        top: 20px !important;
        right: 20px !important;
        left: 20px !important;
        max-width: 100%;
    }
}

@media (max-width: 575.98px) {
    .toastify {
        top: 14px !important;
        right: 12px !important;
        left: 12px !important;

        min-width: unset;
        max-width: unset;
        width: auto;

        border-radius: 16px;
        border-right-width: 4px;
    }

    .toast-content {
        padding: 13px 15px;
        gap: 12px;
    }

    .toast-icon {
        width: 38px;
        height: 38px;
        min-width: 38px;
    }

    .toast-icon i {
        font-size: 15px;
    }

    .toast-icon svg {
        width: 18px;
        height: 18px;
    }

    .toast-text .title {
        font-size: 13.5px;
    }

    .toast-text .message {
        font-size: 12.5px;
    }

    .toast-close {
        width: 26px;
        height: 26px;
        min-width: 26px;
    }

    .toast-close i {
        font-size: 10px;
    }

    .toastify:hover {
        transform: none;
    }
}


/* ==========================================================
   10. REDUCED MOTION
========================================================== */

@media (prefers-reduced-motion: reduce) {
    .toastify,
    .toastify.removing,
    .toast-close,
    .toastify:hover {
        animation: none !important;
        transition: none !important;
        transform: none !important;
    }
}