/* ==========================================================================
   🚀 MANASHAP CUSTOM EXTRA STYLES (Animations, Glassmorphic Toast, Buttons)
   ========================================================================== */

/* 1️⃣ انیمیشن‌های اختصاصی دکمه لودینگ ارسال OTP */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 15px rgba(37, 99, 235, 0.6), 0 0 30px rgba(37, 99, 235, 0.3);
    }
    50% {
        box-shadow: 0 0 25px rgba(37, 99, 235, 0.9), 0 0 50px rgba(37, 99, 235, 0.5);
    }
}

@keyframes rocket-fly {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    50% { transform: translateY(-8px) scale(1.1); opacity: 0.8; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.btn-loading-animated {
    background: linear-gradient(90deg, #2563eb, #3b82f6, #1d4ed8) !important;
    background-size: 200% 200% !important;
    animation: gradient-shift 2s ease infinite, pulse-glow 1.5s infinite ease-in-out !important;
}

.rocket-anim {
    display: inline-block;
    animation: rocket-fly 0.8s infinite ease-in-out;
}

/* 2️⃣ کانتینر اصلی Toastهای شیشه‌ای ماناشاپ */
#toast-container {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    pointer-events: none;
}

/* 💎 باکس اصلی Glassmorphic Toast */
.mana-toast {
    pointer-events: auto;
    min-width: 320px;
    max-width: 420px;
    padding: 1rem 1.25rem;
    border-radius: 1.5rem;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.08),
                0 0 20px -5px rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    position: relative;
    overflow: hidden;
    transform: translateX(-120%) scale(0.9) rotate(-3deg);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dark .mana-toast {
    background: rgba(10, 15, 30, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.5);
}

/* 🔥 حالت فعال شدن ورود (Spring Physics) */
.mana-toast.toast-show {
    transform: translateX(0) scale(1) rotate(0deg);
    opacity: 1;
}

/* 🌈 تم تمایز حالت‌ها */
.mana-toast.toast-success { border-right: 4px solid #10b981; }
.mana-toast.toast-error { border-right: 4px solid #f43f5e; }
.mana-toast.toast-warning { border-right: 4px solid #f59e0b; }
.mana-toast.toast-info { border-right: 4px solid #3b82f6; }

/* ⏳ نوار پروگرس بار زمان‌سنج در پایین Toast */
.mana-toast-progress {
    position: absolute;
    bottom: 0;
    right: 0;
    height: 3px;
    width: 100%;
    background: linear-gradient(90deg, #3b82f6, #6366f1);
    border-radius: 0 0 1.5rem 1.5rem;
    transform-origin: right;
}

.mana-toast.toast-success .mana-toast-progress { background: linear-gradient(90deg, #10b981, #34d399); }
.mana-toast.toast-error .mana-toast-progress { background: linear-gradient(90deg, #f43f5e, #fb7185); }
.mana-toast.toast-warning .mana-toast-progress { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

.toast-icon-wrapper {
    width: 42px;
    height: 42px;
    border-radius: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* =========================================
   SUPERCHARGED PORTAL LOADER
========================================= */
.portal-loader {
    position: relative;
    width: 200px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto; /* Force perfect center */
}

.portal-loader__line {
    position: relative;
    width: 140px;
    height: 3px;
    background: linear-gradient(
        90deg,
        transparent,
        #06b6d4, /* فیروزه‌ای */
        #3b82f6, /* آبی */
        #a855f7, /* بنفش */
        transparent
    );
    border-radius: 999px;
    box-shadow:
        0 0 12px rgba(59, 130, 246, 0.9),
        0 0 25px rgba(168, 85, 247, 0.7);
    animation: portalLine 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.portal-loader__line::before,
.portal-loader__line::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow:
        0 0 10px #3b82f6,
        0 0 20px #a855f7,
        0 0 30px #ffffff;
    transform: translateY(-50%);
}

.portal-loader__line::before {
    left: 0;
    animation: portalDot 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.portal-loader__line::after {
    right: 0;
    animation: portalDot 2s cubic-bezier(0.4, 0, 0.2, 1) infinite reverse;
}

.portal-loader__glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 30px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.25);
    filter: blur(18px);
    animation: portalGlow 2s ease-in-out infinite;
}

.portal-loader__spark {
    position: absolute;
    top: 50%;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #e879f9;
    box-shadow: 0 0 8px #d946ef;
    opacity: 0;
}

/* 6 Sparks shooting outwards */
.spark-1 { left: 45px; animation: shootSpark 1.6s infinite 0.1s; }
.spark-2 { left: 75px; animation: shootSpark 1.3s infinite 0.4s; }
.spark-3 { right: 55px; animation: shootSpark 1.8s infinite 0.2s; }
.spark-4 { right: 35px; animation: shootSpark 1.5s infinite 0.6s; }
.spark-5 { left: 60px; animation: shootSpark 1.4s infinite 0.8s; }
.spark-6 { right: 65px; animation: shootSpark 1.7s infinite 0.5s; }

/* ANIMATIONS */
@keyframes portalLine {
    0%, 100% {
        transform: scaleX(0.6);
        opacity: 0.6;
    }
    50% {
        transform: scaleX(1.1);
        opacity: 1;
        box-shadow: 0 0 20px rgba(59, 130, 246, 1), 0 0 40px rgba(168, 85, 247, 0.9);
    }
}

@keyframes portalDot {
    0%, 100% {
        transform: translateY(-50%) scale(0.7);
        opacity: 0.5;
    }
    50% {
        transform: translateY(-50%) scale(1.4);
        opacity: 1;
    }
}

@keyframes portalGlow {
    0%, 100% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.4;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.4);
        opacity: 0.9;
        background: rgba(168, 85, 247, 0.35);
    }
}

@keyframes shootSpark {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    100% {
        /* Shoot them randomly up/down/left/right by generating a generic outward path */
        transform: translate(calc(-15px + 30px * var(--tx, 0.5)), calc(-20px + 40px * var(--ty, -0.8))) scale(0);
        opacity: 0;
    }
}

/* Custom CSS variables for random scattering of sparks */
.spark-1 { --tx: 0.1; --ty: 0.9; }
.spark-2 { --tx: -0.5; --ty: -1; }
.spark-3 { --tx: 0.8; --ty: -0.7; }
.spark-4 { --tx: -0.2; --ty: 1.2; }
.spark-5 { --tx: 0.9; --ty: 0.2; }
.spark-6 { --tx: -0.8; --ty: -0.1; }