:root {
    --primary: #dc2626;
    --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 & Language ===== */
.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: 1.25rem;
    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: 960px;
    margin: 2rem auto;
    padding: 0 0.5rem;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.progress-line-bg {
    position: absolute;
    top: 16px;
    left: 0;
    width: 100%;
    height: 4px;
    background: #e5e7eb;
    z-index: 1;
}

.progress-line-fill {
    position: absolute;
    top: 16px;
    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: 52px;
}

.step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #9ca3af;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 800;
    font-size: 0.85rem;
    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: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    text-align: center;
    white-space: nowrap;
    line-height: 1.2;
}

.step-circle.active ~ .step-label,
.step-circle.completed ~ .step-label {
    color: var(--primary);
}

/* ===== Main Layout ===== */
.app-main {
    max-width: 1000px;
    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);
    }
}

/* step-0 full centering (home) – merged both definitions */
#step-0.active {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
    text-align: center;
    background: #ffffff;
    border-radius: 32px;
}

/* ===== 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 !important;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 700;
    color: #374151;
    font-size: 1rem;
}

select,
input[type="text"],
.hc-input {
    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;
}

/* Toggle 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;
}

/* Provincial Result Cards */
.result-card {
    transition: all 0.3s ease-in-out;
    border-width: 1px;
    border-style: solid;
    border-color: #e2e8f0;
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
}

.result-card-strong {
    border-color: #16a34a !important;
}

.result-card-eligible {
    border-color: #2563eb !important;
}

.result-card-potential {
    border-color: #f59e0b !important;
}

.result-card-ineligible {
    border-color: #dc2626 !important;
    opacity: 0.7;
}

.result-card-archived {
    border-color: #6b7280 !important;
    opacity: 0.6;
}

/* RTL Adjustments */
.fa-body .rtl-arrow {
    transform: rotate(180deg);
}

.fa-body .rtl-arrow-reverse {
    transform: rotate(0deg);
}

.fa-body .btn-back i,
.fa-body .btn-next i {
    margin-left: 0;
    margin-right: 8px;
}

/* Live Score Bar */
.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: 1000px;
    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);
}

/* ===== Home Page (cleaned duplicates) ===== */
.home-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem 1rem;
    text-align: center;
}

.home-container h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.5rem;
    letter-spacing: -0.3px;
}

.home-container .subtitle {
    font-size: 1rem;
    color: #475569;
    margin-bottom: 1.5rem;
    font-weight: 400;
}

.home-description {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 1rem 1.5rem;
    font-size: 16px;
    color: #334155;
    line-height: 1.9;
    margin: 0 auto 1.5rem;
    max-width: 700px;
    text-align: left;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.fa-body .home-description {
    text-align: right;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.5rem;
    margin: 1rem 0 1rem;
}

.feature-card {
    background: #ffffff;
    border: 1px solid #e9eef2;
    border-radius: 18px;
    padding: 1rem 0.5rem;
    text-align: center;
    transition: all 0.25s ease;
}

.feature-card:hover {
    border-color: #dc2626;
    box-shadow: 0 8px 20px rgba(220, 38, 38, 0.06);
    transform: translateY(-3px);
}

.feature-icon {
    font-size: 1.8rem;
    color: #dc2626;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: #fef2f2;
    border-radius: 14px;
    margin: 0 auto 1rem auto;
    line-height: 1.5 !important;
}

.feature-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 0.4rem;
}

.feature-card p {
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.6;
    margin: 0;
}

/* Start button – desktop default */
.formal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #dc2626;
    color: white;
    border: none;
    padding: 1.1rem 3.5rem;
    border-radius: 14px;
    font-size: 1.15rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15);
    letter-spacing: 0.2px;
    margin: 2rem auto 0 auto;
}

.formal-btn:hover {
    background: #b91c1c;
    box-shadow: 0 6px 16px rgba(185, 28, 28, 0.25);
    transform: translateY(-1px);
}

.formal-btn i {
    font-size: 1.1rem;
}

/* ===== Tooltip ===== */
.info-tooltip {
    position: relative;
    display: inline-block;
    margin-left: 6px;
    cursor: pointer;
    color: #9ca3af;
    font-size: 1rem;
    vertical-align: middle;
    z-index: 50;
}

.tooltip-popup {
    visibility: hidden;
    width: 280px;
    background-color: #1e293b;
    color: #fff;
    text-align: justify;
    border-radius: 12px;
    padding: 14px 18px;
    position: absolute;
    z-index: 2000 !important;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    font-size: 0.85rem;
    line-height: 1.6;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

.tooltip-popup::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px;
    border-style: solid;
}

.info-tooltip.tooltip-top .tooltip-popup {
    bottom: 150%;
    top: auto;
}

.info-tooltip.tooltip-top .tooltip-popup::after {
    top: 100%;
    border-color: #1e293b transparent transparent transparent;
}

.info-tooltip.tooltip-bottom .tooltip-popup {
    top: 150%;
    bottom: auto;
}

.info-tooltip.tooltip-bottom .tooltip-popup::after {
    bottom: 100%;
    border-color: transparent transparent #1e293b transparent;
}

.info-tooltip:hover .tooltip-popup,
.info-tooltip.active .tooltip-popup {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

/* ===== Eligible Categories List ===== */
#eligible-categories-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 1rem 0 0.5rem;
    justify-content: flex-start;
}

#eligible-categories-list li {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 30px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    max-width: 100%;
    word-wrap: break-word;
}

#eligible-categories-list li::before {
    content: "✓";
    font-weight: bold;
    font-size: 0.75rem;
    color: #dc2626;
    background: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.fa-body #eligible-categories-list li {
    flex-direction: row-reverse;
    text-align: right;
}

/* ===== Province Groups ===== */
#provincial-results-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.province-group {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    padding: 1.8rem 2rem;
    transition: box-shadow 0.2s;
}

.province-group:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06);
}

.province-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--border-light);
}

.province-group-header h4 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.province-group-header i {
    color: var(--primary);
    font-size: 1.2rem;
}

.province-group-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.province-group-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
}

.program-name {
    font-weight: 500;
    color: #374151;
    font-size: 0.95rem;
}

.program-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
}

.status-dot.eligible {
    background: #10b981;
}

.status-dot.ineligible {
    background: #ef4444;
}

.status-dot.potential {
    background: #f59e0b;
}

.status-dot.archived {
    background: #6b7280;
}

.program-score {
    font-weight: 700;
    color: var(--primary);
    background: #fef2f2;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
}

.group-consultation {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.consult-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.9rem 2.2rem;
    border-radius: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: 0.2s;
    font-size: 0.95rem;
}

.consult-btn.primary-consult {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.2);
}

.consult-btn.primary-consult:hover {
    background: var(--primary-hover);
}

.consult-btn.secondary-consult {
    background: white;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.consult-btn.secondary-consult:hover {
    background: #f9fafb;
}

/* Province cards with side bar */
.province-card.result-card-strong {
    border-left: 5px solid #16a34a;
}

.province-card.result-card-eligible {
    border-left: 5px solid #2563eb;
}

.province-card.result-card-potential {
    border-left: 5px solid #f59e0b;
}

.province-card.result-card-ineligible {
    border-left: 5px solid #dc2626;
    opacity: 0.75;
}

.province-card.result-card-archived {
    border-left: 5px solid #6b7280;
    opacity: 0.6;
}

.fa-body .province-card {
    border-left: none;
    border-right: 5px solid;
}

.fa-body .result-card-strong {
    border-right-color: #16a34a;
}

.fa-body .result-card-eligible {
    border-right-color: #2563eb;
}

.fa-body .result-card-potential {
    border-right-color: #f59e0b;
}

.fa-body .result-card-ineligible {
    border-right-color: #dc2626;
}

.fa-body .result-card-archived {
    border-right-color: #6b7280;
}

.card-status-icon {
    width: 50px;
    background: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.result-card-strong .card-status-icon {
    color: #16a34a;
}

.result-card-eligible .card-status-icon {
    color: #2563eb;
}

.result-card-potential .card-status-icon {
    color: #f59e0b;
}

.result-card-ineligible .card-status-icon {
    color: #dc2626;
}

.result-card-archived .card-status-icon {
    color: #6b7280;
}

.card-body {
    padding: 1rem 1.2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.card-header h4 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-main);
}

.province-badge {
    font-size: 0.75rem;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 6px;
}

.score-box {
    text-align: right;
    white-space: nowrap;
}

.score-value {
    font-size: 1.6rem;
    font-weight: 800;
    display: block;
}

.score-context {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

.status-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.rec-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.85rem;
    color: #475569;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.rec-list li {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.rec-list li::before {
    content: "•";
    color: var(--primary);
    font-weight: bold;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.mini-btn {
    flex: 1;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.5rem;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-iran {
    background: #2563eb;
    color: white;
}

.btn-iran:hover {
    background: #1d4ed8;
}

.btn-outside {
    background: #334155;
    color: white;
}

.btn-outside:hover {
    background: #1e293b;
}

/* ===== Lead Capture Modal ===== */
.lead-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.3s ease;
}

.lead-modal {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 28px;
    padding: 2.5rem 1.8rem;
    max-width: 460px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
}

.lead-input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 1.5rem;
}

.hc-input {
    font-size: 16px !important;
    padding: 0.9rem !important;
}

.lead-consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.85rem;
    color: #4b5563;
    margin-bottom: 1.5rem;
    text-align: right;
}

.lead-submit-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 700;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin: 0 auto 1rem auto;
    transition: all 0.2s;
}

#lead-skip {
    color: #9ca3af;
    text-decoration: none;
    font-size: 0.9rem;
    display: block;
    margin-top: 0.5rem;
}

/* ===== Utility Classes ===== */
.hidden-section {
    display: none !important;
}

.space-y-4 > * + * {
    margin-top: 1rem;
}

.flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.items-center {
    align-items: center;
}

.text-lg {
    font-size: 1.125rem;
}

.font-black {
    font-weight: 900;
}

.text-2xl {
    font-size: 1.5rem;
}

.text-red-600 {
    color: #dc2626;
}

.mt-8 {
    margin-top: 2rem;
}

.pt-6 {
    padding-top: 1.5rem;
}

.border-t {
    border-top: 1px solid var(--border-color);
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.w-full {
    width: 100%;
}

.bg-slate-200 {
    background-color: #e2e8f0;
}

.rounded-full {
    border-radius: 9999px;
}

.h-2 {
    height: 0.5rem;
}

.bg-gradient-to-r {
    background-image: linear-gradient(to right, #38bdf8, #3b82f6);
}

.text-indigo-600 {
    color: #4f46e5;
}

.text-slate-500 {
    color: #64748b;
}

.list-none {
    list-style-type: none;
}

.space-y-2 > * + * {
    margin-top: 0.5rem;
}

.text-slate-700 {
    color: #334155;
}

.text-right {
    text-align: right;
}

.text-5xl {
    font-size: 3rem;
}

.font-bold {
    font-weight: 700;
}

.text-sm {
    font-size: 0.875rem;
}

.inline-block {
    display: inline-block;
}

.text-xs {
    font-size: 0.75rem;
}

.px-2 {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.py-1 {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.border-b {
    border-bottom: 1px solid #e5e7eb;
}

.pb-4 {
    padding-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.flex-col {
    flex-direction: column;
}

.gap-3 {
    gap: 0.75rem;
}

.bg-green-600 {
    background-color: #16a34a;
}

.text-white {
    color: white;
}

.font-semibold {
    font-weight: 600;
}

.py-2\.5 {
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.rounded-lg {
    border-radius: 0.5rem;
}

.hover\:bg-green-700:hover {
    background-color: #15803d;
}

.transition {
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
}

.duration-300 {
    transition-duration: 300ms;
}

.bg-slate-700 {
    background-color: #334155;
}

.hover\:bg-slate-800:hover {
    background-color: #1e293b;
}

/* Font Awesome direction fix */
.fa-body .fas,
.fa-body .far,
.fa-body .fab {
    direction: ltr;
    display: inline-block;
    font-family: 'Font Awesome 6 Free', 'Font Awesome 6 Brands' !important;
    line-height: 1.5 !important;
}

/* ===== Responsive Overrides ===== */
@media (max-width: 768px) {
    .step-label {
        display: none;
    }
    .hc-card {
        padding: 1.5rem;
    }
    .score-breakdown {
        flex-direction: column;
        gap: 1rem;
    }
    .live-score-container {
        flex-wrap: wrap;
        justify-content: center;
    }
    .live-score-breakdown {
        gap: 0.5rem;
    }
    .result-card .flex-col.sm\:flex-row {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .tooltip-popup {
        width: 240px;
    }
    #eligible-categories-list {
        flex-direction: column;
        align-items: flex-start;
    }
    #eligible-categories-list li {
        width: 100%;
        box-sizing: border-box;
        justify-content: flex-start;
    }
    .lead-modal {
        padding: 1.5rem 1.2rem;
        border-radius: 24px;
        position: relative;
    }
}

/* Mobile sticky button override */
@media (max-width: 640px) {
    .formal-btn {
        position: sticky;
        bottom: 94px;
        width: 100%;
        margin-top: 2rem;
        z-index: 999;
        border-radius: 14px;
    }
}

/* Small utility responsive */
@media (min-width: 640px) {
    .sm\:flex-row {
        flex-direction: row;
    }
    .sm\:mt-0 {
        margin-top: 0;
    }
    .sm\:items-center {
        align-items: center;
    }
}
/* =========================================
   مرحله 0 (صفحه شروع) - استایل‌های اصلی
========================================= */

.home-container {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
    font-family: system-ui, -apple-system, sans-serif;
}

/* تیترها */
.home-container h1 {
    font-size: 2.5rem;
    color: #1e293b; /* رنگ تیره و خوانا */
    margin-bottom: 0.5rem;
    font-weight: 800;
}

.home-container .subtitle {
    font-size: 1.15rem;
    color: #64748b; /* رنگ خاکستری ملایم */
    margin-bottom: 3.5rem;
}

/* 
  تنظیمات گرید برای کنار هم قرار دادن باکس‌ها 
  استفاده از Flexbox برای ریسپانسیو بودن و پشتیبانی از راست‌چین (RTL)
*/
.features-grid.split-row {
    display: flex;
    flex-direction: row; /* قرارگیری در یک ردیف */
    gap: 1.5rem; /* فاصله بین دو باکس */
    justify-content: center;
    margin-bottom: 3.5rem;
}

/* استایل خود باکس‌ها (کارت‌ها) */
.feature-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 2.5rem 1.5rem;
    flex: 1; /* باعث می‌شود عرض هر دو باکس دقیقاً برابر باشد */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

/* افکت هاور (زمانی که موس روی باکس می‌رود) */
.feature-card:hover {
    transform: translateY(-5px); /* کمی بالا می‌آید */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-color: #dc2626; /* حاشیه قرمز رنگ برند شما */
}

/* آیکون داخل باکس‌ها */
.feature-icon {
    font-size: 3rem;
    color: #dc2626; /* قرمز اصلی برند */
    margin-bottom: 1.2rem;
}

.feature-card h3 {
    font-size: 1.25rem;
    color: #0f172a;
    margin: 0 0 0.5rem 0;
    font-weight: 700;
}

.feature-card p {
    color: #64748b;
    margin: 0;
    font-size: 0.95rem;
}

/* استایل دکمه شروع ارزیابی */
.formal-btn {
    background-color: #dc2626; /* قرمز اصلی */
    color: #ffffff;
    border: none;
    border-radius: 9999px; /* گوشه‌های کاملاً گرد */
    padding: 1rem 2.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(220, 38, 38, 0.3); /* سایه همرنگ با دکمه */
}

.formal-btn:hover {
    background-color: #b91c1c; /* قرمز تیره‌تر برای هاور */
    transform: translateY(-2px);
    box-shadow: 0 6px 10px -1px rgba(220, 38, 38, 0.4);
}

/* پشتیبانی از حالت موبایل (اگر صفحه خیلی کوچک شد، زیر هم قرار بگیرند) */
@media (max-width: 600px) {
    .features-grid.split-row {
        flex-direction: column; /* تغییر به حالت ستونی در موبایل */
    }
}

/* چرخش فلش دکمه در نسخه فارسی (RTL) */
.fa-body .formal-btn i.rtl-arrow {
    transform: rotate(180deg);
}
/* متن‌های راهنما (Helper Texts) برای افزایش Scannability و کاهش اضطراب */
.helper-text {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 0.2rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    font-weight: 400;
}

/* استایل جدید و مثبت برای Toggle Button ها */
.toggle-group {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.toggle-label {
    cursor: pointer;
    flex: 1;
}

.toggle-label input {
    display: none;
}

.toggle-btn {
    padding: 0.6rem 1rem;
    background: #f8fafc; /* خاکستری روشن خنثی */
    color: #475569; /* متن خاکستری تیره */
    text-align: center;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.95rem;
}

.toggle-label:hover .toggle-btn {
    background: #f1f5f9;
}

/* رنگ سبز/آبی به جای قرمز برای موارد انتخاب شده */
.toggle-label input:checked + .toggle-btn {
    background: #fef2f2; /* پس‌زمینه قرمز بسیار ملایم */
    color: #dc2626; /* رنگ متن قرمز اصلی */
    border: 2px solid #dc2626; /* حاشیه قرمز رنگ ضخیم‌تر برای دیده شدن بهتر */
    box-shadow: 0 4px 6px -1px rgba(220, 38, 38, 0.15); /* سایه ملایم قرمز */
    /* تنظیم پدینگ برای جلوگیری از تکان خوردن دکمه به دلیل ضخیم شدن حاشیه (1px به 2px) */
    padding: calc(0.6rem - 1px) calc(1rem - 1px);
}

/* پشتیبانی از حالت موبایل برای Toggleها */
@media (max-width: 480px) {
    .toggle-group {
        flex-direction: column;
    }
}
/* =========================================
   مرحله 0 (بدون اسکرول و چیدمان متمرکز)
========================================= */
/* تنظیم کانتینر اصلی برای پر کردن ارتفاع صفحه و وسط‌چین شدن */
#step-0.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 100px); /* محاسبه ارتفاع کل منهای هدر */
}

.home-container.no-scroll-layout {
    width: 100%;
    max-width: 900px;
    padding: 1rem 1.5rem;
    text-align: center;
}

/* فشرده‌سازی تیترها برای جلوگیری از اشغال فضای زیاد */
.home-header h1 {
    font-size: 2.2rem;
    color: #1e293b;
    margin-bottom: 0.25rem;
    font-weight: 800;
}

.home-header .subtitle {
    font-size: 1.05rem;
    color: #64748b;
    margin-bottom: 2.5rem; /* فاصله تا کارت‌ها */
}

/* شبکه کارت‌های افقی */
.info-cards-wrapper {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 کارت کنار هم در دسکتاپ */
    gap: 1.25rem;
    margin-bottom: 2.5rem; /* فاصله تا دکمه شروع */
}

/* ظاهر مدرن و افقی کارت‌ها */
.info-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    text-align: start; /* اتوماتیک در فارسی راست‌چین و در انگلیسی چپ‌چین می‌شود */
    gap: 1rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.info-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    border-color: #dc2626; /* خط دور قرمز رنگ برند */
}

/* آیکون داخل کارت‌ها */
.icon-box {
    background: #fef2f2; /* قرمز بسیار ملایم */
    color: #dc2626; /* قرمز اصلی */
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

/* متن‌های داخل کارت */
.info-text h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1.05rem;
    color: #0f172a;
    font-weight: 700;
}

.info-text p {
    margin: 0;
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.4;
}

/* دکمه اصلی شروع */
.hero-btn {
    margin-top: 0.5rem;
    padding: 1rem 3rem;
    font-size: 1.2rem;
}

/* تنظیمات ریسپانسیو برای موبایل */
@media (max-width: 800px) {
    .info-cards-wrapper {
        grid-template-columns: 1fr; /* در موبایل و تبلت کارت‌ها زیر هم قرار می‌گیرند */
        gap: 0.85rem;
    }
    #step-0.active {
        min-height: auto;
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
    .home-header h1 {
        font-size: 1.8rem;
    }
}
/* =========================================
   مرحله 0 (طراحی ترکیبی: پاراگراف + کارت‌ها)
========================================= */

#step-0.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem; /* پدینگ امن برای جلوگیری از چسبیدن به لبه‌های گوشی */
    box-sizing: border-box;
}

.home-container {
    width: 100%;
    max-width: 800px;
    text-align: center;
    box-sizing: border-box;
    margin: 0 auto;
}

.home-header h1 {
    font-size: 1.8rem; /* سایز متناسب برای موبایل */
    color: #0f172a;
    margin-bottom: 0.5rem;
    font-weight: 800;
    line-height: 1.3;
}

.home-header .subtitle {
    font-size: 1rem;
    color: #64748b;
    margin-bottom: 2rem;
}

/* باکس پاراگراف توضیحات */
.intro-paragraph-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    width: 100%;
    box-sizing: border-box; /* کلید حل مشکل بیرون زدگی */
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.intro-paragraph-box p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #334155;
    text-align: center;
}

/* شبکه کارت‌های افقی/عمودی */
.info-cards-wrapper {
    display: grid;
    grid-template-columns: 1fr; /* در حالت موبایل زیر هم قرار می‌گیرند */
    gap: 0.75rem;
    margin-bottom: 2.5rem;
    width: 100%;
    box-sizing: border-box;
}

.info-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: center;
    text-align: start; /* چپ‌چین/راست‌چین خودکار بر اساس زبان */
    gap: 1rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    box-sizing: border-box;
}

.icon-box {
    background: #fef2f2; /* قرمز بسیار ملایم */
    color: #dc2626; /* قرمز اصلی */
    width: 45px;
    height: 45px;
    min-width: 45px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.info-text h4 {
    margin: 0 0 0.2rem 0;
    font-size: 0.95rem;
    color: #0f172a;
    font-weight: 700;
}

.info-text p {
    margin: 0;
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.3;
}

/* دکمه اصلی شروع */
.formal-btn.hero-btn {
    background-color: #dc2626;
    color: #ffffff;
    border: none;
    border-radius: 24px;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%; /* در موبایل دکمه کل عرض را پر می‌کند */
    max-width: 350px; /* از بزرگ شدن بی‌رویه در کامپیوتر جلوگیری می‌کند */
    box-sizing: border-box;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(220, 38, 38, 0.2);
}

.time-to-complete {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: #64748b;
}

/* =========================================
   تنظیمات ریسپانسیو (تبلت و کامپیوتر)
========================================= */
@media (min-width: 768px) {
    .home-header h1 {
        font-size: 2.2rem;
    }
    
    .home-header .subtitle {
        font-size: 1.1rem;
    }

    .intro-paragraph-box {
        padding: 1.5rem 2rem;
    }
    
    .intro-paragraph-box p {
        font-size: 1.05rem;
    }

    /* در نمایشگرهای بزرگ، 3 کارت در یک ردیف قرار می‌گیرند */
    .info-cards-wrapper {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }
}

.ai-content-text {
    white-space: pre-line;
    margin-bottom: 2rem;
    display: block;
}

#ai-result-box a.formal-btn {
    white-space: normal !important; /* خنثی کردن اثر اینترهای احتمالی */
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}


#ai-result-box table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    border: 1px solid #ddd;
}
#ai-result-box th, #ai-result-box td {
    padding: 10px;
    border: 1px solid #ddd;
    text-align: center;
}
#ai-result-box th {
    background-color: #f8fafc;
}