@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

:root {
    --ink: #1f2a2e;
    --muted: #5b6b6e;
    --bg: #f6f4ef;
    --surface: #ffffff;
    --line: #e3ddd0;
    --brand: #2f6b63;   /* deep teal — clinical trust */
    --brand-dark: #234f49;
    --brand-soft: #e7f1ee;
    --accent: #d97a5f;  /* warm clay — scalp/health warmth, used sparingly */
    --danger: #c1543f;
    --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background:
        radial-gradient(1200px 500px at 50% -120px, #eef4f1 0%, transparent 60%),
        var(--bg);
    color: var(--ink);
    font-family: "Vazirmatn", Tahoma, sans-serif;
    line-height: 1.7;
}

h1, h2, h3, h4 { font-weight: 700; color: var(--brand-dark); margin: 0 0 0.75rem; }
h2 { font-size: 1.3rem; }

/* ---------- Public questionnaire ---------- */
.quiz-viewport {
    position: relative;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 1.25rem;
}
.quiz-viewport::before,
.quiz-viewport::after {
    content: "";
    position: absolute;
    width: 440px; height: 440px;
    border-radius: 50%;
    filter: blur(95px);
    z-index: 0;
    pointer-events: none;
}
.quiz-viewport::before { background: var(--brand); opacity: 0.16; top: -140px; inset-inline-end: -120px; }
.quiz-viewport::after { background: var(--accent); opacity: 0.13; bottom: -160px; inset-inline-start: -130px; }

.quiz-wrap {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 560px;
    max-height: 100%;
    overflow-y: auto;
    scrollbar-width: thin;
    padding: 0.25rem;
}

.fade-in { animation: fadeIn 0.28s ease; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.progress-bar {
    height: 6px;
    background: var(--line);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand), #3f8a7e);
    border-radius: 999px;
    transition: width 0.35s ease;
}
.progress-label { color: var(--muted); font-size: 0.82rem; margin: 0 0 1rem; }

.quiz-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.5rem 1.4rem;
    box-shadow: 0 10px 30px rgba(31, 42, 46, 0.06);
}

.question-header { display: flex; align-items: flex-start; gap: 0.9rem; margin-bottom: 1.1rem; }
.question-header h2 { margin: 0.1rem 0 0; }
.section-label { color: var(--brand); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.01em; }

.icon-badge {
    flex-shrink: 0;
    width: 38px; height: 38px;
    border-radius: 50%;
    background: linear-gradient(160deg, var(--brand-soft), #ffffff);
    border: 1px solid #d7e9e3;
    color: var(--brand-dark);
    display: flex; align-items: center; justify-content: center;
    box-shadow: inset 0 -2px 4px rgba(47, 107, 99, 0.08);
}
.icon-badge svg { width: 18px; height: 18px; }

/* ---------- Welcome / Result screens ---------- */
.welcome-card, .result-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 2.25rem 1.75rem;
    text-align: center;
    box-shadow: 0 10px 30px rgba(31, 42, 46, 0.06);
}

.hero-badge {
    width: 68px; height: 68px;
    margin: 0 auto 1.1rem;
    border-radius: 50%;
    background: linear-gradient(160deg, var(--brand-soft), #fff);
    border: 1px solid #d7e9e3;
    color: var(--brand);
    display: flex; align-items: center; justify-content: center;
    box-shadow: inset 0 -3px 6px rgba(47, 107, 99, 0.1);
}
.hero-badge svg { width: 32px; height: 32px; }
.result-badge { color: var(--brand); background: linear-gradient(160deg, #e9f5f0, #fff); }

.result-card p { font-size: 1.05rem; color: var(--ink); max-width: 480px; margin: 0 auto; }

.hint { color: var(--muted); font-size: 0.92rem; margin-top: -0.25rem; }

/* ---------- Option cards ---------- */
.option-card {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.72rem 1rem;
    border: 1.5px solid var(--line);
    border-radius: 11px;
    margin-bottom: 0.45rem;
    cursor: pointer;
    background: #fff;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.option-card:hover { border-color: #b9d6cf; background: #fbfdfc; }
.option-card.selected { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 2px 10px rgba(47, 107, 99, 0.12); }
.option-card.disabled { opacity: 0.45; cursor: not-allowed; }
.option-card.disabled:hover { border-color: var(--line); background: #fff; }
.option-card input { position: absolute; opacity: 0; width: 0; height: 0; }

.option-indicator {
    flex-shrink: 0;
    width: 22px; height: 22px;
    border: 1.5px solid #c7c2b3;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    transition: border-color 0.15s, background 0.15s;
}
.option-indicator-radio { border-radius: 50%; }
.option-indicator-check { border-radius: 6px; }
.option-card.selected .option-indicator { border-color: var(--brand); background: var(--brand); }
.option-indicator-check svg { width: 13px; height: 13px; }
.radio-dot { width: 9px; height: 9px; border-radius: 50%; background: #fff; }

.option-text { font-size: 0.98rem; }

.quiz-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    justify-content: flex-start;
}

.btn-primary, .btn-secondary, .btn-primary-sm, .btn-secondary-sm, .btn-danger-sm {
    font-family: inherit;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
}
.btn-primary { background: var(--brand); color: #fff; padding: 0.75rem 2.1rem; font-size: 1rem; box-shadow: 0 6px 16px rgba(47, 107, 99, 0.22); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: transparent; color: var(--brand); padding: 0.75rem 1.5rem; border: 1px solid var(--line); }

.error-text { color: var(--danger); font-size: 0.9rem; margin-top: 0.75rem; }

.field-label { display: block; font-size: 0.9rem; color: var(--muted); margin: 0.9rem 0 0.35rem; }
.text-input {
    width: 100%;
    font-family: inherit;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 0.95rem;
    background: #fff;
    color: var(--ink);
}
.text-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 107, 99, 0.12); }
.text-input.small { width: auto; min-width: 90px; }
.text-input.tiny { width: 70px; }
.text-input.mono { font-family: "Courier New", monospace; direction: ltr; text-align: left; font-size: 0.85rem; }

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 80vh; padding: 1rem; }
.login-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 2rem; width: 100%; max-width: 380px;
}

/* ---------- Admin panel ---------- */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 230px; background: var(--brand-dark); color: #fff;
    display: flex; flex-direction: column; padding: 1.5rem 1rem; flex-shrink: 0;
}
.admin-brand { font-weight: 700; font-size: 1.1rem; margin-bottom: 1.5rem; }
.admin-sidebar nav { display: flex; flex-direction: column; gap: 0.25rem; }
.admin-sidebar nav a {
    color: #d7e6e2; text-decoration: none; padding: 0.6rem 0.75rem; border-radius: 8px; font-size: 0.92rem;
}
.admin-sidebar nav a:hover, .admin-sidebar nav a.active { background: rgba(255,255,255,0.12); color: #fff; }
.btn-logout {
    background: transparent; border: 1px solid rgba(255,255,255,0.3); color: #fff;
    border-radius: 8px; padding: 0.55rem; cursor: pointer; font-family: inherit;
}
.admin-content { flex: 1; padding: 2rem 2.5rem; max-width: 980px; }

.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }
.dash-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.25rem; text-align: center;
}
.dash-number { font-size: 2rem; font-weight: 700; color: var(--brand); }

.admin-section { margin-bottom: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.25rem 1rem; }
.admin-section summary { padding: 0.75rem 0; cursor: pointer; font-weight: 700; }
.muted { color: var(--muted); font-weight: 400; font-size: 0.85rem; }

.admin-question-card { border: 1px solid var(--line); border-radius: 10px; padding: 1rem; margin: 0.75rem 0; background: #fdfcfa; }
.admin-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.admin-row label { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.checkbox-label { display: flex; align-items: center; gap: 0.3rem; font-size: 0.85rem; }

.btn-primary-sm, .btn-secondary-sm, .btn-danger-sm { padding: 0.4rem 0.9rem; font-size: 0.85rem; }
.btn-primary-sm { background: var(--brand); color: #fff; }
.btn-secondary-sm { background: transparent; border: 1px solid var(--line); color: var(--brand); text-decoration: none; display: inline-block; }
.btn-danger-sm { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.saved-msg { color: var(--brand); font-size: 0.85rem; }

.admin-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.admin-table th, .admin-table td { padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--line); text-align: right; font-size: 0.9rem; }
.admin-table th { background: #f1efe8; color: var(--muted); font-weight: 600; }
.truncate { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.back-link { display: inline-block; margin-bottom: 1rem; color: var(--brand); text-decoration: none; font-size: 0.9rem; }
.back-link:hover { text-decoration: underline; }
.detail-chip { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 0.4rem 0.9rem; font-size: 0.85rem; color: var(--muted); }
.score-chip { color: var(--brand-dark); font-weight: 700; border-color: var(--brand); }
.answer-list { margin: 0.5rem 0 0; padding-inline-start: 1.25rem; }
.answer-list li { margin-bottom: 0.2rem; }

@media (max-width: 720px) {
    .admin-shell { flex-direction: column; }
    .admin-sidebar { width: 100%; flex-direction: row; overflow-x: auto; }
    .admin-sidebar nav { flex-direction: row; }
    .admin-content { padding: 1.25rem; }
}
