:root {
    --primary-color: #0d6efd;
    --primary-light: #4dabf7;
    --secondary-color: #6c757d;
    --accent-color: #dc3545;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --body-bg: #f8f9fa;
    --card-bg: rgba(255, 255, 255, 0.9);
    --text-color: #212529;
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --border-radius: 24px !important;
    --transition-speed: 0.3s ease;
}

.dark-mode {
    --primary-color: #4dabf7;
    --primary-light: #74c0fc;
    --secondary-color: #adb5bd;
    --success-color: #28a745;
    --danger-color: #e57373;
    --accent-color: #e57373;
    --body-bg: #1a1a1a;
    --card-bg: rgba(33, 37, 41, 0.85);
    --text-color: #e9ecef;
    --border-color: rgba(255, 255, 255, 0.15);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    background-color: var(--body-bg);
    color: var(--text-color);
    line-height: 1.6;
    margin: 0; padding: 20px;
    transition: background-color var(--transition-speed), color var(--transition-speed);
    direction: ltr !important;
}

/* ❌ حذف شد: فونت YekanBakh - الان در form-common.css تعریف شده */
.fa-body { direction: rtl !important; }

.container { max-width: 1200px; margin: 0 auto; }
.main-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem; padding: 1rem; background: var(--card-bg); backdrop-filter: blur(10px); border-radius: 24px; box-shadow: var(--shadow); border: 1px solid var(--border-color); }
.header-brand { display: flex; align-items: center; gap: 15px; }
.header-brand img { height: 60px; width: 60px; border-radius: 50%; object-fit: cover; }
.header-brand-text { display: flex; flex-direction: column; }
.header-brand-name { font-size: 1.5rem; font-weight: 700; color: var(--primary-color); line-height: 1.2; }
.fa-body .header-brand-name { font-size: 1.7rem; }
.header-brand-byline { font-size: 0.9rem; color: var(--secondary-color); }

.header-controls { display: flex; justify-content: center; align-items: center; gap: 20px; }
.lang-toggle { background: var(--card-bg); backdrop-filter: blur(10px); padding: 0.5rem; border-radius: 50px; box-shadow: var(--shadow); border: 1px solid var(--border-color); display:flex; }
.lang-btn { background: transparent; color: var(--secondary-color); border: none; padding: 8px 20px; border-radius: 30px; cursor: pointer; font-weight: 600; transition: all var(--transition-speed); }
.lang-btn:hover { color: var(--primary-color); }
.lang-btn.active { background: var(--primary-color); color: #fff; }
.dark-mode-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 8px; }
.toggle-switch { position: relative; display: inline-block; width: 50px; height: 26px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input[type="checkbox"]:checked + .slider { background-color: var(--primary-color); }
input[type="checkbox"]:checked + .slider:before { transform: translateX(24px); }

h1 { text-align: center; color: var(--primary-color); font-size: 2.2rem; font-weight: 700; margin-bottom: 2rem; margin-top: 1rem; }
.fa-body h1 { font-size: 2.4rem; }
h2[data-lang-key="diag_title"] {
        text-align: center; color: var(--primary-color); font-size: 2rem; font-weight: 700; margin-bottom: 2rem; margin-top: 3rem;
}

.calculator-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(340px, 1fr); gap: 2rem; align-items: flex-start; }
@media (max-width: 950px) { .calculator-layout { grid-template-columns: 1fr; } }
.form-sections { display: flex; flex-direction: column; gap: 2rem; }

.form-card, .content-card { background: var(--card-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius:24px; box-shadow: var(--shadow); border: 1px solid var(--border-color); overflow: visible; transition: all var(--transition-speed); }
.content-card { display:none; padding: 2rem; margin-top: 2rem; }
.form-card-header { display: flex; align-items: center; gap: 15px; padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-color); }
.fa-body .form-card-header { flex-direction: row-reverse; }
.form-card-header .icon { color: var(--primary-color); flex-shrink: 0; }
.form-card-header h2 { color: var(--text-color); margin: 0; font-size: 1.3rem; font-weight: 600; }
.form-card-body { padding: 1.5rem; }
.form-group { margin-bottom: 1.5rem; position: relative; }
.form-group:last-child { margin-bottom: 0; }
.form-group label { display: block; font-weight: 500; margin-bottom: 0.5rem; }
.info-note { font-size: 0.85rem; color: var(--secondary-color); margin-top: 0.5rem; background-color: color-mix(in srgb, var(--secondary-color) 8%, transparent); padding: 0.5rem 0.75rem; border-radius: 6px; }
.fa-body .info-note { text-align: right; }

.french-header { display: flex; justify-content: space-between; align-items: center; }
.info-icon { cursor: pointer; font-style: normal; display: inline-block; border: 2px solid var(--secondary-color); color: var(--secondary-color); width: 24px; height: 24px; border-radius: 50%; text-align: center; line-height: 21px; font-weight: bold; font-family: serif; transition: all var(--transition-speed); }
.info-icon:hover { background-color: var(--secondary-color); color: var(--card-bg); }

#french-info-box { display: none; background-color: var(--body-bg); border: 1px solid var(--border-color); padding: 1rem; border-radius: 12px; margin-top: 1rem; position: relative; }
#french-info-box.show { display: block; }
#french-info-box h4 { margin-top: 0; color: var(--primary-color); }
#french-info-box ul { padding-left: 20px; margin: 0; }
.fa-body #french-info-box ul { padding-left: 0; padding-right: 20px; }
#french-info-box .close-btn { position: absolute; top: 10px; right: 10px; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--secondary-color); }
.fa-body #french-info-box .close-btn { right: auto; left: 10px; }

select, input[type="text"] { width: 100%; padding: 12px 15px; border-radius: 8px; border: 1px solid var(--border-color); background-color: var(--body-bg); color: var(--text-color); box-sizing: border-box; transition: all var(--transition-speed); font-size: 1rem; }
select { appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236c757d' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 1rem center; background-size: 16px 12px; }
.fa-body select { background-position: left 1rem center; padding-left: 40px; padding-right: 15px; }
select:focus, input[type="text"]:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 20%, transparent); }

.noc-search-wrapper { position: relative; }
#noc-results-container { position: absolute; z-index: 10; width: 100%; background: var(--card-bg); backdrop-filter: blur(10px); border: 1px solid var(--border-color); border-top: none; border-radius: 0 0 8px 8px; max-height: 200px; overflow-y: auto; display: none; }
#noc-results-container.visible { display: block; }
#noc-results-container div { padding: 10px 15px; cursor: pointer; }
.fa-body #noc-results-container div { text-align: right; }
#noc-results-container div:hover { background-color: color-mix(in srgb, var(--primary-color) 15%, transparent); }

.spouse-section { border-left: 4px solid var(--accent-color); padding: 1.5rem; margin: 1.5rem 0; background-color: color-mix(in srgb, var(--accent-color) 5%, var(--card-bg)); border-radius: 8px; }
.fa-body .spouse-section { border-left: none; border-right: 4px solid var(--accent-color); }
.spouse-section > h3 { color: var(--accent-color); margin-top:0; font-weight: 600; }

.results-panel { position: sticky; top: 20px; align-self: start; }
#results, #stream-analysis-card, #analysis { background: var(--card-bg); backdrop-filter: blur(10px); border-radius: 24px; box-shadow: var(--shadow); border: 1px solid var(--border-color); padding: 1.5rem; text-align: center; }
#results h2, #stream-analysis-card h2 { margin-top: 0; color: var(--primary-color); font-weight: 600; }

.gauge-container { position: relative; width: 200px; height: 100px; margin: 1rem auto; overflow: hidden; }
.gauge-svg { width: 100%; height: 200px; }
.gauge-base, .gauge-fill { fill: none; stroke-width: 25; cx: 100; cy: 100; r: 80; stroke-linecap: round; }
.gauge-base { stroke: color-mix(in srgb, var(--text-color) 10%, transparent); }
.gauge-fill { stroke: var(--primary-color); transform-origin: 100px 100px; transform: rotate(-90deg); transition: stroke-dashoffset 0.8s cubic-bezier(0.65, 0, 0.35, 1); }
.gauge-text { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); font-size: 3rem; font-weight: 700; color: var(--text-color); line-height: 1; }
.gauge-max-score { font-size: 1rem; color: var(--secondary-color); font-weight: 400; }

.progress-section { margin-top: 2rem; }
.progress-item { margin-bottom: 1rem; text-align: left; }
.fa-body .progress-item { text-align: right; }
.progress-label { display: flex; justify-content: space-between; font-weight: 500; margin-bottom: 0.25rem; }
.progress-bar-bg { background: color-mix(in srgb, var(--text-color) 10%, transparent); border-radius: 20px; height: 10px; overflow: hidden; }
.progress-bar-fill { background-color: var(--primary-light); height: 100%; width: 0; border-radius: 20px; transition: width 0.5s ease-out; }
.fa-body .progress-bar-fill { float: right; }
#progress-bar-b { background-color: var(--success-color); }
#progress-bar-c { background-color: var(--accent-color); }

.accordion { margin-top: 1.5rem; }
.accordion-item { border-bottom: 1px solid var(--border-color); }
.accordion-item:last-child { border-bottom: none; }
.accordion-header { width: 100%; background: #fafafa; border: none; padding: 1rem; font-size: 1rem; font-weight: 600; text-align: left; color: #383b40 !important; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.fa-body .accordion-header { text-align: right; flex-direction: row; }
.accordion-header:hover { background-color: #eee; }
.accordion-arrow { transition: transform 0.3s ease; }
.accordion-header.active .accordion-arrow { transform: rotate(180deg); }
.accordion-content { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out, padding 0.3s ease-out; background-color: color-mix(in srgb, var(--text-color) 3%, transparent); padding: 0 1rem; }
.detail-item { display: flex; justify-content: space-between; padding: 0.5rem 0; font-size: 0.9rem; }
.fa-body .detail-item { flex-direction: row-reverse; }
.detail-value { font-weight: 600; }

#stream-analysis-card { margin-top: 1.5rem; text-align: left;}
.fa-body #stream-analysis-card { text-align: right; }
.stream-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 1rem; }
.stream-item { display: flex; align-items: flex-start; gap: 1rem; padding: 0.75rem 1rem; border-radius: 8px; border-left: 5px solid; }
.fa-body .stream-item { border-left: none; border-right: 5px solid; flex-direction: row-reverse; }
.stream-item.eligible { border-color: var(--success-color); background-color: color-mix(in srgb, var(--success-color) 10%, transparent); }
.stream-item.ineligible { border-color: var(--accent-color); background-color: color-mix(in srgb, var(--accent-color) 10%, transparent); }
.stream-item.warning { border-color: var(--warning-color); background-color: color-mix(in srgb, var(--warning-color) 15%, transparent); }
.stream-item-icon { font-size: 1.5rem; line-height: 1.4; }
.stream-item-text p { margin: 0; font-weight: 600; }
.stream-item-text .reason { font-size: 0.85rem; font-weight: 400; margin-top: 0.25rem; }

#analysis { margin-top: 1.5rem; text-align: left; }
.fa-body #analysis { text-align: right; }
#analysis h3 { color: var(--primary-color); margin-top: 0; font-size: 1.3rem; font-weight: 600; }
.analysis-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 1rem; }
.analysis-item { display: flex; align-items: flex-start; gap: 1rem; padding: 1rem; background-color: color-mix(in srgb, var(--text-color) 3%, transparent); border-radius: 12px; border-left: 4px solid var(--primary-light); }
.fa-body .analysis-item { border-left: none; border-right: 4px solid var(--primary-light); flex-direction: row-reverse;}
.analysis-item .icon { font-size: 1.5rem; line-height: 1.5; }
.analysis-item p { margin: 0; }

.radio-group { display:flex; gap: 10px; margin-top: 10px; justify-content: center;}
.radio-group label { display: flex; align-items: center; cursor: pointer; }
.radio-group input[type="radio"] { opacity: 0; width: 0; height: 0; }
.radio-group span { padding: 8px 16px; border: 1px solid var(--border-color); border-radius: 20px; transition: all var(--transition-speed); }
.radio-group input[type="radio"]:checked + span { background-color: var(--primary-color); color: #fff; border-color: var(--primary-color); }

.reset-btn { background-color: var(--accent-color); color: #fff; border: none; padding: 10px 20px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: all var(--transition-speed); margin-top: 1rem; display: block; margin-left: auto; margin-right: auto; }
.reset-btn:hover { background-color: color-mix(in srgb, var(--accent-color) 80%, black); }

#score-toast { position: fixed; bottom: -100px; left: 50%; transform: translateX(-50%); background-color: #212529; color: #fff; padding: 12px 24px; border-radius: 50px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); font-weight: 500; z-index: 1000; transition: bottom 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55); display: none; }
@media (min-width: 951px) { #score-toast { display: none !important; } }
#confetti-canvas { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; pointer-events: none; z-index: 9999; }

footer { text-align: center; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border-color); color: var(--secondary-color); font-size: 0.9rem; }

/* Styles from Diagnostics Table */
.search-container { margin-bottom: 2rem; }
#diagSearchInput { width: 100%; padding: 14px 20px; border-radius: 12px; border: 1px solid var(--border-color); background-color: var(--body-bg); color: var(--text-color); box-sizing: border-box; transition: all var(--transition-speed); font-size: 1.1rem; }
#diagSearchInput:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary-color) 20%, transparent); }
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.fa-body table { text-align: right; }
th, td { border-bottom: 1px solid var(--border-color); padding: 12px 15px; text-align: left; }
.fa-body th, .fa-body td { text-align: right; }
thead th { font-weight: 600; color: var(--primary-color); position: sticky; top: 0; background-color: var(--card-bg); }
tbody tr { transition: background-color var(--transition-speed); }
tbody tr:hover { background-color: color-mix(in srgb, var(--primary-color) 8%, transparent); }
.status-pill { padding: 4px 12px; border-radius: 20px; font-weight: 600; font-size: 0.85rem; color: #fff; white-space: nowrap; }
.status-deficit { background-color: var(--danger-color); }
.status-slight-deficit { background-color: color-mix(in srgb, var(--danger-color) 80%, var(--warning-color)); }
.status-balanced { background-color: var(--success-color); }
.status-slight-surplus { background-color: var(--primary-light); }
.status-not-published { background-color: var(--secondary-color); }
table.hidden { display: none; }

/* اضافه شده: برای هماهنگی با رنگ‌های تم */
h1 {
    font-size: 40px !important;
    color: #195df5 !important;
}
h2 {
    font-size: 24px !important;
    color: #516ef9 !important;
    font-weight: 700 !important;
}
.lang-btn.active {
    background-color: #ffffff !important;
    color: #f5635f !important;
}

@media only screen and (max-width: 580px) {
  h1 {
    font-size: 24px !important;
    color: #195df5 !important;
  }
  h2 {
    font-size: 20px !important;
    color: #516ef9 !important;
    font-weight: 700 !important;
}
	.main-header {
    justify-content: center !important;
}
}
.grid.grid-cols-1.md\:grid-cols-2.gap-4 select {
    width: 41%;
	border-radius: 13px !important;
}
h3.text-sm.font-semibold.uppercase.tracking-wider.opacity-80 {
    color: #eee !important;
}

.fa-body .form-card-header {
    flex-direction: row;
}
.lang-btn {
    font-weight: 400;
}
.lang-toggle {
	background: #383b40 !important;
}
.accordion-content {
    border-radius: 18px;
    margin-top: 8px;
	margin-bottom:8px;
	padding:8px;
	border-radius:13px !important;
}
button.accordion-header.active:focus {
    background: #eee !important;
}

/* CSS for NOC Status Badges */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: bold;
    color: white;
    border-radius: 12px;
    line-height: 1.3;
    vertical-align: middle;
    margin-left: 5px;
}

.status-badge.shortage { background-color: #c53030; } /* کمبود */
.status-badge.slight-shortage { background-color: #e53e3e; } /* کمبود جزئی */
.status-badge.balanced { background-color: #38a169; } /* متعادل */
.status-badge.slight-surplus { background-color: #3182ce; } /* مازاد جزئی */
.status-badge.not-published { background-color: #718096; } /* منتشر نشده */

/* Positioning the badge inside the search input */
.noc-search-wrapper {
    position: relative;
}
#noc_code_search {
    padding-right: 130px; /* Make space for the badge */
}
#selected-status-display {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    pointer-events: none; /* Make it unclickable */
    display: none; /* Hidden by default */
}
.noc-result-item {
    padding: 8px 12px;
    cursor: pointer;
}
.noc-result-item:hover {
    background-color: #f0f0f0;
}
