:root {
    --primary: #dc2626; /* HC Red */
    --primary-hover: #b91c1c;
    --bg-gray: #f9fafb;
    --card-bg: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border-light: #f3f4f6;
    --border-color: #e5e7eb;
    --radius: 24px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    background-color: var(--bg-gray); color: var(--text-main);
    font-family: 'Inter', 'Vazirmatn', sans-serif;
    margin: 0; padding: 0; line-height: 1.6;
}
.fa-body { direction: rtl; }

/* Header */
.main-header {
    background: white; border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem; display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; z-index: 50;
}
.header-brand { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.header-brand img { height: 40px; border-radius: 8px; }
.header-brand-name { font-weight: 800; font-size: 1rem; color: var(--text-main); }
.lang-toggle { background: var(--bg-gray); padding: 4px; border-radius: 8px; display: flex; gap: 4px; }
.lang-btn { background: transparent; border: none; padding: 6px 12px; border-radius: 6px; font-weight: 700; color: var(--text-muted); cursor: pointer; transition: 0.2s; font-size: 0.9rem;}
.lang-btn.active { background: white; color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

/* Progress Bar */
.progress-container { max-width: 800px; margin: 2rem auto; padding: 0 1rem; position: relative; display: flex; justify-content: space-between; }
.progress-line-bg { position: absolute; top: 18px; left: 0; width: 100%; height: 4px; background: #e5e7eb; z-index: 1; }
.progress-line-fill { position: absolute; top: 18px; left: 0; height: 4px; background: var(--primary); z-index: 2; transition: width 0.5s ease; }
.fa-body .progress-line-fill { left: auto; right: 0; }
.step-indicator { position: relative; z-index: 3; display: flex; flex-direction: column; align-items: center; width: 60px;}
.step-circle { width: 40px; height: 40px; border-radius: 50%; background: #e5e7eb; color: #9ca3af; display: flex; justify-content: center; align-items: center; font-weight: 800; font-size: 1rem; transition: 0.3s; border: 4px solid var(--bg-gray); box-sizing: content-box;}
.step-circle.active, .step-circle.completed { background: var(--primary); color: white; }
.step-label { margin-top: 8px; font-size: 0.75rem; font-weight: 700; color: #9ca3af; text-transform: uppercase; text-align: center; white-space: nowrap;}
.step-circle.active ~ .step-label, .step-circle.completed ~ .step-label { color: var(--primary); }

/* Main Layout */
.app-main { max-width: 900px; margin: 0 auto; padding: 1rem 1rem 4rem 1rem; min-height: 60vh; }
.step-section { display: none; animation: fadeIn 0.4s ease forwards; }
.step-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

/* Cards & Inputs */
.hc-card { background: var(--card-bg); border-radius: var(--radius); padding: 2.5rem; border: 1px solid var(--border-color); box-shadow: var(--shadow); margin-bottom: 2rem;}
.hc-card-title { font-size: 1.8rem; font-weight: 800; color: var(--text-main); display: flex; align-items: center; gap: 12px; margin-top: 0; margin-bottom: 1.5rem; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.form-group { display: flex; flex-direction: column; gap: 0.5rem; }
.form-group label { font-weight: 700; color: #374151; font-size: 1rem; }
select, input[type="text"] { width: 100%; padding: 1rem 1.25rem; border-radius: 12px; border: 1px solid var(--border-color); background-color: #f9fafb; font-family: inherit; font-size: 1rem; color: var(--text-main); transition: 0.2s; box-sizing: border-box;}
select:focus, input[type="text"]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1); background: white;}

/* Toggles (Yes/No) */
.toggle-group { display: flex; gap: 1rem; }
.toggle-label { flex: 1; position: relative; cursor: pointer; }
.toggle-label input { display: none; }
.toggle-btn { display: block; text-align: center; padding: 1rem; border-radius: 12px; border: 2px solid var(--border-color); background: #f9fafb; font-weight: 800; color: var(--text-muted); transition: 0.2s; }
.toggle-label input:checked + .toggle-btn { border-color: var(--primary); background: #fef2f2; color: var(--primary); }

/* Buttons */
.nav-buttons { display: flex; justify-content: space-between; margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border-light); }
.btn-back { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-weight: 700; background: none; border: none; cursor: pointer; font-size: 1.1rem; padding: 10px; transition: 0.2s;}
.btn-back:hover { color: var(--text-main); }
.btn-next { display: flex; align-items: center; gap: 8px; background: var(--primary); color: white; padding: 1rem 2.5rem; border-radius: 14px; font-weight: 800; border: none; cursor: pointer; font-size: 1.1rem; box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3); transition: 0.2s; }
.btn-next:hover { background: var(--primary-hover); transform: translateY(-2px); }

/* NOC Search */
.noc-search-wrapper { position: relative; }
#noc-results-container { position: absolute; z-index: 100; width: 100%; background: white; border: 1px solid var(--primary); border-radius: 12px; max-height: 250px; overflow-y: auto; box-shadow: 0 10px 25px rgba(0,0,0,0.1); display: none; margin-top: 5px;}
#noc-results-container.visible { display: block; }
.noc-result-item { padding: 12px 15px; cursor: pointer; border-bottom: 1px solid #f3f4f6; font-size: 0.95rem;}
.noc-result-item:hover { background-color: #fef2f2; color: var(--primary); font-weight: 600;}

/* Status Badges */
.status-badge { display: inline-block; padding: 4px 10px; font-size: 0.75rem; font-weight: 800; color: white; border-radius: 20px; margin-inline-start: 8px; vertical-align: middle; }
.status-badge.shortage { background-color: #dc2626; }
.status-badge.slight-shortage { background-color: #f97316; }
.status-badge.balanced { background-color: #10b981; }
.status-badge.slight-surplus { background-color: #3b82f6; }
.status-badge.not-published { background-color: #6b7280; }

/* Results Step */
.score-hero { background: #111827; color: white; padding: 3rem; border-radius: var(--radius); text-align: center; margin-bottom: 2rem;}
.score-number { font-size: 6rem; font-weight: 800; line-height: 1; margin: 1rem 0; color: white;}
.score-max { font-size: 1.5rem; color: #9ca3af; font-weight: 600; }
.score-breakdown { display: flex; justify-content: space-around; margin-top: 2rem; border-top: 1px solid #374151; padding-top: 1.5rem;}
.score-item { text-align: center; }
.score-item-val { font-size: 1.5rem; font-weight: 800; color: white;}
.score-item-lbl { font-size: 0.8rem; color: #9ca3af; text-transform: uppercase;}

.ai-card { background: linear-gradient(145deg, #ffffff, #fef2f2); border: 2px solid #fecaca; padding: 2rem; border-radius: var(--radius); margin-bottom: 2rem;}
.ai-btn-large { width: 100%; background: var(--primary); color: white; padding: 1.25rem; border-radius: 16px; font-size: 1.2rem; font-weight: 800; display: flex; justify-content: center; align-items: center; gap: 10px; border: none; cursor: pointer; transition: 0.3s; box-shadow: 0 10px 20px rgba(220,38,38,0.2);}
.ai-btn-large:hover { background: var(--primary-hover); transform: translateY(-2px);}

.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: 1rem; border-radius: 12px; border-left: 4px solid; background: #f9fafb;}
.fa-body .stream-item { border-left: none; border-right: 4px solid; }
.stream-item.eligible { border-color: #10b981; }
.stream-item.ineligible { border-color: #dc2626; }
.stream-item.warning { border-color: #f59e0b; }
.stream-item-icon { font-size: 1.5rem; }
.stream-item-text p { margin: 0; font-weight: 700; color: var(--text-main);}
.stream-item-text .reason { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.25rem; }

/* Diagnostics Table */
.table-wrapper { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border-color); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; background: white;}
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: 700; color: var(--text-muted); background: #f9fafb; text-transform: uppercase;}
table.hidden { display: none; }

@media (max-width: 768px) {
    .step-label { display: none; }
    .hc-card { padding: 1.5rem; }
    .score-breakdown { flex-direction: column; gap: 1rem; }
}

/* اصلاح ارتفاع و اسکرول جدول مشاغل */
.table-container-scroll {
    max-height: 500px; /* ارتفاع ثابت برای جلوگیری از طولانی شدن صفحه */
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: white;
}

table { width: 100%; border-collapse: collapse; position: relative; }
thead th { position: sticky; top: 0; background: #f9fafb; z-index: 10; box-shadow: 0 1px 0 var(--border-color); }

/* استایل دکمه‌های رادیویی (Yes/No) */
.toggle-btn {
    display: flex; align-items: center; justify-content: center;
    min-height: 50px; border-radius: 12px; border: 2px solid var(--border-color);
    background: #f9fafb; font-weight: 800; color: var(--text-muted); cursor: pointer;
}

/* فلش‌ها در زبان فارسی */
.fa-body .rtl-arrow { transform: rotate(180deg); }
.fa-body .btn-next i { margin-right: 8px; margin-left: 0; }
/* فلش‌ها در زبان فارسی */
.fa-body .rtl-arrow { transform: rotate(180deg); }
.fa-body .btn-next i { margin-right: 8px; margin-left: 0; }
.live-score-bar {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 2rem;
    position: sticky;
    top: 70px; /* ارتفاع هدر */
    z-index: 40;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.live-score-container {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1.5rem;
}
.live-score-label {
    font-weight: 700;
    color: var(--text-muted);
}
.live-score-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
}
.live-score-max {
    color: var(--text-muted);
    font-weight: 600;
}
.live-score-breakdown {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}
/* Step 0 – Home: وسط‌چین عمودی و افقی */
#step-0.active {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 80px); /* ارتفاع هدر (حدوداً 70-80px) */
    text-align: center;
}

.home-content {
    width: 100%;
    max-width: 600px;
    padding: 2rem;
}