/* =========================================
       تنظیمات کلی و متغیرهای رنگی (Teal Theme)
       ========================================= */
    :root {
        --bg-dark: #042f2e;       /* پس‌زمینه اصلی صفحه */
        --bg-card: #0f4c4c;       /* پس‌زمینه کارت ابزار */
        --primary: #14b8a6;       /* رنگ اصلی (دکمه‌ها و هدر) */
        --primary-dark: #0f766e;  /* رنگ تیره برای هاور */
        --accent: #2dd4bf;        /* رنگ تاکید (متن‌های مهم) */
        --text-main: #ccfbf1;     /* رنگ متن اصلی */
        --text-muted: #99f6e4;    /* رنگ متن فرعی و لیبل‌ها */
        --border: #115e59;        /* رنگ حاشیه‌ها */
        --radius: 15px;
        --shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
        
        /* تنظیمات فونت */
        --font-fa: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        --font-en: 'Segoe UI', Arial, sans-serif;
    }

    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        font-family: var(--font-fa);
    }

    body {
        background: var(--bg-dark);
        min-height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 20px;
        transition: direction 0.3s;
        color: var(--text-main);
    }

    .container {
        width: 100%;
        max-width: 600px;
        background: var(--bg-card);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
        overflow: hidden;
        text-align: center;
        position: relative;
        border: 1px solid var(--border);
    }

    /* دکمه تغییر زبان */
    .lang-switch {
        position: absolute;
        top: 20px;
        left: 20px;
        background: rgba(255, 255, 255, 0.15);
        border: 1px solid rgba(255, 255, 255, 0.3);
        color: white;
        padding: 5px 15px;
        border-radius: 20px;
        cursor: pointer;
        font-size: 0.85rem;
        z-index: 10;
        transition: all 0.3s;
        backdrop-filter: blur(4px);
    }

    html[dir="rtl"] .lang-switch {
        left: 20px;
        right: auto;
    }

    html[dir="ltr"] .lang-switch {
        right: 20px;
        left: auto;
    }

    .lang-switch:hover {
        background: rgba(255, 255, 255, 0.3);
    }

    /* هدر */
    header {
        background: linear-gradient(135deg, var(--primary-dark), var(--primary));
        color: white;
        padding: 25px;
        text-align: center;
        position: relative;
        border-bottom: 1px solid var(--border);
    }

    header h1 {
        font-size: 1.6rem;
        margin-bottom: 10px;
        font-weight: bold;
    }

    .subtitle {
        color: #ffffff;
        font-size: 0.9rem;
        opacity: 0.9;
    }

    .main-content {
        padding: 30px;
    }

    /* ورودی‌ها */
    .input-group {
        margin-bottom: 25px;
    }

    .input-row {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 15px;
    }

    .input-row input {
        flex: 1;
        padding: 12px;
        background: rgba(4, 47, 46, 0.5);
        border: 2px solid var(--border);
        border-radius: 8px;
        font-size: 1.1rem;
        text-align: center;
        transition: all 0.3s;
        color: var(--text-main);
    }

    .input-row input:focus {
        outline: none;
        border-color: var(--accent);
        box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.2);
        background: rgba(4, 47, 46, 0.8);
    }

    .unit {
        background: rgba(4, 47, 46, 0.6);
        padding: 12px 20px;
        border-radius: 8px;
        font-weight: 600;
        color: var(--text-muted);
        min-width: 100px;
        text-align: center;
        border: 2px solid var(--border);
    }

    /* دکمه محاسبه */
    .calculate-btn {
        width: 100%;
        padding: 15px;
        background: linear-gradient(135deg, var(--primary-dark), var(--primary));
        color: white;
        border: none;
        border-radius: 8px;
        font-size: 1.2rem;
        font-weight: bold;
        cursor: pointer;
        margin-top: 20px;
        transition: all 0.3s;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        box-shadow: 0 4px 15px rgba(20, 184, 166, 0.3);
    }

    .calculate-btn:hover {
        background: linear-gradient(135deg, var(--primary), var(--accent));
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(20, 184, 166, 0.5);
    }

    /* نتایج */
    .results {
        margin-top: 30px;
        padding: 25px;
        background: rgba(20, 184, 166, 0.1);
        border-radius: 10px;
        border: 2px solid var(--accent);
        backdrop-filter: blur(5px);
    }

    .result-item {
        margin: 20px 0;
        padding: 15px;
        background: rgba(4, 47, 46, 0.6);
        border-radius: 8px;
        border: 2px solid var(--primary);
        animation: fadeIn 0.5s ease-out;
    }

    .result-label {
        color: var(--text-muted);
        font-weight: 600;
        margin-bottom: 8px;
        font-size: 1rem;
    }

    .result-value {
        color: var(--accent);
        font-size: 1.6rem;
        font-weight: bold;
        text-shadow: 0 0 10px rgba(45, 212, 191, 0.3);
    }

    .result-sub {
        color: var(--text-muted);
        font-size: 0.9rem;
        margin-top: 5px;
    }

    /* بخش فرمول و مراحل */
    .steps-container {
        margin-top: 30px;
        text-align: right;
        background: rgba(0, 0, 0, 0.2);
        padding: 20px;
        border-radius: 10px;
        border: 1px dashed var(--border);
        display: none; /* پیش‌فرض مخفی */
    }

    html[dir="ltr"] .steps-container {
        text-align: left;
    }

    .steps-container.show {
        display: block;
        animation: fadeIn 0.5s ease-out;
    }

    .step-item {
        margin-bottom: 12px;
        font-size: 0.95rem;
        color: var(--text-muted);
        line-height: 1.6;
    }

    .math-formula {
        display: block;
        margin: 15px 0;
        padding: 15px;
        background-color: rgba(4, 47, 46, 0.6);
        border-radius: 8px;
        overflow-x: auto;
        direction: ltr; /* فرمول‌ها همیشه چپ به راست */
        font-family: 'Times New Roman', Times, serif;
        font-size: 1.2rem;
        color: var(--text-main);
        border: 1px solid var(--border);
    }

    footer {
        text-align: center;
        padding: 20px;
        color: var(--text-muted);
        font-size: 0.9rem;
        border-top: 1px solid var(--border);
    }

    /* SVG Icons */
    .icon {
        width: 1em;
        height: 1em;
        vertical-align: -0.125em;
        fill: currentColor;
    }

    @keyframes fadeIn {
        from { opacity: 0; transform: translateY(10px); }
        to { opacity: 1; transform: translateY(0); }
    }

    @media (max-width: 480px) {
        .input-row {
            flex-direction: column;
        }
        .unit {
            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 */
}