
        :root {
            --primary: #1b5e20;
            --primary-light: #4c8c4a;
            --secondary: #2e7d32;
            --accent: #fbc02d;
            --bg-body: #f5f7fa;
            --bg-sidebar: #111827;
            --text-main: #263238;
            --text-light: #546e7a;
            --white: #ffffff;
            --border: #e0e0e0;
            --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
            --radius: 12px;
            --font-fa: 'Vazirmatn', sans-serif;
            --font-en: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            outline: none;
        }

        body {
            font-family: var(--font-fa);
            background-color: var(--bg-body);
            color: var(--text-main);
            display: flex;
            height: 100vh;
            overflow: hidden;
            transition: all 0.3s ease;
        }

        /* LTR Overrides */
        html[dir="ltr"] body {
            font-family: var(--font-en);
        }

        /* --- Sidebar Styles --- */
        .sidebar {
            width: 320px;
            background-color: var(--bg-sidebar);
            color: var(--white);
            display: flex;
            flex-direction: column;
            flex-shrink: 0;
            box-shadow: 4px 0 15px rgba(0,0,0,0.2);
            transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            z-index: 100;
        }

        html[dir="ltr"] .sidebar {
            box-shadow: -4px 0 15px rgba(0,0,0,0.2);
            border-left: 1px solid rgba(255,255,255,0.1);
        }

        .sidebar-header {
            padding: 25px 20px;
            background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0) 100%);
            border-bottom: 1px solid rgba(255,255,255,0.1);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .header-text h1 {
            font-size: 1.3rem;
            font-weight: 800;
            margin-bottom: 5px;
            color: var(--accent);
            letter-spacing: -0.5px;
        }

        .header-text p {
            font-size: 0.85rem;
            opacity: 0.7;
            font-weight: 300;
        }

        .lang-switch {
            background: rgba(255,255,255,0.1);
            border: 1px solid rgba(255,255,255,0.2);
            color: white;
            padding: 5px 10px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 0.8rem;
            transition: background 0.2s;
        }

        .lang-switch:hover {
            background: rgba(255,255,255,0.2);
        }

        .nav-scroll {
            flex: 1;
            overflow-y: auto;
            padding: 10px 0;
        }

        .nav-scroll::-webkit-scrollbar { width: 5px; }
        .nav-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }

        .nav-category {
            padding: 20px 20px 8px;
            font-size: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 1.2px;
            color: rgba(255,255,255,0.3);
            font-weight: 700;
        }

        .nav-item {
            display: flex;
            align-items: center;
            padding: 12px 20px;
            cursor: pointer;
            transition: all 0.2s;
            border-inline-start: 4px solid transparent;
            font-size: 0.95rem;
            color: rgba(255,255,255,0.8);
        }

        .nav-item:hover {
            background-color: rgba(255,255,255,0.05);
            padding-inline-start: 25px;
            color: var(--white);
        }

        .nav-item.active {
            background-color: rgba(27, 94, 32, 0.4);
            border-inline-start-color: var(--accent);
            color: var(--white);
            font-weight: 600;
        }

        /* --- Main Content Styles --- */
        .main-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            position: relative;
            overflow: hidden;
        }

        .top-bar {
            height: 70px;
            background: var(--white);
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            padding: 0 30px;
            justify-content: space-between;
            box-shadow: 0 2px 4px rgba(0,0,0,0.02);
        }

        .menu-toggle {
            display: none;
            background: none;
            border: none;
            font-size: 1.5rem;
            cursor: pointer;
            color: var(--primary);
        }

        .content-area {
            flex: 1;
            overflow-y: auto;
            padding: 40px;
            scroll-behavior: smooth;
        }

        .tool-card {
            background: var(--white);
            border-radius: var(--radius);
            box-shadow: var(--shadow);
            padding: 40px;
            max-width: 900px;
            margin: 0 auto;
            display: none;
            animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
            border: 1px solid rgba(0,0,0,0.02);
        }

        .tool-card.active { display: block; }

        @keyframes slideUp {
            from { opacity: 0; transform: translateY(20px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .tool-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 25px;
            border-bottom: 2px solid #f0f0f0;
            padding-bottom: 20px;
        }

        .tool-title {
            font-size: 1.6rem;
            color: var(--primary);
            font-weight: 800;
        }

        .tool-badge {
            background: #e8f5e9;
            color: var(--primary);
            padding: 5px 12px;
            border-radius: 20px;
            font-size: 0.8rem;
            font-weight: 700;
        }

        .tool-desc {
            color: var(--text-light);
            margin-bottom: 30px;
            font-size: 1rem;
            line-height: 1.7;
            background: #fafafa;
            padding: 15px;
            border-radius: 8px;
            border-inline-start: 4px solid var(--accent);
        }

        /* --- Form Elements --- */
        .input-group {
            margin-bottom: 25px;
            background: #fff;
            padding: 20px;
            border-radius: var(--radius);
            border: 1px solid var(--border);
        }

        .input-row {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 20px;
            margin-bottom: 20px;
        }

        .input-field { position: relative; }
        
        .input-field label {
            display: block;
            margin-bottom: 8px;
            font-size: 0.9rem;
            font-weight: 600;
            color: var(--text-main);
        }

        .input-field input {
            width: 100%;
            padding: 12px 15px;
            border: 2px solid var(--border);
            border-radius: 8px;
            font-size: 1rem;
            transition: all 0.3s;
            font-family: inherit;
        }

        .input-field input:focus {
            border-color: var(--primary);
            box-shadow: 0 0 0 4px rgba(27, 94, 32, 0.1);
        }

        .unit {
            font-size: 0.8rem;
            color: var(--text-light);
            margin-top: 5px;
            display: block;
            font-weight: 500;
        }

        .btn-reset {
            background-color: #ffebee;
            color: #c62828;
            border: none;
            padding: 8px 16px;
            border-radius: 6px;
            cursor: pointer;
            font-family: inherit;
            font-weight: 600;
            transition: background 0.2s;
            margin-top: 10px;
        }

        .btn-reset:hover {
            background-color: #ffcdd2;
        }

        /* --- Result Box --- */
        .result-container {
            margin-top: 30px;
            padding: 25px;
            background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
            border: 1px solid #a5d6a7;
            border-radius: var(--radius);
            display: none;
        }

        .result-container.show { display: block; animation: fadeIn 0.5s; }
        
        .result-container.error {
            background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
            border-color: #ef9a9a;
        }

        @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
        
        .result-title {
            color: var(--primary);
            font-weight: 700;
            margin-bottom: 10px;
            font-size: 1rem;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .result-value {
            font-size: 2rem;
            font-weight: 800;
            color: var(--primary);
            direction: ltr;
            text-align: right;
            line-height: 1.2;
        }
        
        html[dir="ltr"] .result-value {
            text-align: left;
        }

        .formula-box {
            margin-top: 15px;
            padding-top: 15px;
            border-top: 1px dashed rgba(0,0,0,0.1);
            font-family: 'Times New Roman', serif;
            font-style: italic;
            color: #555;
            font-size: 0.95rem;
            text-align: left;
            direction: ltr;
        }

        /* --- Footer --- */
        .footer {
            text-align: center;
            padding: 30px;
            color: var(--text-light);
            font-size: 0.85rem;
            margin-top: 50px;
            border-top: 1px solid var(--border);
        }

        /* --- Responsive --- */
        @media (max-width: 900px) {
            .sidebar {
                position: fixed;
                height: 100%;
                top: 0;
                width: 300px;
            }
            
            html[dir="rtl"] .sidebar {
                right: -320px;
            }
            html[dir="rtl"] .sidebar.open {
                right: 0;
            }

            html[dir="ltr"] .sidebar {
                left: -320px;
            }
            html[dir="ltr"] .sidebar.open {
                left: 0;
            }

            .menu-toggle { display: block; }
            .content-area { padding: 20px; }
            .tool-card { padding: 25px; }
            .tool-title { font-size: 1.3rem; }
        }
    
