/* ═══════════════════════════════════════════════════════════════
BALE MAGIC PORTAL - پورتال جادویی بله
طراحی اختصاصی برای پویا | استایل: گلس‌مورفیسم + نئون + مورفینگ
موقعیت: وسط-چپ صفحه | برند: بله (سبز زمردی / آبی)
═══════════════════════════════════════════════════════════════ */

/* ===== فونت و متغیرها ===== */
@font-face {
    font-family: 'Vazir';
    src: url('https://sunrp.ir/assets/Vazirmatn_wght_-BeciDpKm.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    /* رنگ‌های اختصاصی بله */
    --bale-green: #00C48C;
    --bale-blue: #007BFF;
    --bale-dark: #0a192f;
    --bale-glass: rgba(10, 25, 47, 0.85);
    
    /* افکت‌های نوری */
    --portal-glow: 0 0 20px rgba(0, 196, 140, 0.4), 0 0 40px rgba(0, 123, 255, 0.2);
    --portal-glow-strong: 0 0 30px rgba(0, 196, 140, 0.6), 0 0 60px rgba(0, 123, 255, 0.4);
}

/* ===== کانتینر اصلی (پورتال) - موقعیت وسط-چپ ===== */
.bale-portal-container {
    position: fixed;
    top: 50%;
    left: 30px;
    transform: translateY(-50%);
    z-index: 999999;
    font-family: 'Vazir', sans-serif;
    direction: rtl;
    
    /* حالت اولیه: بسته (گوی) */
    width: 80px;
    height: 80px;
    transition: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55); /* انیمیشن فنری و نرم */
    cursor: pointer;
    
    /* انیمیشن ورود اولیه */
    animation: portalEntrance 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* بدنه اصلی پورتال (شیشه‌ای) */
.bale-portal-body {
    width: 100%;
    height: 100%;
    background: var(--bale-glass);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-radius: 50%; /* حالت دایره */
    border: 2px solid transparent;
    background-clip: padding-box;
    position: relative;
    overflow: hidden;
    box-shadow: var(--portal-glow);
    transition: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* حاشیه نئونی متحرک (گرادیانت دور تا دور) */
.bale-portal-body::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--bale-green), var(--bale-blue), var(--bale-green));
    background-size: 200% 200%;
    animation: borderFlow 4s ease infinite;
    z-index: -1;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    padding: 2px;
    opacity: 0.8;
}

/* پس‌زمینه مش گرادیانت متحرک (وقتی باز میشه) */
.bale-portal-body::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 50%, rgba(0, 196, 140, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(0, 123, 255, 0.15) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.5s ease 0.3s;
    pointer-events: none;
}

/* حلقه چرخان دور گوی */
.bale-portal-ring {
    position: absolute;
    width: 110%;
    height: 110%;
    border: 1px dashed rgba(0, 196, 140, 0.4);
    border-radius: 50%;
    animation: rotateRing 10s linear infinite;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s;
}

/* ===== حالت باز شده (پنل) ===== */
.bale-portal-container.is-open {
    width: 420px;
    height: auto;
    cursor: default;
}

.bale-portal-container.is-open .bale-portal-body {
    border-radius: 24px; /* تبدیل به مستطیل گرد */
    box-shadow: var(--portal-glow-strong);
    justify-content: flex-start;
}

.bale-portal-container.is-open .bale-portal-body::after {
    opacity: 1;
}

.bale-portal-container.is-open .bale-portal-ring {
    opacity: 0;
}

/* ===== محتوای داخلی ===== */
.bale-content-wrapper {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    width: 100%;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.4s ease 0.3s;
    pointer-events: none;
    position: relative;
    z-index: 2;
}

.bale-portal-container.is-open .bale-content-wrapper {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

/* ===== جعبه لوگوی جادویی (آیکون SVG) ===== */
.bale-logo-box {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    background: radial-gradient(circle at center, rgba(0, 196, 140, 0.25), rgba(0, 123, 255, 0.1));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(0, 196, 140, 0.5);
    box-shadow: 
        0 0 20px rgba(0, 196, 140, 0.5),
        inset 0 0 15px rgba(0, 196, 140, 0.2);
    position: relative;
    animation: iconPulse 2.5s ease-in-out infinite;
}

.bale-logo-box svg {
    width: 42px;
    height: 42px;
    filter: drop-shadow(0 0 10px rgba(0, 196, 140, 0.8));
    animation: iconFloat 3s ease-in-out infinite;
}

/* ذرات نورانی دور آیکون */
.bale-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #00C48C;
    border-radius: 50%;
    box-shadow: 0 0 8px #00C48C, 0 0 15px #007BFF;
    pointer-events: none;
}

.bale-particle:nth-child(1) { animation: orbitParticle 3s linear infinite; }
.bale-particle:nth-child(2) { animation: orbitParticle 3s linear infinite 0.75s; background: #007BFF; box-shadow: 0 0 8px #007BFF, 0 0 15px #00C48C; }
.bale-particle:nth-child(3) { animation: orbitParticle 3s linear infinite 1.5s; }
.bale-particle:nth-child(4) { animation: orbitParticle 3s linear infinite 2.25s; background: #007BFF; }

/* ===== متن‌ها و دکمه‌ها ===== */
.bale-text-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bale-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    margin: 0;
    background: linear-gradient(90deg, #fff, #00C48C);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bale-title-icon {
    color: #00C48C;
    font-size: 1.2rem;
    text-shadow: 0 0 10px #00C48C;
    -webkit-text-fill-color: #00C48C;
}

.bale-desc {
    font-size: 0.85rem;
    color: #cbd5e1;
    line-height: 1.6;
    margin: 0;
}

.bale-desc strong {
    color: #00C48C;
    font-weight: 700;
}

.bale-cta-btn {
    margin-top: 10px;
    background: linear-gradient(135deg, #00C48C, #007BFF);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 196, 140, 0.4);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    width: fit-content;
}

.bale-cta-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 196, 140, 0.6);
    filter: brightness(1.1);
}

.bale-cta-btn:active {
    transform: translateY(1px);
}

.bale-cta-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.bale-cta-btn:hover::after {
    width: 300px;
    height: 300px;
}

/* دکمه بستن */
.bale-close-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.5) rotate(-90deg);
    transition: all 0.3s ease 0.4s;
    z-index: 10;
}

.bale-portal-container.is-open .bale-close-btn {
    opacity: 1;
    transform: scale(1) rotate(0);
}

.bale-close-btn:hover {
    background: #ef4444;
    border-color: #ef4444;
    transform: scale(1.1) rotate(90deg);
}

/* ===== تغییرات حالت باز شده برای لوگو ===== */
.bale-portal-container.is-open .bale-logo-box {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    animation: none;
}

.bale-portal-container.is-open .bale-logo-box svg {
    width: 36px;
    height: 36px;
    animation: none;
}

.bale-portal-container.is-open .bale-particle {
    opacity: 0;
    transition: opacity 0.3s;
}

/* ===== انیمیشن‌ها ===== */
@keyframes borderFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes rotateRing {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes portalPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(0, 196, 140, 0.5), inset 0 0 15px rgba(0, 196, 140, 0.2); transform: scale(1); }
    50% { box-shadow: 0 0 35px rgba(0, 196, 140, 0.8), inset 0 0 20px rgba(0, 196, 140, 0.4); transform: scale(1.05); }
}

.bale-portal-container:not(.is-open) .bale-portal-body {
    animation: portalPulse 3s infinite ease-in-out;
}

@keyframes portalEntrance {
    from { opacity: 0; transform: translateY(-50%) translateX(-50px) scale(0.5); }
    to { opacity: 1; transform: translateY(-50%) translateX(0) scale(1); }
}

@keyframes iconPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(0, 196, 140, 0.5), inset 0 0 15px rgba(0, 196, 140, 0.2); transform: scale(1); }
    50% { box-shadow: 0 0 35px rgba(0, 196, 140, 0.8), inset 0 0 20px rgba(0, 196, 140, 0.4); transform: scale(1.05); }
}

@keyframes iconFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes orbitParticle {
    0% { transform: rotate(0deg) translateX(45px) rotate(0deg); opacity: 1; }
    50% { opacity: 0.4; }
    100% { transform: rotate(360deg) translateX(45px) rotate(-360deg); opacity: 1; }
}

/* ===== ریسپانسیو (موبایل) ===== */
@media (max-width: 600px) {
    .bale-portal-container {
        top: auto;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        width: 70px;
        height: 70px;
    }
    
    .bale-portal-container.is-open {
        width: calc(100% - 30px);
        max-width: 400px;
        top: auto;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
    }
    
    @keyframes portalEntrance {
        from { opacity: 0; transform: translateX(-50%) translateY(50px) scale(0.5); }
        to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
    }
    
    .bale-content-wrapper {
        flex-direction: column;
        text-align: center;
        gap: 15px;
        padding: 20px;
    }
    
    .bale-cta-btn {
        width: 100%;
        justify-content: center;
    }
}