:root {
    --primary: #dc2626;
    --primary-hover: #b91c1c;
    --primary-light: #fef2f2;
    --bg-gray: #f9fafb;
    --card-bg: #ffffff;
    --text-main: #111827;
    --text-muted: #64748b;
    --border-light: #f3f4f6;
    --border-color: #e2e8f0;
    --radius-md: 16px;
    --radius: 24px;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --transition: all 0.2s ease;
}

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-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: var(--transition);
    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: 60px;
}

.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 & Step 0 (Home) ===== */
.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); }
}

/* Home Page: centralized and compact */
#step-0.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 75vh;
    padding: 2rem 1rem;
    background: #ffffff;         /* پس‌زمینه سفید مطابق نمونه */
    border-radius: 32px;
}

.home-container {
    width: 100%;
    max-width: 800px;
    text-align: center;
}

.home-header h1 {
    font-size: 2.2rem;
    color: #0f172a;
    margin-bottom: 0.5rem;
    font-weight: 800;
}

.home-header .subtitle {
    font-size: 1.1rem;
    color: #64748b;
    margin-bottom: 2rem;
}

.intro-paragraph-box {
    background: var(--primary-light);
    border: 1px solid #fecaca;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 2rem;
    color: #334155;
    font-size: 0.95rem;
    line-height: 1.6;
}

.info-cards-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.info-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    text-align: start;
    transition: var(--transition);
}

.info-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.icon-box {
    background: var(--primary-light);
    color: var(--primary);
    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: var(--text-muted);
}

.hero-btn {
    background-color: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: 24px;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: var(--transition);
    box-shadow: 0 4px 6px -1px rgba(220, 38, 38, 0.2);
}

.hero-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

.time-to-complete {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===== Cards & Forms ===== */
.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.6rem;
    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 {
    margin-bottom: 0.5rem;
    text-align: start;
    display: flex;
    flex-direction: column;
}

.form-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: #374151;
    font-size: 1rem;
}

.helper-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0 0 0.8rem 0;
    line-height: 1.5;
}

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: var(--transition);
    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;
}

/* ===== Custom Toggles ===== */
.toggle-group {
    display: flex;
    gap: 1rem;
}

.toggle-label {
    flex: 1;
    cursor: pointer;
}

.toggle-label input {
    display: none;
}

.toggle-btn {
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    background: var(--bg-gray);
    color: var(--text-muted);
    font-weight: 700;
    text-align: center;
    transition: var(--transition);
}

.toggle-label input:checked + .toggle-btn {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

@media (max-width: 768px) {
    .toggle-group {
        flex-direction: column;
    }
    .hc-card {
        padding: 1.5rem;
    }
    .step-label {
        display: none;
    }
}

/* ===== Navigation 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: var(--transition);
}

.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: var(--transition);
}

.btn-next:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* ===== 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;
}

/* ===== 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;
}

.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: var(--transition);
    box-shadow: 0 10px 20px rgba(220, 38, 38, 0.2);
}

.ai-btn-large:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* ===== RTL Adjustments (Essential) ===== */
.fa-body .rtl-arrow {
    transform: rotate(180deg);
}

.fa-body .btn-back i,
.fa-body .btn-next i {
    margin-left: 0;
    margin-right: 8px;
}

/* ===== Fix for Font Awesome icons in RTL (solves missing arrow issue) ===== */
.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;
}

/* ===== 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%;
    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;
}

.lead-consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.85rem;
    color: #4b5563;
    margin-bottom: 1.5rem;
    text-align: start;
}

.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;
    transition: var(--transition);
}

/* ===== Utility Classes ===== */
.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-medium { font-weight: 500; }
.font-bold { font-weight: 700; }
.text-indigo-600 { color: #4f46e5; }
.text-red-600 { color: #dc2626; }
.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); }
.border-t { border-top: 1px solid var(--border-color); }
.mt-4 { margin-top: 1rem; }
.pt-4 { padding-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }