/* ============================================================
   NexaROI Smart Assessment v4 — Frontend CSS (RTL Arabic)
   Includes: spider chart container, structured report tabs,
   section analysis cards, action plan table, strengths/weaknesses
   ============================================================ */

/* ── CSS Variables ──────────────────────────────────────── */
.nsa-assessment-wrap {
    --nsa-primary: #1e40af;
    --nsa-accent:  #3b82f6;
    --nsa-success: #16a34a;
    --nsa-gray:    #6b7280;
    --nsa-border:  #e5e7eb;
    --nsa-radius:  10px;
    --nsa-shadow:  0 4px 20px rgba(0,0,0,.08);
    --nsa-font:    'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
    /* Force text colors regardless of theme */
    --nsa-text-dark:   #111827;
    --nsa-text-body:   #374151;
    --nsa-text-muted:  #6b7280;
}

/* v4: Override any theme text/color inheritance inside the plugin wrapper */
.nsa-assessment-wrap,
.nsa-assessment-wrap *,
.nsa-assessment-wrap *::before,
.nsa-assessment-wrap *::after {
    box-sizing: border-box;
}
.nsa-assessment-wrap {
    direction: rtl; font-family: var(--nsa-font);
    max-width: 820px; margin: 0 auto; padding: 0;
    color: var(--nsa-text-dark);
    /* Reset line-height and font-size in case theme overrides them */
    font-size: 16px;
    line-height: 1.5;
}

/* ── Progress bar ───────────────────────────────────────── */
.nsa-progress-bar { height: 5px; background: var(--nsa-border); border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
.nsa-progress-fill { height: 100%; background: linear-gradient(90deg, var(--nsa-primary), var(--nsa-accent)); border-radius: 3px; transition: width .4s ease; }
.nsa-step-counter { text-align: left; font-size: .75rem; color: var(--nsa-gray); margin-bottom: 24px; direction: ltr; }

/* ── Steps ──────────────────────────────────────────────── */
.nsa-step { display: none; }
.nsa-step.active { display: block; animation: nsaFadeIn .25s ease; }
@keyframes nsaFadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ── Logo ───────────────────────────────────────────────── */
.nsa-logo { text-align: center; margin-bottom: 20px; }
.nsa-logo img { max-height: 60px; max-width: 180px; object-fit: contain; }

/* ── Intro ──────────────────────────────────────────────── */
#nsa-step-intro { text-align: center; padding: 40px 24px; background: #fff; border-radius: var(--nsa-radius); border: 1px solid var(--nsa-border); box-shadow: var(--nsa-shadow); }
.nsa-assessment-title { font-size: 1.7rem; font-weight: 700; color: var(--nsa-primary); margin: 0 0 12px; line-height: 1.4; }
.nsa-assessment-desc { font-size: .97rem; color: var(--nsa-text-body); line-height: 1.7; max-width: 580px; margin: 0 auto 20px; }
.nsa-intro-meta { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-bottom: 28px; font-size: .88rem; color: var(--nsa-gray); }
.nsa-intro-meta span { background: #f3f4f6; padding: 5px 14px; border-radius: 20px; }

/* ── Buttons ────────────────────────────────────────────── */
.nsa-btn { display: inline-block; padding: 11px 28px; border-radius: 8px; font-size: .97rem; font-weight: 600; cursor: pointer; border: 2px solid transparent; transition: all .18s; font-family: var(--nsa-font); text-decoration: none; }
.nsa-btn-primary { background: var(--nsa-primary); color: #fff; border-color: var(--nsa-primary); }
.nsa-btn-primary:hover { background: var(--nsa-accent); border-color: var(--nsa-accent); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(59,130,246,.3); }
.nsa-btn-outline { background: transparent; color: var(--nsa-primary); border-color: var(--nsa-border); }
.nsa-btn-outline:hover { border-color: var(--nsa-primary); background: #eff6ff; }
.nsa-nav-btns { display: flex; justify-content: space-between; align-items: center; margin-top: 28px; gap: 12px; }

/* ── Lead step ──────────────────────────────────────────── */
#nsa-step-lead { background: #fff; border-radius: var(--nsa-radius); border: 1px solid var(--nsa-border); padding: 32px 28px; box-shadow: var(--nsa-shadow); }
.nsa-step-title { font-size: 1.25rem; font-weight: 700; color: var(--nsa-primary); margin: 0 0 4px; }
.nsa-step-sub { font-size: .85rem; color: var(--nsa-gray); margin: 0 0 24px; }
.nsa-lead-form { display: grid; gap: 16px; }
.nsa-field label { display: block; font-size: .88rem; font-weight: 600; color: #374151; margin-bottom: 6px; }
.nsa-field input { width: 100%; padding: 10px 14px; border: 1.5px solid var(--nsa-border); border-radius: 7px; font-size: .95rem; font-family: var(--nsa-font); transition: border-color .15s; box-sizing: border-box; direction: rtl; }
.nsa-field input:focus { outline: none; border-color: var(--nsa-accent); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.nsa-field input::placeholder { color: #9ca3af; }

/* ── Section step ───────────────────────────────────────── */
.nsa-section-step { background: #fff; border-radius: var(--nsa-radius); border: 1px solid var(--nsa-border); padding: 28px; box-shadow: var(--nsa-shadow); }
.nsa-section-step-title { font-size: 1.15rem; font-weight: 700; color: var(--nsa-primary); margin: 0 0 4px; padding-bottom: 12px; border-bottom: 2px solid var(--nsa-border); margin-bottom: 20px; }
.nsa-section-step-desc { font-size: .88rem; color: var(--nsa-gray); margin: -12px 0 16px; }

/* ── Questions ──────────────────────────────────────────── */
.nsa-question-wrap { margin-bottom: 24px; padding-bottom: 22px; border-bottom: 1px solid #f3f4f6; }
.nsa-question-wrap:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.nsa-question-text { font-size: .97rem; font-weight: 600; color: var(--nsa-text-dark); margin: 0 0 12px; line-height: 1.55; }
.nsa-question-text .req { color: #ef4444; margin-right: 3px; }
.nsa-options-list { display: grid; gap: 9px; }
.nsa-option-label { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1.5px solid var(--nsa-border); border-radius: 8px; cursor: pointer; transition: all .15s; font-size: .93rem; color: var(--nsa-text-body); background: #fafafa; }
.nsa-option-label:hover { border-color: var(--nsa-accent); background: #eff6ff; color: var(--nsa-primary); }
.nsa-option-label input { margin: 0; cursor: pointer; }
.nsa-option-label.selected { border-color: var(--nsa-primary); background: #eff6ff; color: var(--nsa-primary); font-weight: 600; }
.nsa-rating-wrap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.nsa-rating-btn { width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--nsa-border); background: #fff; font-size: 1rem; font-weight: 700; cursor: pointer; transition: all .15s; color: #6b7280; }
.nsa-rating-btn:hover, .nsa-rating-btn.active { background: var(--nsa-primary); border-color: var(--nsa-primary); color: #fff; transform: scale(1.1); }
.nsa-rating-labels { display: flex; justify-content: space-between; font-size: .75rem; color: var(--nsa-gray); margin-top: 6px; width: 100%; }
input[type="hidden"].q-val { display: none; }
.nsa-slider-wrap { padding: 4px 0; }
.nsa-slider-wrap input[type="range"] { width: 100%; height: 6px; cursor: pointer; accent-color: var(--nsa-primary); direction: ltr; }
.nsa-slider-val { text-align: center; font-size: 1.3rem; font-weight: 700; color: var(--nsa-primary); margin-top: 8px; }
.nsa-text-input, .nsa-num-input { width: 100%; padding: 10px 14px; border: 1.5px solid var(--nsa-border); border-radius: 7px; font-size: .95rem; font-family: var(--nsa-font); direction: rtl; box-sizing: border-box; transition: border-color .15s; }
.nsa-text-input:focus, .nsa-num-input:focus { outline: none; border-color: var(--nsa-accent); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.nsa-dropdown-sel { width: 100%; padding: 10px 14px; border: 1.5px solid var(--nsa-border); border-radius: 7px; font-size: .95rem; font-family: var(--nsa-font); direction: rtl; background: #fff; box-sizing: border-box; }
.nsa-dropdown-sel:focus { outline: none; border-color: var(--nsa-accent); }
.nsa-field-error { color: #ef4444; font-size: .8rem; margin-top: 5px; display: none; }
.nsa-field-error.visible { display: block; }
.nsa-question-wrap.has-error .nsa-option-label { border-color: #fca5a5; }
/* v21: skipped-question section banner */
.nsa-section-skip-banner { display: none; background: #fef2f2; border: 1.5px solid #fca5a5; color: #991b1b; border-radius: 8px; padding: 10px 16px; font-size: .9rem; font-weight: 600; margin-bottom: 16px; }
.nsa-section-skip-banner.visible { display: block; }

/* ── Loading ────────────────────────────────────────────── */
.nsa-loading-wrap { text-align: center; padding: 60px 24px; }
.nsa-spinner { width: 50px; height: 50px; border: 4px solid var(--nsa-border); border-top-color: var(--nsa-primary); border-radius: 50%; margin: 0 auto 20px; animation: nsaSpin .8s linear infinite; }
@keyframes nsaSpin { to { transform: rotate(360deg); } }
.nsa-loading-wrap h3 { font-size: 1.1rem; margin: 0 0 8px; color: #1f2937; }
.nsa-loading-sub { font-size: .88rem; color: var(--nsa-gray); }

/* ── Results wrap ───────────────────────────────────────── */
#nsa-step-results { background: #fff; border-radius: var(--nsa-radius); border: 1px solid var(--nsa-border); padding: 36px 28px; box-shadow: var(--nsa-shadow); }
.nsa-results-title { font-size: 1.3rem; font-weight: 700; color: var(--nsa-primary); text-align: center; margin: 0 0 28px; }

/* ── v4: Hero score card ─────────────────────────────────── */
.nsa-hero-score {
    display: flex; align-items: center; gap: 28px;
    background: #fff; border: 1px solid var(--nsa-border);
    border-radius: var(--nsa-radius); padding: 24px 28px; margin-bottom: 28px;
    box-shadow: var(--nsa-shadow);
}
.nsa-gauge-wrap { text-align: center; min-width: 200px; }
.nsa-gauge-svg { max-width: 200px; margin: 0 auto; display: block; }
.nsa-gauge-arc { transition: stroke-dashoffset 1.2s cubic-bezier(.4,0,.2,1); }
.nsa-score-pct { font-size: 2.8rem; font-weight: 800; line-height: 1; margin-top: 2px; }
.nsa-score-label { font-size: .88rem; font-weight: 600; color: var(--nsa-gray); margin-top: 3px; }
.nsa-hero-meta { flex: 1; }
.nsa-range-badge { display: inline-block; padding: 6px 18px; border-radius: 24px; color: #fff !important; font-size: .95rem; font-weight: 700; margin-bottom: 10px; }
.nsa-range-desc { font-size: .9rem; color: var(--nsa-text-body); line-height: 1.65; margin: 0; }

/* ── v4: Mini section gauges ────────────────────────────── */
.nsa-mini-gauges-title {
    font-size: .95rem; font-weight: 700; color: var(--nsa-text-dark);
    padding-bottom: 8px; border-bottom: 2px solid var(--nsa-border); margin-bottom: 16px;
}
.nsa-mini-gauges {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px; margin-bottom: 24px;
}
.nsa-mini-gauge-card {
    background: #fff; border: 1px solid var(--nsa-border);
    border-radius: var(--nsa-radius); padding: 12px 8px 10px; text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.nsa-mini-gauge-svg { width: 100%; max-width: 80px; margin: 0 auto; display: block; }
.nsa-mini-pct { font-size: 1.3rem; font-weight: 800; line-height: 1; margin-top: 2px; }
.nsa-mini-title { font-size: .76rem; font-weight: 600; color: var(--nsa-text-body); margin-top: 5px; line-height: 1.35; }

/* ── v4: Horizontal bar chart ───────────────────────────── */
.nsa-bar-chart-wrap {
    background: #fff; border: 1px solid var(--nsa-border);
    border-radius: var(--nsa-radius); padding: 18px 20px; margin-bottom: 28px;
    box-shadow: var(--nsa-shadow);
}
.nsa-bar-chart-wrap canvas { display: block; width: 100% !important; min-height: 160px; }

/* ── Radar chart (no title) ─────────────────────────────── */
.nsa-radar-wrap {
    background: #f8fafc; border: 1px solid var(--nsa-border);
    border-radius: var(--nsa-radius); padding: 20px 16px; margin-bottom: 28px; text-align: center;
}
/* v19: نفس النمط الفعّال المستخدم في الرسم الشريطي أعلاه — width:100% بدون
   !important لا يتغلب على style.width الذي يضبطه Chart.js عبر JS (نفس
   التخصيصية، وأسبقية الـ inline تفوز). إضافة !important + maintainAspectRatio:false
   (في drawRadarChart) يجعل عرض اللوحة يتبع عرض الحاوية فعلياً على الهواتف. */
#nsa-radar-chart { display: block; width: 100% !important; max-width: 420px; min-height: 300px; margin: 0 auto; }

/* Keep legacy bar classes for backwards compat */
.nsa-score-summary-row { display: grid; grid-template-columns: 1fr 1.4fr; gap: 28px; align-items: start; margin-bottom: 28px; }
.nsa-sections-bars-wrap { padding-top: 8px; }
.nsa-sections-title { font-size: .95rem; font-weight: 700; color: var(--nsa-text-dark); margin-bottom: 14px; padding-bottom: 8px; border-bottom: 2px solid var(--nsa-border); }
.nsa-section-bar-row { margin-bottom: 12px; }
.nsa-section-bar-label { display: flex; justify-content: space-between; font-size: .87rem; color: var(--nsa-text-body); margin-bottom: 4px; font-weight: 500; }
.nsa-section-bar-track { height: 10px; background: #f3f4f6; border-radius: 5px; overflow: hidden; }
.nsa-section-bar-fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--nsa-primary), var(--nsa-accent)); transition: width .8s cubic-bezier(.4,0,.2,1); width: 0; }

/* ── v14: Section/Axis (محاور) breakdown — nested axis detail per section ── */
.nsa-axis-breakdown-wrap {
    background: #fff; border: 1px solid var(--nsa-border);
    border-radius: var(--nsa-radius); padding: 18px 20px; margin-bottom: 28px;
    box-shadow: var(--nsa-shadow);
}
.nsa-section-breakdown-card { padding: 14px 0; border-bottom: 1px solid var(--nsa-border); }
.nsa-section-breakdown-card:first-child { padding-top: 0; }
.nsa-section-breakdown-card:last-child { border-bottom: none; padding-bottom: 0; }
.nsa-section-breakdown-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.nsa-section-breakdown-title { font-size: .92rem; font-weight: 700; color: var(--nsa-text-dark); }
.nsa-section-breakdown-pct { color: #fff; font-size: .8rem; font-weight: 700; padding: 2px 10px; border-radius: 12px; white-space: nowrap; }
.nsa-section-breakdown-bar-track { height: 8px; background: #f3f4f6; border-radius: 4px; overflow: hidden; }
.nsa-section-breakdown-bar-fill { height: 100%; border-radius: 4px; transition: width .8s cubic-bezier(.4,0,.2,1); }

.nsa-axis-list { margin: 12px 0 0; padding-right: 20px; border-right: 2px solid var(--nsa-border); display: flex; flex-direction: column; gap: 10px; }
.nsa-axis-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 4px; }
.nsa-axis-name { font-size: .85rem; font-weight: 600; color: var(--nsa-text-body); }
.nsa-axis-meta { font-size: .78rem; color: var(--nsa-gray); font-weight: 600; white-space: nowrap; }
.nsa-axis-bar-track { height: 6px; background: #f3f4f6; border-radius: 3px; overflow: hidden; }
.nsa-axis-bar-fill { height: 100%; border-radius: 3px; transition: width .8s cubic-bezier(.4,0,.2,1); }

/* ── Structured report container (consulting-firm letterhead style) ── */
.nsa-report-container {
    margin-top: 24px;
    border-radius: var(--nsa-radius);
    box-shadow: var(--nsa-shadow);
    overflow: hidden;
}

/* Letterhead header */
.nsa-report-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    background: linear-gradient(135deg, var(--nsa-primary), var(--nsa-accent));
    color: #fff;
    padding: 18px 22px;
}
.nsa-report-header-title { font-size: 1.05rem; font-weight: 800; line-height: 1.4; }
.nsa-report-header-sub   { font-size: .8rem; opacity: .92; margin-top: 4px; line-height: 1.5; }
.nsa-report-header-date  { font-size: .8rem; opacity: .9; white-space: nowrap; font-weight: 600; padding-top: 2px; }

/* Report body wrapper */
.nsa-report-body {
    background: #fff;
    border: 1px solid var(--nsa-border);
    border-top: none;
    padding: 22px;
}

/* Report footer disclaimer */
.nsa-report-footer {
    background: #f8fafc;
    border-top: 1px solid var(--nsa-border);
    padding: 12px 22px;
    text-align: center;
    font-size: .78rem;
    color: var(--nsa-gray);
    line-height: 1.6;
}

/* Report tabs */
.nsa-report-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--nsa-border); margin-bottom: 20px; }
.nsa-report-tab { padding: 8px 18px; background: #f8fafc; border: 1px solid var(--nsa-border); border-bottom: none; border-radius: 6px 6px 0 0; cursor: pointer; font-size: .9rem; font-weight: 600; color: #64748b; font-family: var(--nsa-font); transition: all .15s; }
.nsa-report-tab:hover { background: #e0f2fe; color: #0369a1; }
.nsa-report-tab.active { background: #fff; color: var(--nsa-primary); border-color: #bfdbfe; margin-bottom: -2px; }

/* Report panels */
.nsa-report-panel { display: none; }
.nsa-report-panel.active { display: block; animation: nsaFadeIn .2s ease; }

/* Report blocks */
.nsa-report-block { background: #f8fafc; border: 1px solid var(--nsa-border); border-radius: var(--nsa-radius); padding: 16px 18px; margin-bottom: 16px; }
.nsa-report-block h4 { font-size: .95rem; font-weight: 700; color: var(--nsa-primary); margin: 0 0 10px; }
.nsa-report-block p { font-size: .9rem; color: #374151; line-height: 1.7; margin: 0; }
.nsa-exec-summary { background: linear-gradient(135deg, #eff6ff, #f0fdf4); border-color: #bfdbfe; }
.nsa-overall-level { font-size: 1.1rem; font-weight: 700; color: var(--nsa-primary); margin-bottom: 8px !important; }

/* Strengths & Weaknesses grid */
.nsa-sw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.nsa-sw-card { border-radius: var(--nsa-radius); padding: 16px; }
.nsa-strengths { background: #f0fdf4; border: 1px solid #86efac; }
.nsa-weaknesses { background: #fff7ed; border: 1px solid #fdba74; }
.nsa-sw-card h4 { font-size: .9rem; font-weight: 700; margin: 0 0 10px; }
.nsa-strengths h4 { color: #15803d; }
.nsa-weaknesses h4 { color: #c2410c; }
.nsa-sw-card ul { margin: 0; padding-right: 18px; }
.nsa-sw-card li { font-size: .87rem; color: #374151; line-height: 1.6; margin-bottom: 4px; }

/* Recommendations list */
.nsa-recommendations-list { margin: 0; padding-right: 20px; }
.nsa-recommendations-list li { font-size: .9rem; color: #374151; line-height: 1.7; margin-bottom: 6px; }

/* Benchmark note */
.nsa-benchmark-box { display: flex; gap: 14px; background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--nsa-radius); padding: 14px 16px; margin-bottom: 16px; }
.nsa-benchmark-box strong { display: block; color: #92400e; margin-bottom: 4px; font-size: .9rem; }
.nsa-benchmark-box p { font-size: .87rem; color: #78350f; line-height: 1.65; margin: 0; }

/* Section analysis cards */
.nsa-section-analysis-card { background: #fff; border: 1px solid var(--nsa-border); border-radius: var(--nsa-radius); padding: 16px 18px; margin-bottom: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.04); }
.nsa-sa-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.nsa-sa-title { font-weight: 700; color: #1f2937; font-size: .95rem; }
.nsa-sa-score { color: #fff; font-size: .82rem; font-weight: 700; padding: 3px 10px; border-radius: 14px; }
.nsa-sa-bar-track { height: 7px; background: #f3f4f6; border-radius: 4px; overflow: hidden; margin-bottom: 12px; }
.nsa-sa-bar-fill { height: 100%; border-radius: 4px; transition: width .8s cubic-bezier(.4,0,.2,1); }
.nsa-sa-level { font-size: .84rem; color: var(--nsa-gray); margin: 0 0 8px; }
.nsa-sa-analysis { font-size: .88rem; color: #374151; line-height: 1.7; margin: 0 0 10px; }
.nsa-sa-gaps, .nsa-sa-recs { margin-top: 10px; }
.nsa-sa-gaps strong, .nsa-sa-recs strong { font-size: .84rem; color: #374151; }
.nsa-sa-gaps ul, .nsa-sa-recs ul { margin: 6px 0 0; padding-right: 18px; }
.nsa-sa-gaps li, .nsa-sa-recs li { font-size: .85rem; color: #4b5563; line-height: 1.6; margin-bottom: 3px; }
.nsa-sa-gaps li::before { content: '✗ '; color: #d97706; }
.nsa-sa-recs li::before { content: '✓ '; color: #16a34a; }

/* v18: غلاف بتمرير أفقي للجدول على الشاشات الضيقة بدل تكسّر الأعمدة */
.nsa-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Action plan table */
.nsa-action-plan-table { width: 100%; min-width: 540px; border-collapse: collapse; font-size: .88rem; }
.nsa-action-plan-table thead tr { background: var(--nsa-primary); }
.nsa-action-plan-table th { color: #fff; padding: 10px 12px; text-align: right; font-weight: 700; font-size: .85rem; }
.nsa-action-plan-table td { padding: 10px 12px; border-bottom: 1px solid var(--nsa-border); color: #374151; line-height: 1.55; }
.nsa-action-plan-table tbody tr:nth-child(even) td { background: #f8fafc; }
.nsa-action-plan-table tbody tr:hover td { background: #eff6ff; }
.nsa-priority-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: .78rem; font-weight: 700; }
.nsa-priority-high   { background: #fee2e2; color: #991b1b; }
.nsa-priority-medium { background: #fef9c3; color: #854d0e; }
.nsa-priority-low    { background: #dbeafe; color: #1e40af; }

/* Empty panel fallback */
.nsa-empty-panel { color: var(--nsa-gray); text-align: center; padding: 30px; font-size: .9rem; }

/* Legacy plain AI block */
.nsa-ai-block { margin-top: 28px; background: linear-gradient(135deg, #eff6ff, #f0fdf4); border: 1px solid #bfdbfe; border-radius: var(--nsa-radius); padding: 20px 22px; }
.nsa-ai-block h4 { font-size: .95rem; font-weight: 700; color: var(--nsa-primary); margin: 0 0 10px; }
.nsa-ai-text { font-size: .9rem; color: #1f2937; line-height: 1.75; }

/* v3: pre-written evaluation block (no AI fallback) */
.nsa-eval-block { margin-top: 28px; background: linear-gradient(135deg, #fffbeb, #fef9c3); border: 1px solid #fde68a; border-radius: var(--nsa-radius); padding: 20px 22px; }
.nsa-eval-block-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.nsa-eval-block-header h4 { font-size: .95rem; font-weight: 700; color: #92400e; margin: 0; }
.nsa-eval-body { font-size: .9rem; color: #374151; line-height: 1.75; }

/* v14: rich-text evaluation_text (links, lists, formatting from TinyMCE) */
.nsa-eval-rich-content p { margin: 0 0 8px; }
.nsa-eval-rich-content p:last-child { margin-bottom: 0; }
.nsa-eval-rich-content a { color: var(--nsa-primary); text-decoration: underline; font-weight: 600; }
.nsa-eval-rich-content ul, .nsa-eval-rich-content ol { margin: 0 0 8px; padding-inline-start: 22px; }
.nsa-eval-rich-content li { margin-bottom: 4px; }

/* v11: background AI report — generating indicator */
.nsa-ai-pending { margin-top: 18px; display: flex; align-items: center; gap: 12px; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: var(--nsa-radius); padding: 14px 18px; }
.nsa-ai-pending-spinner { width: 22px; height: 22px; flex-shrink: 0; border: 3px solid #bfdbfe; border-top-color: var(--nsa-primary); border-radius: 50%; animation: nsaSpin .8s linear infinite; }
.nsa-ai-pending-text { font-size: .85rem; color: #1e3a8a; line-height: 1.6; }

/* Results actions */
.nsa-results-actions { text-align: center; margin-top: 28px; display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 700px) {
    .nsa-score-summary-row { grid-template-columns: 1fr; }
    .nsa-sw-grid { grid-template-columns: 1fr; }
    .nsa-report-tabs { flex-wrap: wrap; }
    .nsa-report-tab { font-size: .82rem; padding: 6px 12px; }
    .nsa-action-plan-table { font-size: .8rem; }
    .nsa-action-plan-table th, .nsa-action-plan-table td { padding: 7px 8px; }
    #nsa-step-intro, #nsa-step-lead, .nsa-section-step, #nsa-step-results { padding: 22px 16px; }
    .nsa-assessment-title { font-size: 1.3rem; }
    .nsa-btn { width: 100%; text-align: center; }
    .nsa-nav-btns { flex-direction: column-reverse; }
    .nsa-score-pct { font-size: 2.2rem; }
    .nsa-report-header { flex-direction: column; gap: 4px; }
    .nsa-report-body { padding: 16px; }

    /* v18: بطاقة النتيجة الرئيسية (المخطط الدائري) تتراص عمودياً على الهواتف */
    .nsa-hero-score { flex-direction: column; text-align: center; gap: 16px; padding: 20px 16px; }
    .nsa-gauge-wrap { min-width: 0; width: 100%; }
    .nsa-gauge-svg { width: 100%; max-width: 220px; }
    .nsa-hero-meta { width: 100%; }

    /* v18: مرونة إضافية للمخططات والبطاقات على شاشات الهواتف */
    .nsa-radar-wrap { padding: 16px 10px; }
    .nsa-mini-gauges { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
    .nsa-section-breakdown-header, .nsa-axis-header { flex-wrap: wrap; row-gap: 4px; }
    .nsa-axis-list { padding-right: 12px; }
    .nsa-benchmark-box { flex-direction: column; }
}

/* ── v13: print only the results report, not the whole page ────────── */
@media print {
    body * { visibility: hidden !important; }
    #nsa-step-results, #nsa-step-results * { visibility: visible !important; }
    #nsa-step-results {
        position: absolute !important;
        top: 0; left: 0; right: 0;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background: #fff !important;
    }
    #nsa-results-actions { display: none !important; }
}
