/* Map psych-tests colors to main site palette */
:root {
  --primary:    var(--accent);
  --primary-dk: var(--accent2);
  --secondary:  var(--accent-light);
  --card-bg:    var(--card);
  --text-muted: var(--text2);
  --radius:     12px;
  --success:    #22c55e;
  --warning:    #f59e0b;
  --danger:     #ef4444;
}

/* ── Main content area ── */
.main-content { flex: 1; padding: 32px 0 48px; margin-top: 70px; }

body { display: flex; flex-direction: column; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: #fff; border-radius: var(--radius); padding: 60px 40px;
  text-align: center; margin-bottom: 40px;
  min-height: auto;
}
.hero h1 { font-size: 2.2rem; margin-bottom: 14px; }
.hero p  { font-size: 1.1rem; opacity: .9; max-width: 600px; margin: 0 auto 24px; }
.btn-hero {
  display: inline-block; background: #fff; color: var(--accent2);
  padding: 12px 32px; border-radius: 50px; font-weight: 700;
  text-decoration: none; font-size: 1rem; transition: transform .2s;
  font-family: 'Vazirmatn', sans-serif;
}
.btn-hero:hover { transform: translateY(-2px); }

/* ── Cards ── */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }

.card {
  background: var(--card-bg); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  overflow: hidden; transition: transform .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card-body { padding: 24px; }
.card-icon { font-size: 2.6rem; margin-bottom: 12px; display: block; }
.card-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.card-desc  { font-size: .88rem; color: var(--text-muted); margin-bottom: 16px; line-height: 1.6; }
.card-footer {
  padding: 14px 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg);
}
.card-meta { font-size: .82rem; color: var(--text-muted); }
.badge {
  font-size: .75rem; padding: 3px 10px; border-radius: 20px;
  font-weight: 600;
}
.badge-clinical  { background: #fee2e2; color: #dc2626; }
.badge-personal  { background: var(--accent-light); color: var(--accent); }
.badge-relations { background: #fce7f3; color: #be185d; }
.badge-org       { background: #d1fae5; color: #065f46; }
.badge-intel     { background: #dbeafe; color: #1d4ed8; }
.badge-child     { background: #fef9c3; color: #92400e; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 24px; border-radius: 10px; font-size: .95rem;
  font-weight: 600; cursor: pointer; text-decoration: none;
  border: none; transition: all .2s; font-family: inherit;
}
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover  { background: var(--accent2); }
.btn-success  { background: var(--success); color: #fff; }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-outline  { background: var(--card); color: var(--accent); border: 2px solid var(--accent); }
.btn-outline:hover { background: var(--accent); color: #fff; }
.btn-sm       { padding: 7px 16px; font-size: .85rem; }
.btn-lg       { padding: 14px 36px; font-size: 1.05rem; }
.btn-full     { width: 100%; }

/* ── Forms ── */
.form-card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  padding: 36px 40px; max-width: 480px; margin: 0 auto;
}
.form-title { font-size: 1.5rem; font-weight: 700; text-align: center; margin-bottom: 6px; color: var(--text); }
.form-subtitle { text-align: center; color: var(--text-muted); font-size: .9rem; margin-bottom: 28px; }
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-control {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: 10px; font-size: .95rem; font-family: inherit;
  transition: border-color .2s; background: var(--card); color: var(--text); direction: rtl;
}
.form-control:focus { outline: none; border-color: var(--accent); }
.form-error { color: var(--danger); font-size: .83rem; margin-top: 4px; }
.form-link  { text-align: center; font-size: .88rem; color: var(--text-muted); margin-top: 16px; }
.form-link a { color: var(--accent); text-decoration: none; font-weight: 600; }

/* ── Alert ── */
.alert {
  padding: 12px 18px; border-radius: 10px; margin-bottom: 18px;
  font-size: .9rem; border: 1px solid transparent;
}
.alert-danger  { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.alert-success { background: #f0fdf4; color: #16a34a; border-color: #bbf7d0; }
.alert-info    { background: var(--accent-light); color: var(--accent2); border-color: var(--accent); }

/* ── Test Page ── */
.test-header {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: #fff; border-radius: var(--radius); padding: 32px;
  margin-bottom: 24px;
}
.test-header h1 { font-size: 1.6rem; margin-bottom: 6px; }
.test-header p  { opacity: .9; font-size: .95rem; }
.test-meta { display: flex; gap: 20px; margin-top: 14px; flex-wrap: wrap; }
.test-meta span { font-size: .85rem; opacity: .85; }

.progress-bar-wrap { background: rgba(255,255,255,.25); border-radius: 20px; height: 6px; margin-top: 14px; }
.progress-bar { background: #fff; height: 6px; border-radius: 20px; transition: width .4s; }

.question-card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 28px; margin-bottom: 16px;
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
}
.question-num { font-size: .8rem; color: var(--accent); font-weight: 700; margin-bottom: 8px; }
.question-text { font-size: 1.05rem; font-weight: 600; margin-bottom: 18px; color: var(--text); }
.options-list { display: flex; flex-direction: column; gap: 10px; }
.option-label {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border: 1.5px solid var(--border);
  border-radius: 10px; cursor: pointer; transition: all .2s; color: var(--text);
}
.option-label:hover { border-color: var(--accent); background: var(--accent-light); }
.option-label input[type=radio] { display: none; }
.option-label.selected { border-color: var(--accent); background: var(--accent-light); }
.option-radio {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .2s;
}
.option-radio::after {
  content: ''; width: 8px; height: 8px;
  border-radius: 50%; background: var(--accent); display: none;
}
.option-label.selected .option-radio { border-color: var(--accent); }
.option-label.selected .option-radio::after { display: block; }
.option-text { font-size: .95rem; }

/* Section navigation for multi-section tests */
.section-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border);
}
.questions-section { display: none; }
.questions-section.active { display: block; }

/* ── Result Page ── */
.result-card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  overflow: hidden;
}
.result-header {
  padding: 36px; text-align: center;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: #fff;
}
.result-score-circle {
  width: 110px; height: 110px; border-radius: 50%;
  background: rgba(255,255,255,.2); border: 4px solid rgba(255,255,255,.5);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.result-score-num  { font-size: 2.2rem; font-weight: 800; }
.result-score-max  { font-size: .8rem; opacity: .8; }
.result-interpretation { font-size: 1.4rem; font-weight: 700; margin-bottom: 6px; }
.result-body { padding: 32px; }
.result-detail { font-size: .95rem; line-height: 1.9; color: var(--text-muted); }
.result-actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }

/* ── History ── */
.history-item {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 18px 24px;
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 12px; text-decoration: none; color: inherit;
  transition: box-shadow .2s;
}
.history-item:hover { box-shadow: var(--shadow-lg); }
.history-icon { font-size: 2rem; flex-shrink: 0; }
.history-info { flex: 1; }
.history-title { font-weight: 700; margin-bottom: 2px; color: var(--text); }
.history-meta  { font-size: .82rem; color: var(--text-muted); }
.history-score {
  text-align: center; min-width: 70px;
  font-size: 1.1rem; font-weight: 700; color: var(--accent);
}
.history-interp { font-size: .78rem; color: var(--text-muted); }

/* ── Dashboard ── */
.dash-welcome {
  background: var(--accent-light);
  border-radius: var(--radius); padding: 28px 32px; margin-bottom: 32px;
  border: 1px solid var(--border);
}
.dash-welcome h2 { font-size: 1.4rem; color: var(--accent); margin-bottom: 6px; }
.section-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 18px; color: var(--text); }
.dashboard-quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.dashboard-quick-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  text-decoration: none;
  color: var(--text);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.dashboard-quick-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}
.dashboard-quick-card strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 8px;
  color: var(--accent2);
}
.dashboard-quick-card span {
  display: block;
  font-size: .88rem;
  line-height: 1.8;
  color: var(--text-muted);
}
.dashboard-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.dashboard-page-subtitle {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.9;
}
.dashboard-form-card {
  max-width: 720px;
  margin: 0 auto;
}

/* ── Misc ── */
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-3 { margin-bottom: 24px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 4rem; display: block; margin-bottom: 16px; }
.spinner {
  width: 40px; height: 40px; border: 4px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: psych-spin .8s linear infinite; margin: 40px auto;
}
@keyframes psych-spin { to { transform: rotate(360deg); } }

.category-pill {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: .75rem; font-weight: 600; background: var(--accent-light); color: var(--accent);
}

/* Likert scale */
.likert-row {
  display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap;
}
.likert-option { flex: 1; text-align: center; }
.likert-option label {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; padding: 10px 4px; border: 1.5px solid var(--border);
  border-radius: 10px; transition: all .2s; font-size: .82rem; color: var(--text-muted);
}
.likert-option input { display: none; }
.likert-option label:hover { border-color: var(--accent); background: var(--accent-light); }
.likert-option input:checked + label { border-color: var(--accent); background: var(--accent-light); color: var(--accent); font-weight: 600; }
.likert-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); transition: all .2s; }
.likert-option input:checked + label .likert-dot { background: var(--accent); border-color: var(--accent); }

/* Responsive */
@media (max-width: 768px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .dashboard-quick-actions { grid-template-columns: 1fr; }
  .form-card { padding: 24px 18px; }
  .hero { padding: 40px 20px; }
  .hero h1 { font-size: 1.6rem; }
  .test-meta { gap: 10px; }
  .history-item { flex-wrap: wrap; }
}
