/* =========================================
       تنظیمات پایه و متغیرهای رنگی (Teal Dark Theme)
       ========================================= */
    :root {
        --primary-color: #14b8a6;       /* فیروزه‌ای اصلی */
        --primary-dark: #0f766e;        /* فیروزه‌ای تیره */
        --primary-hover: #2dd4bf;       /* فیروزه‌ای روشن برای هاور */
        --bg-body: #042f2e;             /* پس‌زمینه کلی سایت */
        --bg-card: #0f4c4c;             /* پس‌زمینه کارت‌ها و فرم‌ها */
        --bg-input: #062f2f;            /* پس‌زمینه اینپوت‌ها */
        --text-main: #ccfbf1;           /* متن اصلی */
        --text-muted: #99f6e4;          /* متن فرعی */
        --border-color: #115e59;        /* رنگ حاشیه */
        --success-color: #10b981;       /* سبز موفقیت */
        --error-color: #ef4444;         /* قرمز خطا */
        --warning-bg: rgba(45, 212, 191, 0.1);
        --warning-border: #2dd4bf;
        --radius: 12px;
        --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    }
    
    * { 
        margin: 0; 
        padding: 0; 
        box-sizing: border-box; 
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        text-align: center;
    }
    
    body {
        background-color: var(--bg-body);
        color: var(--text-main);
        line-height: 1.6;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        padding: 20px;
        text-align: center;
    }
    
    /* کانتینر اصلی - بدون پس‌زمینه سفید برای یکپارچگی */
    .container {
        width: 100%;
        max-width: 1000px;
        margin: 0 auto;
        position: relative;
    }
    
    /* هدر */
    header {
        background: rgba(15, 76, 76, 0.6);
        backdrop-filter: blur(5px);
        border: 1px solid var(--border-color);
        padding: 25px;
        border-radius: var(--radius);
        color: var(--text-main);
        text-align: center;
        position: relative;
        margin-bottom: 20px;
    }
    
    .lang-switch {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        left: 20px; /* RTL Default */
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--border-color);
        color: var(--primary-hover);
        padding: 6px 14px;
        border-radius: 20px;
        cursor: pointer;
        font-size: 0.85rem;
        font-weight: 600;
        transition: all 0.2s;
        z-index: 10;
    }
    .lang-switch:hover {
        background: var(--primary-color);
        color: var(--bg-body);
    }
    html[dir="ltr"] .lang-switch {
        left: auto;
        right: 20px;
    }
    
    h1 { font-size: 1.8rem; margin-bottom: 5px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--text-main); }
    .subtitle { font-size: 0.95rem; color: var(--text-muted); }
    
    /* آیکون SVG */
    .icon { width: 1.2em; height: 1.2em; fill: currentColor; vertical-align: middle; }
    
    /* تب‌ها */
    .tabs { 
        display: flex; 
        background-color: rgba(0, 0, 0, 0.2);
        border: 1px solid var(--border-color); 
        padding: 6px;
        border-radius: var(--radius);
        margin-bottom: 25px;
    }
    
    .tab {
        flex: 1;
        padding: 12px;
        text-align: center;
        cursor: pointer;
        font-weight: 500;
        color: var(--text-muted);
        border-radius: 8px;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }
    
    .tab:hover { background-color: rgba(255, 255, 255, 0.05); color: var(--text-main); }
    .tab.active {
        background: var(--primary-color);
        color: var(--bg-body);
        box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
        font-weight: bold;
    }
    
    /* محتوای تب‌ها */
    .tab-content { display: none; padding: 10px; animation: fadeIn 0.4s ease; }
    .tab-content.active { display: block; }
    
    @keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
    
    /* فرم‌ها */
    .converter-form { max-width: 800px; margin: 0 auto; }
    .form-title { font-size: 1.3rem; color: var(--primary-hover); margin-bottom: 25px; display: flex; align-items: center; gap: 10px; justify-content: center; }
    
    .form-row { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 20px; }
    .form-col { flex: 1; min-width: 280px; }
    
    label { display: block; margin-bottom: 8px; font-weight: 500; color: var(--text-muted); text-align: right; }
    html[dir="ltr"] label { text-align: left; }
    
    .required::after { content: " *"; color: var(--error-color); }
    
    /* استایل ورودی‌ها (Dark Mode) */
    input, select {
        width: 100%;
        padding: 14px;
        background-color: var(--bg-input);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        font-size: 1rem;
        color: var(--text-main);
        transition: all 0.3s;
        text-align: inherit;
    }
    
    input:focus, select:focus {
        outline: none;
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.2);
        background-color: #083333;
    }
    
    /* دکمه‌ها */
    .btn-group { display: flex; gap: 15px; margin-top: 30px; justify-content: center; }
    
    .btn {
        padding: 14px 30px;
        border: none;
        border-radius: 8px;
        font-size: 1rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        min-width: 150px;
    }
    
    .btn-primary { background: var(--primary-color); color: var(--bg-body); }
    .btn-primary:hover { background: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 5px 15px rgba(20, 184, 166, 0.4); }
    
    .btn-secondary { background-color: transparent; color: var(--text-muted); border: 1px solid var(--border-color); }
    .btn-secondary:hover { background-color: rgba(255, 255, 255, 0.05); color: var(--text-main); border-color: var(--text-muted); }
    
    /* نتایج */
    .result-box {
        background: linear-gradient(135deg, rgba(15, 76, 76, 0.6) 0%, rgba(6, 78, 78, 0.6) 100%);
        border: 1px solid var(--primary-color);
        border-radius: var(--radius);
        padding: 25px;
        margin-top: 30px;
        display: none;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    }
    
    .result-box.show { display: block; animation: slideDown 0.4s ease; }
    @keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
    
    .result-title { font-size: 1.2rem; color: var(--primary-hover); margin-bottom: 20px; display: flex; align-items: center; gap: 10px; justify-content: center; }
    
    .result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
    
    .result-item {
        background: rgba(255, 255, 255, 0.03);
        padding: 20px;
        border-radius: 12px;
        border: 1px solid var(--border-color);
        backdrop-filter: blur(5px);
    }
    
    .result-label { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 8px; }
    .result-value { font-size: 1.3rem; font-weight: 700; color: var(--primary-hover); }
    
    /* اطلاعات کمکی */
    .helper-text { font-size: 0.8rem; color: var(--text-muted); margin-top: 5px; text-align: inherit; opacity: 0.8; }
    
    .tip-box {
        background: var(--warning-bg);
        border-right: 4px solid var(--warning-border);
        padding: 15px;
        border-radius: 8px;
        margin-top: 25px;
        font-size: 0.9rem;
        text-align: inherit;
        color: var(--text-main);
    }
    
    html[dir="ltr"] .tip-box {
        border-right: none;
        border-left: 4px solid var(--warning-border);
    }
    
    /* وضعیت زنده */
    .live-status {
        font-size: 0.85rem;
        color: var(--primary-hover);
        margin-top: 5px;
        font-weight: 600;
        min-height: 20px;
    }
    
    /* فوتر */
    footer {
        text-align: center;
        padding: 20px;
        color: var(--text-muted);
        font-size: 0.85rem;
        margin-top: auto;
        border-top: 1px solid var(--border-color);
        background: rgba(0,0,0,0.1);
    }
    
    /* Toast Notification */
    #toast-container {
        position: fixed;
        bottom: 20px;
        left: 20px;
        z-index: 1000;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    html[dir="ltr"] #toast-container {
        left: auto;
        right: 20px;
    }
    
    .toast {
        min-width: 280px;
        padding: 15px 20px;
        border-radius: 8px;
        color: white;
        font-size: 0.95rem;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
        display: flex;
        align-items: center;
        gap: 10px;
        animation: slideInLeft 0.3s ease, fadeOut 0.5s ease 2.5s forwards;
        backdrop-filter: blur(4px);
    }
    
    .toast.success { background-color: rgba(16, 185, 129, 0.9); border: 1px solid #10b981; }
    .toast.error { background-color: rgba(239, 68, 68, 0.9); border: 1px solid #ef4444; }
    .toast.info { background-color: rgba(20, 184, 166, 0.9); border: 1px solid #14b8a6; }
    
    @keyframes slideInLeft { from { transform: translateX(-100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
    @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; visibility: hidden; } }
    
    /* MathML & Solution Styles */
    .solution-box {
        background: rgba(0, 0, 0, 0.2);
        border: 1px solid var(--border-color);
        border-radius: 10px;
        padding: 20px;
        margin-top: 20px;
        text-align: center;
    }
    .solution-title {
        font-size: 1rem;
        color: var(--primary-hover);
        font-weight: bold;
        margin-bottom: 15px;
        display: block;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 8px;
    }
    math {
        font-family: 'Times New Roman', serif;
        font-size: 1.2rem;
        direction: ltr;
        display: inline-block;
        margin: 10px 0;
        color: var(--text-main);
    }
    .step-container {
        text-align: right;
        margin-top: 15px;
        padding-right: 10px;
        border-right: 3px solid var(--primary-color);
    }
    html[dir="ltr"] .step-container {
        text-align: left;
        padding-right: 0;
        padding-left: 10px;
        border-right: none;
        border-left: 3px solid var(--primary-color);
    }
    .step-item {
        margin-bottom: 12px;
        font-size: 0.95rem;
        color: var(--text-main);
        line-height: 1.6;
    }
    .step-desc {
        font-weight: 600;
        color: var(--text-muted);
        display: block;
        margin-bottom: 4px;
    }
    .step-math {
        background: rgba(255, 255, 255, 0.05);
        padding: 8px;
        border-radius: 6px;
        display: inline-block;
        border: 1px solid var(--border-color);
        color: var(--primary-hover);
    }
    
    /* ریسپانسیو */
    @media (max-width: 768px) {
        .tabs { flex-direction: column; gap: 5px; background: transparent; border: none; }
        .tab { padding: 12px; background: rgba(255,255,255,0.05); border: 1px solid var(--border-color); }
        .tab.active { border-color: var(--primary-color); }
        .form-row { flex-direction: column; }
        .btn-group { flex-direction: column; }
        .result-grid { grid-template-columns: 1fr; }
        h1 { font-size: 1.4rem; }
        .container { padding: 0; }
    }
    /* ==========================================
// استایل اسکرول‌بار مدرن (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 */
}