/* =========================================
       تنظیمات پایه و متغیرهای رنگی (Teal Dark Theme)
       ========================================= */
    :root {
        --bg-body: #042f2e;             /* پس‌زمینه کلی */
        --bg-card: #0f4c4c;             /* پس‌زمینه کارت‌ها */
        --bg-input: #062f2f;            /* پس‌زمینه اینپوت‌ها */
        --primary: #14b8a6;             /* فیروزه‌ای اصلی */
        --primary-dark: #0f766e;        /* فیروزه‌ای تیره */
        --primary-hover: #2dd4bf;       /* فیروزه‌ای روشن */
        --secondary: #5eead4;           /* فیروزه‌ای خیلی روشن */
        --text-main: #ccfbf1;           /* متن اصلی */
        --text-muted: #99f6e4;          /* متن فرعی */
        --border: #115e59;              /* رنگ حاشیه */
        --radius: 12px;
        --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
        --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
        --success: #10b981;
        --warning: #f59e0b;
    }
    
    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    }
    
    body {
        background-color: var(--bg-body);
        color: var(--text-main);
        min-height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center; /* وسط‌چین عمودی */
        padding: 20px;
        transition: all 0.3s ease;
    }
    
    .container {
        width: 100%;
        max-width: 900px;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: var(--shadow-lg);
        overflow: hidden;
        animation: fadeIn 0.5s ease;
        position: relative;
    }
    
    @keyframes fadeIn {
        from { opacity: 0; transform: translateY(10px); }
        to { opacity: 1; transform: translateY(0); }
    }
    
    header {
        padding: 24px;
        text-align: center;
        border-bottom: 1px solid var(--border);
        position: relative;
        background: rgba(15, 76, 76, 0.4);
    }
    
    .lang-switch {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        left: 20px; /* Default RTL */
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--primary);
        color: var(--primary-hover);
        padding: 8px 16px;
        border-radius: 20px;
        cursor: pointer;
        font-size: 0.9rem;
        font-weight: 600;
        transition: all 0.2s;
        z-index: 10;
    }
    .lang-switch:hover {
        background: var(--primary);
        color: var(--bg-body);
        box-shadow: 0 4px 6px rgba(20, 184, 166, 0.3);
    }
    /* LTR adjustments for language switch */
    html[dir="ltr"] .lang-switch {
        left: auto;
        right: 20px;
    }
    
    h1 {
        font-size: 1.8rem;
        font-weight: 800;
        margin-bottom: 8px;
        background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary) 100%);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
    }
    
    .subtitle {
        color: var(--text-muted);
        font-size: 0.95rem;
    }
    
    .tabs {
        display: flex;
        border-bottom: 1px solid var(--border);
        padding: 0 20px;
        gap: 4px;
        background: rgba(0, 0, 0, 0.2);
    }
    
    .tab {
        padding: 16px 20px;
        background: transparent;
        border: none;
        color: var(--text-muted);
        font-size: 0.9rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        position: relative;
        border-radius: var(--radius) var(--radius) 0 0;
    }
    
    .tab:hover {
        color: var(--text-main);
        background: rgba(255, 255, 255, 0.05);
    }
    
    .tab.active {
        color: var(--bg-body);
        background: var(--primary);
        border-top: 3px solid var(--primary-hover);
    }
    
    .tab-content {
        padding: 32px;
        display: none;
        animation: slideUp 0.3s ease;
    }
    
    @keyframes slideUp {
        from { opacity: 0; transform: translateY(10px); }
        to { opacity: 1; transform: translateY(0); }
    }
    
    .tab-content.active {
        display: block;
    }
    
    .input-group {
        margin-bottom: 24px;
    }
    
    .input-group label {
        display: block;
        margin-bottom: 8px;
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--text-muted);
    }
    
    .input-wrapper {
        position: relative;
    }
    
    input {
        width: 100%;
        padding: 16px 20px;
        border: 2px solid var(--border);
        border-radius: var(--radius);
        font-size: 1rem;
        transition: all 0.3s;
        background: var(--bg-input);
        color: var(--text-main);
    }
    
    input:focus {
        outline: none;
        border-color: var(--primary);
        background: #083333;
        box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.15);
    }
    
    .input-unit {
        position: absolute;
        left: 16px;
        top: 50%;
        transform: translateY(-50%);
        color: var(--text-muted);
        font-size: 0.9rem;
    }
    html[dir="ltr"] .input-unit {
        left: auto;
        right: 16px;
    }
    
    button.calc-btn {
        width: 100%;
        padding: 18px;
        background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
        color: var(--bg-body);
        border: none;
        border-radius: var(--radius);
        font-size: 1rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s;
        margin-top: 16px;
    }
    
    button.calc-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(20, 184, 166, 0.4);
    }
    
    button.calc-btn:active {
        transform: translateY(0);
    }
    
    .result {
        background: linear-gradient(135deg, rgba(15, 76, 76, 0.6) 0%, rgba(6, 78, 78, 0.6) 100%);
        border-radius: var(--radius);
        padding: 32px;
        text-align: center;
        margin-top: 32px;
        border: 1px solid var(--primary);
        display: none;
        animation: fadeIn 0.5s ease;
    }
    
    .result.show {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
    
    .result-label {
        font-size: 0.9rem;
        color: var(--text-muted);
        margin-bottom: 8px;
    }
    
    /* اصلاح استایل باکس نتیجه برای تم تیره */
    .result-value, .result-zone, .result-full {
        font-size: 2.5rem;
        font-weight: 800;
        color: var(--primary-hover); /* تغییر رنگ متن به فیروزه‌ای */
        line-height: 1;
        background: rgba(0, 0, 0, 0.3); /* پس‌زمینه تیره */
        border: 2px solid var(--primary);
        padding: 15px;
        margin: 10px;
        border-radius: 14px;
        width: 160px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 10px rgba(0,0,0,0.3);
        text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    }
    
    .examples {
        background: rgba(0, 0, 0, 0.2);
        border-radius: var(--radius);
        padding: 20px;
        margin-top: 32px;
        border: 1px solid var(--border);
    }
    
    .examples h3 {
        font-size: 0.9rem;
        color: var(--text-muted);
        margin-bottom: 12px;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .example-list {
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .example-item {
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 12px 16px;
        font-size: 0.85rem;
        cursor: pointer;
        transition: all 0.2s;
        color: var(--text-main);
    }
    
    .example-item:hover {
        border-color: var(--primary);
        background: rgba(20, 184, 166, 0.1);
    }
    
    .coordinates-display {
        display: flex;
        gap: 16px;
        margin-top: 16px;
        font-size: 0.9rem;
        color: var(--text-muted);
        flex-wrap: wrap;
    }
    
    .coord {
        background: rgba(255, 255, 255, 0.03);
        padding: 16px 16px;
        border-radius: 14px;
        border: 1px solid var(--primary);
        flex: 1;
        padding: 10px;
        text-align: center;
        justify-content: center;
        align-items: center;
        min-width: 140px;
    }
    
    .coord-value {
        color: var(--text-main);
        font-weight: 600;
        font-size: 1rem;
        padding: 10px;
        margin: 5px;
    }
    
    footer {
        padding: 24px 32px;
        border-top: 1px solid var(--border);
        text-align: center;
        color: var(--text-muted);
        font-size: 0.85rem;
        background: rgba(0,0,0,0.1);
    }
    
    /* MathML & Steps Styles */
    .solution-box {
        background: rgba(0, 0, 0, 0.2);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 24px;
        margin-top: 24px;
        text-align: center;
    }
    .solution-title {
        font-size: 1rem;
        color: var(--primary-hover);
        font-weight: bold;
        margin-bottom: 16px;
        display: block;
        border-bottom: 2px solid var(--border);
        padding-bottom: 8px;
    }
    /* MathML Styling */
    math {
        font-family: 'Times New Roman', serif;
        font-size: 1.2rem;
        direction: ltr;
        display: inline-block;
        margin: 10px 0;
        color: var(--text-main);
    }
    mrow, mn, mo, mi {
        direction: ltr;
    }
    .step-container {
        text-align: right;
        margin-top: 20px;
        padding-right: 10px;
        border-right: 3px solid var(--primary);
    }
    html[dir="ltr"] .step-container {
        text-align: left;
        padding-right: 0;
        padding-left: 10px;
        border-right: none;
        border-left: 3px solid var(--primary);
    }
    .step-item {
        margin-bottom: 16px;
        font-size: 0.95rem;
        color: var(--text-main);
        line-height: 1.8;
    }
    .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: var(--primary-hover);
    }
    
    @media (max-width: 768px) {
        .container {
            max-width: 100%;
        }
        
        .tabs {
            flex-direction: column;
            padding: 0;
        }
        
        .tab {
            border-radius: 0;
            text-align: center;
            padding: 16px;
            background: rgba(255,255,255,0.02);
            border-bottom: 1px solid var(--border);
        }
        .tab.active {
            width: 100%;
            margin: 0;
            border-bottom: 1px solid var(--primary);
        }
        
        .tab-content {
            padding: 24px;
        }
        
        .result-value, .result-zone, .result-full {
            font-size: 2rem;
            width: 100%;
        }
    }
    /* ==========================================
// استایل اسکرول‌بار مدرن (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 */
}