/* =========================================
       استایل هماهنگ با تم اصلی (Teal Dark Theme)
       ========================================= */
   
    :root {
        --primary: #0f766e;          /* فیروزه‌ای تیره */
        --secondary: #115e59;        /* حاشیه و پس‌زمینه ثانویه */
        --accent: #2dd4bf;           /* فیروزه‌ای روشن (تاکید) */
        --accent-hover: #14b8a6;     /* هاور دکمه */
        --bg-body: #022c2b;          /* پس‌زمینه کل صفحه */
        --bg-card: rgba(4, 47, 46, 0.85); /* پس‌زمینه کارت شیشه‌ای */
        --white: #ccfbf1;            /* متن اصلی */
        --border: #115e59;
        --success-bg: rgba(16, 185, 129, 0.2); /* سبز تیره شیشه‌ای */
        --success-text: #6ee7b7;
        --error-bg: rgba(239, 68, 68, 0.2);    /* قرمز تیره شیشه‌ای */
        --error-text: #fca5a5;
        --formula-bg: rgba(0, 0, 0, 0.3);
        --font-fa: 'Segoe UI', Geneva, Verdana, sans-serif;
        --font-en: 'Segoe UI', Arial, sans-serif;
        --glow: 0 0 10px rgba(45, 212, 191, 0.2);
    }
    body {
        font-family: var(--font-fa);
        background-color: var(--bg-body);
        /* افکت پس‌زمینه محو */
        background-image: radial-gradient(circle at 50% 50%, rgba(20, 184, 166, 0.05) 0%, transparent 70%);
        
        margin: 0;
        padding: 20px;
        display: flex;
        justify-content: center;
        align-items: flex-start;
        min-height: 100vh;
        color: var(--white);
        transition: all 0.3s ease;
    }
    /* Language Specific Styles */
    body.lang-en {
        font-family: var(--font-en);
        direction: ltr;
    }
    .main-wrapper {
        background-color: var(--bg-card);
        backdrop-filter: blur(12px);
        width: 100%;
        max-width: 1000px;
        border-radius: 16px;
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
        border: 1px solid var(--border);
        overflow: hidden;
        display: flex;
        flex-direction: column;
        animation: fadeIn 0.5s ease-out;
    }
    /* Header */
    header {
        background: linear-gradient(135deg, var(--primary), var(--bg-body));
        color: var(--accent);
        padding: 25px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid var(--border);
    }
    .header-text h1 { margin: 0; font-size: 1.5rem; text-shadow: 0 0 10px var(--glow); }
    .header-text p { margin: 5px 0 0; font-size: 0.9rem; opacity: 0.8; color: var(--white); }
    .lang-btn {
        background: rgba(255,255,255,0.05);
        border: 1px solid var(--border);
        color: var(--accent);
        padding: 8px 16px;
        border-radius: 20px;
        cursor: pointer;
        font-family: inherit;
        font-size: 0.9rem;
        transition: all 0.3s;
    }
    .lang-btn:hover { 
        background: var(--accent); 
        color: var(--bg-body);
        box-shadow: var(--glow);
    }
    /* Tabs */
    .tabs-nav {
        display: flex;
        background-color: rgba(0, 0, 0, 0.2);
        overflow-x: auto;
        white-space: nowrap;
        border-bottom: 1px solid var(--border);
        margin: 14px;
    }
    .tab-btn {
        flex: 1;
        padding: 14px 10px;
        border: none;
        background: none;
        color: var(--white);
        cursor: pointer;
        font-family: inherit;
        font-size: 0.9rem;
        transition: all 0.3s;
        min-width: 90px;
        opacity: 0.7;
        margin: 14px;
    }
    .tab-btn:hover { 
        background-color: rgba(255,255,255,0.05); 
        opacity: 1;
    }
    .tab-btn.active {
        background-color: var(--bg-card);
        color: var(--accent);
        font-weight: bold;
        border-bottom: 3px solid var(--accent);
        opacity: 1;
        box-shadow: 0 -5px 15px rgba(0,0,0,0.1);
    }
    /* Content */
    .content-area { padding: 30px; }
    .tab-pane { display: none; animation: fadeIn 0.4s; }
    .tab-pane.active { display: block; }
    @keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
    /* Forms */
    .form-group { margin-bottom: 20px; text-align: right; }
    
    label { 
        display: block; 
        margin-bottom: 8px; 
        font-weight: bold; 
        color: var(--accent); 
        font-size: 0.95rem; 
    }
    input[type="number"], select {
        width: 100%; 
        padding: 12px; 
        border: 2px solid var(--border);
        border-radius: 10px; 
        font-size: 1rem; 
        box-sizing: border-box; 
        font-family: inherit;
        background-color: rgba(0, 0, 0, 0.2);
        color: var(--white);
        transition: all 0.3s;
    }
    input:focus, select:focus { 
        border-color: var(--accent); 
        outline: none;
        box-shadow: var(--glow);
        background-color: rgba(0, 0, 0, 0.4);
    }
    
    /* استایل آپشن‌های سلکت */
    select option {
        background-color: var(--bg-body);
        color: var(--white);
    }
    .helper { font-size: 0.8rem; color: #99f6e4; margin-top: 6px; opacity: 0.8; }
    .btn-calc {
        width: 100%; 
        padding: 14px; 
        background: linear-gradient(135deg, var(--accent), var(--primary));
        color: #022c2b; /* متن تیره روی دکمه روشن */
        border: none; 
        border-radius: 10px; 
        font-size: 1.1rem;
        font-weight: bold;
        cursor: pointer; 
        margin-top: 15px; 
        font-family: inherit;
        box-shadow: 0 4px 15px rgba(20, 184, 166, 0.3);
        transition: all 0.3s;
    }
    .btn-calc:hover { 
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(20, 184, 166, 0.5);
        filter: brightness(1.1);
    }
    /* Results & Steps */
    .result-box {
        margin-top: 25px; 
        padding: 20px; 
        border-radius: 12px; 
        display: none;
        backdrop-filter: blur(5px);
    }
    .result-box.success { 
        background-color: var(--success-bg); 
        color: var(--success-text); 
        border: 1px solid #10b981;
        border-right: 5px solid #10b981; 
    }
    
    .result-box.error { 
        background-color: var(--error-bg); 
        color: var(--error-text); 
        border: 1px solid #ef4444;
        border-right: 5px solid #ef4444; 
    }
    
    /* LTR Fix for Result Box in English */
    body.lang-en .result-box { border-right: 1px solid #10b981; border-left: 5px solid #10b981; text-align: left; }
    body.lang-en .result-box.error { border-left: 5px solid #ef4444; border-right: 1px solid #ef4444; }
    .steps-container {
        margin-top: 25px;
        background-color: rgba(255, 255, 255, 0.03);
        border: 1px dashed var(--border);
        border-radius: 12px;
        padding: 20px;
        display: none;
    }
    .steps-title {
        font-weight: bold; 
        color: var(--accent); 
        border-bottom: 2px solid var(--accent);
        padding-bottom: 10px; 
        margin-bottom: 15px; 
        font-size: 1.1rem;
    }
    .formula-box {
        background-color: var(--formula-bg);
        padding: 15px;
        border-radius: 8px;
        text-align: center;
        margin-bottom: 15px;
        border: 1px solid var(--border);
        overflow-x: auto;
        color: #fff;
    }
    .legend {
        font-size: 0.9rem;
        color: var(--white);
        margin-bottom: 15px;
        line-height: 1.8;
        background: rgba(0,0,0,0.2);
        padding: 10px;
        border-radius: 6px;
    }
    .legend span { font-weight: bold; color: var(--accent); }
    .calc-step {
        margin-bottom: 12px;
        padding-bottom: 12px;
        border-bottom: 1px dashed rgba(255,255,255,0.1);
        font-size: 0.95rem;
        color: #ccfbf1;
    }
    .calc-step:last-child { border-bottom: none; }
    /* MathML Styles */
    math { font-size: 1.2rem; direction: ltr; }
    mi { font-style: italic; }
    mtext { font-style: normal; font-size: 0.9em; }
    @media (max-width: 900px) {
        .tabs-nav { flex-wrap: wrap; }
        .tab-btn { flex: 1 1 33%; font-size: 0.8rem; padding: 12px 5px; }
        .header-text h1 { font-size: 1.2rem; }
        .content-area { padding: 20px; }
    }
    /* ==========================================
// استایل اسکرول‌بار مدرن (Modern Scrollbar)
// ==========================================*/

/* برای مرورگرهای WebKit (Chrome, Safari, Edge, Opera) */
::-webkit-scrollbar {
    width: 8px;  /* عرض اسکرول‌بار عمودی */
    height: 8px; /* ارتفاع اسکرول‌بار افقی */
}

/* پس‌زمینه نوار اسکرول */
::-webkit-scrollbar-track {
    background: #0f172a; /* رنگ تیره برای پس‌زمینه */
    border-radius: 4px;
}

/* دکمه متحرک اسکرول (Thumb) */
::-webkit-scrollbar-thumb {
    background: #2dd4bf; /* رنگ اصلی Teal */
    border-radius: 4px;
    border: 2px solid #0f172a; /* حاشیه برای ایجاد فاصله زیبا */
}

/* حالت هاور (وقتی موس روی آن قرار می‌گیرد) */
::-webkit-scrollbar-thumb:hover {
    background: #14b8a6; /* رنگ کمی تیره‌تر برای هاور */
}

/* ==========================================
// اسکرول نرم (Smooth Scrolling)
// ==========================================*/

html {
    scroll-behavior: smooth;
}

/* ==========================================
// مخفی کردن اسکرول‌بار در موبایل اما حفظ قابلیت اسکرول
// (اختیاری - برای ظاهر تمیزتر در اپلیکیشن‌های وب)
// ==========================================*/

/* برای کلاس‌های خاص مثل نقشه یا سایدبار */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

/* برای فایرفاکس */
.no-scrollbar {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}