
        /* --- تنظیمات متغیرهای رنگی مدرن --- */
        :root {
            /* پالت رنگی اصلی: گرادینت آبی مدرن */
            --primary-gradient: linear-gradient(135deg, #0d47a1 0%, #1976d2 100%);
            --accent-color: #00bcd4; /* فیروزه‌ای برای تاکید */
            --accent-hover: #00acc1;
            
            /* رنگ‌های پس‌زمینه و متن */
            --bg-body: #f0f2f5;
            --bg-card: #ffffff;
            --text-main: #767676;
            --text-secondary: #7f8c8d;
            --border-color: #e1e8ed;
            
            /* سایه‌ها برای عمق (Neumorphism Lite) */
            --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
            --shadow-md: 0 8px 24px rgba(0,0,0,0.08);
            --shadow-lg: 0 15px 35px rgba(0,0,0,0.12);
            --shadow-float: 0 10px 20px rgba(13, 71, 161, 0.25);
            
            /* ابعاد و انیمیشن */
            --header-height: 70px;
            --radius-md: 16px;
            --radius-lg: 24px;
            --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        }
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            font-family: 'Vazirmatn', 'Tahoma', 'Segoe UI', Geneva, Verdana, sans-serif;
            -webkit-tap-highlight-color: transparent;
        }
        body {
            background-color: var(--bg-body);
            /* الگوی پس‌زمینه ظریف */
            background-image: radial-gradient(#e1e8ed 1px, transparent 1px);
            background-size: 20px 20px;
            color: var(--text-main);
            display: flex;
            flex-direction: column;
            height: 100vh;
            overflow: hidden;
            transition: direction 0.3s;
        }
        /* --- Header مدرن --- */
        header {
            background: var(--primary-gradient);
            color: var(--white);
            height: var(--header-height);
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 25px;
            box-shadow: var(--shadow-md);
            z-index: 100;
            flex-shrink: 0;
            position: relative;
        }
        h2{
            background: #007dca;
            margin: 12px;
            padding: 14px;
            border-radius: 14px;
            border: solid 1px #fff;
            text-align: center;
            text-shadow: 3px 3px 5px #000;
        }
        /* افکت درخشش روی هدر */
        header::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            height: 1px;
            background: rgba(255,255,255,0.3);
        }
        .header-left { display: flex; align-items: center; gap: 15px; }
        
        .menu-toggle {
            background: rgba(255,255,255,0.15);
            border: none;
            color: white;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            cursor: pointer;
            display: none;
            align-items: center;
            justify-content: center;
            transition: var(--transition);
        }
        .menu-toggle:hover { background: rgba(255,255,255,0.3); transform: rotate(90deg); }
        .app-title { 
            font-size: 1.25rem; 
            font-weight: 800; 
            letter-spacing: -0.5px;
            text-shadow:3px 3px 5px rgba(0, 0, 0, 0.752);
            color: #ffffff;
           
        }
        
        .header-actions button {
            background: rgba(255,255,255,0.15);
            backdrop-filter: blur(5px);
            border: 1px solid rgba(255,255,255,0.2);
            color: white;
            padding: 8px 16px;
            border-radius: 30px;
            cursor: pointer;
            font-size: 0.85rem;
            font-weight: 600;
            margin-left: 10px;
            transition: var(--transition);
            
            
        }
        html[dir="ltr"] .header-actions button { margin-left: 0; margin-right: 10px; }
        
        .header-actions button:hover {
            background: rgba(255,255,255,0.3);
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(255, 0, 0, 0.657);
            
            
        }
        /* --- Layout Container --- */
        .app-container {
            display: flex;
            flex: 1;
            overflow: hidden;
            position: relative;
            
            
        }
        /* --- Sidebar مدرن --- */
        .sidebar {
            width: 300px;
            background-color: var(--bg-card);
            color: var(--text-main);
            display: flex;
            flex-direction: column;
            border-left: 1px solid var(--border-color);
            overflow-y: auto;
            transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
            z-index: 90;
            flex-shrink: 0;
            box-shadow: var(--shadow-sm);
            background-color: #1976d2;
            color: #ffffff;
        }
        html[dir="ltr"] .sidebar { border-left: none; border-right: 1px solid var(--border-color); }
        .sidebar-header {
            padding: 25px;
            border-bottom: 1px solid var(--border-color);
            background: #ffc40000;
             border-radius: 14px;
             margin: 14px;
        }
        .sidebar-header h2 { 
            font-size: 1.1rem; 
            color: var(--primary-color); 
            font-weight: 700;
            display: flex;
            align-items: center;
            gap: 10px;
            
        }
        .sidebar-header h2::before {
            content: '';
            display: block;
            width: 4px;
            height: 18px;
            background: var(--accent-color);
            border-radius: 2px;
            
        }
        .nav-btn {
            background: none;
            border: none;
            color:#ffffff;
            padding: 16px 25px;
            text-align: inherit;
            cursor: pointer;
            font-size: 0.95rem;
            border-bottom: 1px solid transparent;
            transition: var(--transition);
            display: flex;
            align-items: center;
            justify-content: space-between;
            position: relative;
            font-weight: 500;
            margin: 14px;
            border-radius: 14px;
         
          
        }
        
        .nav-btn::before {
            content: '';
            position: absolute;
            right: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 3px;
            height: 0;
            background: var(--accent-color);
            border-radius: 2px 0 0 2px;
            transition: height 0.3s ease;
           
            
        }
        html[dir="ltr"] .nav-btn::before { right: auto; left: 0; border-radius: 0 2px 2px 0; }
        .nav-btn:hover { 
            background-color: #8a8a8a; 
            color: var(--primary-color); 
            padding-right: 30px; 
            border-radius: 14px;
        }
        html[dir="ltr"] .nav-btn:hover { padding-right: 25px; padding-left: 30px; }
        
        .nav-btn.active {
            background: linear-gradient(90deg, rgba(0, 188, 212, 0.08) 0%, rgba(255,255,255,0) 100%);
            color: var(--primary-color);
            font-weight: 700;
             border:#00acc1 solid 1px;
             border-radius: 14px;
        }
        html[dir="ltr"] .nav-btn.active { background: linear-gradient(-90deg, rgba(0, 188, 212, 0.08) 0%, rgba(255,255,255,0) 100%); }
        
        .nav-btn.active::before { height: 24px; }
        /* --- Main Content --- */
        .main-content {
            flex: 1;
            padding: 30px;
            overflow-y: auto;
            position: relative;
            scroll-behavior: smooth;
        }
        
        /* اسکرول بار زیبا */
        .main-content::-webkit-scrollbar { width: 8px; }
        .main-content::-webkit-scrollbar-track { background: transparent; }
        .main-content::-webkit-scrollbar-thumb { background: #cbd5e0; border-radius: 4px; }
        .main-content::-webkit-scrollbar-thumb:hover { background: #a0aec0; }
        .tool-container {
            display: none;
            background: var(--bg-card);
            padding: 35px;
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-md);
            max-width: 850px;
            margin: 0 auto;
            animation: slideUpFade 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
            border: 1px solid rgba(255,255,255,0.8);
        }
        .tool-container.active { display: block; }
        
        @keyframes slideUpFade { 
            from { opacity: 0; transform: translateY(30px) scale(0.98); } 
            to { opacity: 1; transform: translateY(0) scale(1); } 
        }
        .tool-header {
            margin-bottom: 30px;
            padding-bottom: 20px;
            border-bottom: 1px solid var(--border-color);
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            flex-wrap: wrap;
            gap: 15px;
        }
        .tool-header h1 { 
            color: var(--primary-color); 
            font-size: 1.6rem; 
            margin-bottom: 8px;
            background: -webkit-linear-gradient(45deg, #0d47a1, #00bcd4);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }
        .tool-header p { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.6; }
        /* Form Elements مدرن */
        .form-group { margin-bottom: 25px; position: relative; }
        .form-group label { 
            display: block; 
            margin-bottom: 10px; 
            font-weight: 600; 
            font-size: 0.9rem; 
            color: var(--text-main); 
            transition: color 0.3s;
        }
        
        .form-group input {
            width: 100%;
            padding: 14px 16px;
            border: 2px solid var(--border-color);
            border-radius: var(--radius-md);
            font-size: 1rem;
            transition: var(--transition);
            background: #fdfdfd;
            color: var(--text-main);
        }
        
        .form-group input:focus {
            border-color: var(--accent-color);
            background: #fff;
            outline: none;
            box-shadow: 0 0 0 4px rgba(0, 188, 212, 0.1);
            color:#000;
        }
        
        .form-group input:focus + label {
            color: var(--accent-color);
            
        }
        .calc-btn {
            background: var(--primary-gradient);
            color: var(--white);
            border: none;
            padding: 16px;
            font-size: 1.05rem;
            border-radius: var(--radius-md);
            cursor: pointer;
            width: 100%;
            font-weight: 700;
            transition: var(--transition);
            box-shadow: var(--shadow-float);
            position: relative;
            overflow: hidden;
            letter-spacing: 0.5px;
            color:#ffffff;
        }
        
        /* افکت موج روی دکمه */
        .calc-btn::after {
            content: '';
            position: absolute;
            top: 0; left: -100%;
            width: 100%; height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
            transition: 0.5s;
        }
        .calc-btn:hover::after { left: 100%; }
        .calc-btn:hover { 
            transform: translateY(-3px); 
            box-shadow: 0 15px 30px rgba(13, 71, 161, 0.35);
        }
        .calc-btn:active { transform: translateY(-1px); }
        /* Result Box مدرن */
        .result-box {
            margin-top: 30px;
            padding: 25px;
            background: linear-gradient(135deg, #e0f7fa 0%, #e1f5fe 100%);
            border: 1px solid #b2ebf2;
            border-radius: var(--radius-md);
            display: none;
            position: relative;
            overflow: hidden;
        }
        .result-box.show { display: block; animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
        
        @keyframes popIn {
            from { opacity: 0; transform: scale(0.9); }
            to { opacity: 1; transform: scale(1); }
        }
        .result-box h3 { 
            color: #006064; 
            margin-bottom: 12px; 
            font-size: 1.1rem; 
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .result-box h3::before {
            content: '✓';
            background: #00bcd4;
            color: white;
            width: 24px;
            height: 24px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.8rem;
        }
        .result-value { 
            font-size: 1.8rem; 
            font-weight: 800; 
            color: #0277bd; 
            display: block; 
            margin-top: 10px;
            text-shadow: 0 2px 4px rgba(0,0,0,0.05);
        }

        /* --- Styles for Calculation Steps --- */
        .calc-steps {
            margin-top: 20px;
            padding: 15px;
            background: #fff8e1; /* رنگ کرم روشن برای مراحل */
            border: 1px solid #ffe0b2;
            border-radius: 8px;
            font-size: 0.85rem;
            color: #5d4037;
            direction: ltr; /* فرمول‌ها چپ به راست */
            text-align: left;
            unicode-bidi: embed;
        }
        .calc-steps h4 {
            margin: 0 0 10px 0;
            font-size: 0.95rem;
            color: #e65100;
            border-bottom: 1px solid #ffe0b2;
            padding-bottom: 5px;
            direction: rtl; /* عنوان راست به چپ */
            text-align: right;
        }
        .step-line {
            margin-bottom: 8px;
            font-family: 'Courier New', Courier, monospace;
            line-height: 1.5;
        }
        .step-desc {
            display: block;
            margin-bottom: 4px;
            font-family: inherit;
            direction: rtl;
            text-align: right;
            font-weight: bold;
            color: #795548;
        }

        /* Overlay for Mobile Sidebar */
        .sidebar-overlay {
            position: fixed; top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(15, 23, 42, 0.6);
            backdrop-filter: blur(4px);
            z-index: 80;
            display: none;
            opacity: 0;
            transition: opacity 0.3s;
        }
        .sidebar-overlay.active { display: block; opacity: 1; }
        /* --- Responsive Design --- */
        @media (max-width: 900px) {
            .sidebar {
                position: fixed;
                top: var(--header-height);
                bottom: 0;
                right: -300px;
                width: 300px;
                box-shadow: -5px 0 25px rgba(0,0,0,0.1);
            }
            html[dir="ltr"] .sidebar { right: auto; left: -300px; box-shadow: 5px 0 25px rgba(0,0,0,0.1); }
            
            .sidebar.active { right: 0; }
            html[dir="ltr"] .sidebar.active { left: 0; }
            
            .menu-toggle { display: flex; }
            .main-content { padding: 20px; }
            .tool-container { padding: 25px; }
        }
        @media (max-width: 480px) {
            .tool-header { flex-direction: column; }
            .tool-header h1 { font-size: 1.3rem; }
            .calc-btn { font-size: 1rem; padding: 14px; }
            .result-value { font-size: 1.5rem; }
        }
        /* --- Print Styles --- */
        @media print {
            .sidebar, .sidebar-overlay, .menu-toggle, .header-actions, .calc-btn { display: none !important; }
            body, .app-container, .main-content { 
                height: auto; 
                overflow: visible; 
                display: block; 
                background: white; 
                background-image: none;
            }
            .tool-container { 
                box-shadow: none; 
                border: 1px solid #ddd; 
                max-width: 100%; 
                display: block !important; 
                margin-bottom: 20px; 
                padding: 15px;
            }
            .result-box { 
                border: 1px solid #ccc; 
                background: none; 
                box-shadow: none;
            }
            .result-value { color: #000; text-shadow: none; }
            .calc-steps { background: #fff; border: 1px dashed #ccc; color: #000; }
        }
    
