/* =============================================
   PEQ Wizard – Master Template CSS
   شامل تمام استایل‌های اصلی، مودال و اختصاصی PEQ
============================================= */

/* ---------- Local Fonts ---------- */
@font-face {
    font-family: 'IRANYekanX';
    src: url('/assets/fonts/IRANYekanX-Regular.woff2') format('woff2'),
         url('/assets/fonts/IRANYekanX-Regular.woff') format('woff');
    font-weight: normal; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'IRANYekanX';
    src: url('/assets/fonts/IRANYekanX-Bold.woff2') format('woff2'),
         url('/assets/fonts/IRANYekanX-Bold.woff') format('woff');
    font-weight: bold; font-style: normal; font-display: swap;
}

/* ---------- CSS Custom Properties ---------- */
: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;
}

/* ---------- Base ---------- */
body {
    background-color: var(--bg-gray);
    color: var(--text-main);
    font-family: 'Inter', 'Noto Sans', 'Vazirmatn', sans-serif;
    margin: 0; padding: 0; line-height: 1.6;
}
.fa-body {
    direction: rtl;
    font-family: 'IRANYekanX', 'Vazirmatn', 'Tahoma', sans-serif !important;
}

/* ---------- 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-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 Content ---------- */
.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, .step-section[style*="display: block"] { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Home Step ---------- */
#step-0 { display: none; }
#step-0.active, #step-0[style*="display: flex"] {
    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); }

/* ---------- Stream Selection Cards ---------- */
.stream-selection { margin: 2rem 0; text-align: center; }
.stream-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.2rem; margin-top: 1rem; }
.stream-card { background: white; border: 2px solid var(--border-color); border-radius: var(--radius-md); padding: 1.5rem; cursor: pointer; transition: var(--transition); }
.stream-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stream-card h4 { margin: 0 0 0.5rem; font-size: 1.1rem; color: var(--primary); }
.stream-card p { margin: 0; font-size: 0.85rem; color: var(--text-muted); }

/* ---------- Standard Card ---------- */
.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; }

/* ---------- 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); }
.btn-next:disabled, .btn-next.disabled { opacity: 0.5; pointer-events: none; }

/* ---------- OWP Custom Elements (shared) ---------- */
.yn-wrap { margin-bottom: 1.5rem; }
.yn-label { font-weight: 700; margin-bottom: 0.5rem; color: #374151; }
.yn-hint { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.yn-row, .select-grid { display: flex; gap: 1rem; flex-wrap: wrap; }
.choice-btn {
    flex: 1 1 calc(50% - 0.5rem); min-width: 120px; padding: 1rem; border-radius: 16px;
    border: 2px solid var(--border-color); background: var(--bg-gray); color: var(--text-muted);
    font-weight: 700; text-align: center; cursor: pointer; transition: var(--transition);
    display: flex; align-items: center; justify-content: center; gap: 8px; font-family: inherit;
}
.choice-btn.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.check-icon { font-weight: bold; }
.warning-box { background: #fef3c7; border: 1px solid #fcd34d; color: #92400e; padding: 0.75rem 1rem; border-radius: 12px; font-size: 0.9rem; margin-top: 1rem; }
.field-group { margin-bottom: 1.5rem; }
.field-label { font-weight: 700; margin-bottom: 0.5rem; color: #374151; }
.optional-tag { font-size: 0.75rem; color: #6b7280; background: #f3f4f6; padding: 2px 8px; border-radius: 20px; font-weight: normal; }

/* FontAwesome 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; }

/* ---------- Datepicker (not used, kept for compatibility) ---------- */
.dp-wrap { position: relative; width: 100%; }
.dp-trigger {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    padding: 0.85rem 1rem; background: white; border: 1px solid var(--border-color);
    border-radius: 12px; font-family: inherit; font-size: 0.95rem; color: var(--text-main);
    cursor: pointer; transition: var(--transition); gap: 0.5rem;
}
.dp-trigger:hover { border-color: var(--primary); }
.dp-icon { font-size: 1.2rem; }
.dp-chevron { margin-inline-start: auto; font-size: 0.8rem; color: var(--text-muted); }
.dp-popup {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: white;
    border: 1px solid #e2e8f0; border-radius: 16px; box-shadow: 0 12px 28px rgba(0,0,0,0.12);
    z-index: 100; padding: 1rem; min-width: 280px;
}
.dp-mode-tabs { display: flex; margin-bottom: 0.75rem; border-radius: 8px; overflow: hidden; border: 1px solid var(--border-color); }
.dp-mode-tabs button {
    flex: 1; padding: 0.45rem; background: #f8fafc; border: none; cursor: pointer;
    font-family: inherit; font-size: 0.85rem; font-weight: 500; color: var(--text-muted); transition: var(--transition);
}
.dp-mode-tabs button.active { background: var(--primary); color: white; }
.dp-nav { display: flex; justify-content: space-between; align-items: center; margin: 0.5rem 0 0.75rem; }
.dp-arrow { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text-main); padding: 0 0.5rem; }
.dp-month-year { display: flex; align-items: center; gap: 0.5rem; }
.dp-month-title { font-weight: 700; font-size: 1rem; min-width: 70px; text-align: center; }
.dp-year-select { padding: 0.25rem 0.5rem; border-radius: 6px; border: 1px solid var(--border-color); font-family: inherit; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; gap: 6px; }
.dp-wh { font-weight: 600; font-size: 0.75rem; color: var(--text-muted); padding: 0.25rem 0; }
.dp-day {
    border: none; background: none; aspect-ratio: 1 / 1; cursor: pointer; border-radius: 8px;
    font-family: inherit; font-size: 0.9rem; transition: 0.15s; display: flex; align-items: center; justify-content: center;
}
.dp-day:hover:not(.disabled):not(.selected) { background: #f1f5f9; }
.dp-day.selected { background: var(--primary); color: white; font-weight: 700; }
.dp-day.disabled { opacity: 0.3; pointer-events: none; }
.fa-body .dp-popup { left: auto; right: 0; }
.fa-body .dp-chevron { margin-inline-start: 0; margin-inline-end: auto; }

/* ---------- Results & Score ---------- */
.score-hero { background: #111827; color: white; padding: 2rem; border-radius: var(--radius); text-align: center; margin-bottom: 2rem; }
.score-number { font-size: 2.5rem; font-weight: 800; line-height: 1.2; margin: 1rem 0; color: white; }

/* Rules List (not used, but kept) */
.rules-list { margin-top: 1rem; }
.rule-item { border-radius: 12px; padding: 0.5rem; margin-bottom: 0.5rem; }
.rule-item summary { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.rule-icon { font-size: 1.2rem; }
.rule-status { margin-left: auto; font-weight: bold; }
.rule-status.p { color: #065f46; } .rule-status.f { color: #991b1b; }
.rule-body { margin-top: 0.5rem; padding-left: 1.5rem; font-size: 0.9rem; }
.rule-row { display: flex; margin-bottom: 0.25rem; }
.rule-key { font-weight: bold; width: 120px; }

/* Recommendations */
.rec-card {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-left: 4px solid #f59e0b;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    line-height: 1.6;
}
.fa-body .rec-card {
    border-left: none;
    border-right: 4px solid #f59e0b;
}

/* AI Card */
.ai-card { background: linear-gradient(145deg, #ffffff, #fef2f2); border: 2px solid #fecaca; padding: 2rem; border-radius: var(--radius); margin-top: 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); }

/* ---------- Criteria Table ---------- */
.criteria-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-top: 1rem;
}
.criteria-table th {
    background: #f1f5f9;
    padding: 0.75rem;
    text-align: left;
    font-weight: 700;
    color: #475569;
}
.criteria-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.75rem;
}
.status-badge.pass { background: #d1fae5; color: #065f46; }
.status-badge.fail { background: #fee2e2; color: #991b1b; }

/* ---------- Booking Button ---------- */
.booking-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary);
    color: white;
    padding: 0.8rem 1.8rem;
    border-radius: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: var(--transition);
    margin-top: 1rem;
}
.booking-btn:hover { background: var(--primary-hover); }

/* ---------- Modal (Lead Capture) ---------- */
.lead-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); 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.9); 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-modal-header {
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    margin-bottom: 1rem; font-size: 1.3rem; font-weight: 800; color: #991b1b;
}
.lead-modal-header i { font-size: 1.5rem; }
.lead-modal p { margin: 0 0 1.2rem; color: #4b5563; font-size: 0.9rem; }
.lead-score-preview {
    background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 12px;
    padding: 0.7rem; margin-bottom: 1.2rem; font-weight: 600; color: #166534; display: block;
}
.lead-input-group { display: flex; flex-direction: column; gap: 12px; margin-bottom: 1.5rem; }
.lead-input-group input {
    background: white; border: 1px solid var(--border-color); border-radius: 12px;
    padding: 0.85rem 1rem; font-family: inherit; font-size: 0.95rem;
}
.lead-input-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(220,38,38,0.1); }
.lead-consent {
    display: flex; align-items: flex-start; gap: 10px; font-size: 0.85rem; color: #4b5563;
    margin-bottom: 1.5rem; text-align: start; cursor: pointer;
}
.lead-consent input[type="checkbox"] { margin-top: 4px; accent-color: var(--primary); }
.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); box-shadow: 0 4px 12px rgba(220,38,38,0.3);
}
.lead-submit-btn:hover { background: var(--primary-hover); transform: translateY(-1px); }

#lead-form-error {
    color: #dc2626; background: #fef2f2; border: 1px solid #fecaca;
    border-radius: 10px; padding: 0.6rem 1rem; margin: 0.8rem 0; font-size: 0.85rem;
}

/* ---------- Utility ---------- */
.space-y-4 > * + * { margin-top: 1rem; }
.hidden { display: none !important; }

/* ---------- RTL fixes ---------- */
.fa-body .rtl-arrow { transform: rotate(180deg); }
.fa-body .btn-back i, .fa-body .btn-next i { margin-left: 0; margin-right: 8px; }

/* Responsive */
@media (max-width: 768px) {
    .hc-card { padding: 1.5rem; }
    .yn-row, .select-grid { flex-direction: column; }
    .step-label { display: none; }
    .stream-cards { grid-template-columns: 1fr; }
}
/* Ensure home step is vertically and horizontally centered */
#step-home.active, #step-home[style*="display: flex"] {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 75vh;
    padding: 2rem 1rem;
    background: #ffffff;
    border-radius: 32px;
}

/* Improved warning/reasons list */
.warning-card .reason-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0 0;
}
.warning-card .reason-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #fff5f5;
    border: 1px solid #fecaca;
    border-radius: 10px;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    color: #991b1b;
}
.warning-card .reason-list li i {
    color: #ef4444;
    margin-top: 0.15rem;
}

/* Criteria table RTL fixes */
.fa-body .criteria-table th,
.fa-body .criteria-table td {
    text-align: right;
}
.fa-body .criteria-table .status-badge {
    margin-right: auto;
}