/* ============================================================
   تحليل السمات السلوكية V5 — تصميم فاخر داكن (Glass / Aurora)
   ============================================================ */

*,
*::before,
*::after { box-sizing: border-box; }

:root {
  --bg: #07070f;
  --panel: rgba(22, 21, 42, .58);
  --panel-solid: #14132a;
  --text: #f1f0fa;
  --muted: #9c98bd;
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .16);
  --violet: #8b5cf6;
  --violet-soft: #a78bfa;
  --cyan: #22d3ee;
  --magenta: #e879f9;
  --grad: linear-gradient(120deg, #a78bfa 0%, #8b5cf6 45%, #22d3ee 100%);
  --glow: 0 10px 40px rgba(139, 92, 246, .35);
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: rgba(139, 92, 246, .45); color: #fff; }

/* ---------- خلفية المشهد (أضواء أورورا + شبكة + نجوم) ---------- */

.scene {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(139, 92, 246, .16), transparent 70%),
    var(--bg);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: .5;
  will-change: transform;
}

.orb-a {
  width: 520px; height: 520px;
  top: -180px; right: -120px;
  background: radial-gradient(circle, #6d28d9, transparent 65%);
  animation: drift-a 26s ease-in-out infinite alternate;
}

.orb-b {
  width: 460px; height: 460px;
  bottom: -160px; left: -140px;
  background: radial-gradient(circle, #0e7490, transparent 65%);
  animation: drift-b 32s ease-in-out infinite alternate;
}

.orb-c {
  width: 340px; height: 340px;
  top: 38%; left: 28%;
  background: radial-gradient(circle, rgba(232, 121, 249, .55), transparent 65%);
  opacity: .28;
  animation: drift-c 24s ease-in-out infinite alternate;
}

@keyframes drift-a { to { transform: translate(-90px, 70px) scale(1.12); } }
@keyframes drift-b { to { transform: translate(80px, -60px) scale(1.08); } }
@keyframes drift-c { to { transform: translate(-60px, -80px) scale(1.15); } }

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 75% 60% at 50% 0%, #000 35%, transparent 100%);
          mask-image: radial-gradient(ellipse 75% 60% at 50% 0%, #000 35%, transparent 100%);
}

/* ---------- الهيكل العام ---------- */

.wrap {
  width: min(960px, 93vw);
  margin: 0 auto;
  padding: 48px 0 72px;
}

/* ---------- الترويسة ---------- */

.hero {
  text-align: center;
  padding: 18px 4px 30px;
  animation: rise .7s cubic-bezier(.2, .7, .2, 1) both;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .4px;
  color: var(--violet-soft);
  background: rgba(139, 92, 246, .10);
  backdrop-filter: blur(8px);
}

.pill::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--grad);
  box-shadow: 0 0 12px rgba(167, 139, 250, .9);
  animation: pulse 2.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%      { transform: scale(.55); opacity: .6; }
}

.hero h1 {
  margin: 22px 0 14px;
  font-size: clamp(34px, 6.5vw, 62px);
  font-weight: 700;
  line-height: 1.2;
  background: linear-gradient(120deg, #ffffff 10%, #c4b5fd 45%, #67e8f9 90%);
  background-size: 200% auto;
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
          color: transparent;
  animation: shine 7s linear infinite;
}

@keyframes shine { to { background-position: 200% center; } }

.hero p {
  margin: 0 auto;
  color: var(--muted);
  line-height: 2;
  max-width: 640px;
  font-size: 17px;
}

/* ---------- البطاقات الزجاجية ---------- */

.card {
  position: relative;
  margin-top: 26px;
  padding: clamp(26px, 4.5vw, 42px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, .5),
    inset 0 1px 0 rgba(255, 255, 255, .06);
  animation: rise .6s cubic-bezier(.2, .7, .2, 1) both;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 12% auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(196, 181, 253, .6), transparent);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(26px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.hidden { display: none !important; }

h2 {
  margin: 0 0 14px;
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 700;
  line-height: 1.5;
}

h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 30px 0 14px;
  font-size: 18px;
  font-weight: 700;
}

#resultCard h3::before,
.guide h3::before {
  content: "";
  width: 7px; height: 22px;
  border-radius: 99px;
  background: var(--grad);
  box-shadow: 0 0 14px rgba(139, 92, 246, .55);
}

.muted, .summary { color: var(--muted); line-height: 2; }

.summary {
  font-size: 16.5px;
  border-right: 3px solid;
  border-image: linear-gradient(180deg, var(--violet), var(--cyan)) 1;
  padding-right: 16px;
  margin: 22px 0;
}

/* ---------- نموذج التعريف ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 24px;
}

label span {
  display: block;
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
}

input, select {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 15.5px;
  font-family: inherit;
  background: rgba(10, 9, 24, .55);
  color: var(--text);
  outline: none;
  transition: border-color .25s, box-shadow .25s, background .25s;
}

input::placeholder { color: rgba(156, 152, 189, .55); }

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'><path d='M1 1l6 6 6-6' fill='none' stroke='%239c98bd' stroke-width='2' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: left 16px center;
  padding-left: 42px;
  cursor: pointer;
}

select option { background: var(--panel-solid); color: var(--text); }

input:hover, select:hover { border-color: var(--line-strong); }

input:focus, select:focus {
  border-color: rgba(167, 139, 250, .75);
  background: rgba(15, 13, 34, .8);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, .18);
}

/* ---------- الأزرار ---------- */

button {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 15px 26px;
  font-weight: 700;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  transition: transform .2s, box-shadow .25s, opacity .2s, background .25s;
}

button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

button:active { transform: scale(.97); }

button:disabled {
  opacity: .35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.primary {
  position: relative;
  background: var(--grad);
  background-size: 160% auto;
  color: #fff;
  margin-top: 24px;
  box-shadow: var(--glow);
}

.primary:hover:not(:disabled) {
  background-position: 100% center;
  transform: translateY(-2px);
  box-shadow: 0 16px 50px rgba(139, 92, 246, .5);
}

#startBtn { width: 100%; min-height: 56px; font-size: 16.5px; letter-spacing: .3px; }

.secondary {
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line);
  color: var(--text);
  margin-top: 24px;
}

.secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, .11);
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

/* ---------- بطاقة الأسئلة ---------- */

.topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

#stageTitle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--violet-soft);
}

#stageTitle::before {
  content: "";
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--grad);
  box-shadow: 0 0 10px rgba(167, 139, 250, .8);
}

#progressLabel {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 4px 13px;
  font-size: 13px;
  font-weight: 600;
}

.progress {
  height: 8px;
  background: rgba(255, 255, 255, .06);
  border-radius: 99px;
  overflow: hidden;
  margin: 16px 0 22px;
}

#progressBar {
  position: relative;
  height: 100%;
  border-radius: 99px;
  background: var(--grad);
  width: 0;
  box-shadow: 0 0 16px rgba(139, 92, 246, .6);
  transition: width .45s cubic-bezier(.2, .7, .2, 1);
  overflow: hidden;
}

#progressBar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
  transform: translateX(-100%);
  animation: sweep 2.4s ease-in-out infinite;
}

@keyframes sweep { to { transform: translateX(100%); } }

.question-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
  font-size: 13px;
}

#axisLabel, #contextLabel {
  display: inline-flex;
  align-items: center;
  padding: 5px 13px;
  border-radius: 99px;
  font-weight: 600;
}

#axisLabel {
  color: #c4b5fd;
  background: rgba(139, 92, 246, .14);
  border: 1px solid rgba(139, 92, 246, .3);
}

#contextLabel {
  color: #67e8f9;
  background: rgba(34, 211, 238, .10);
  border: 1px solid rgba(34, 211, 238, .25);
}

#questionText { min-height: 1.4em; }

/* ---------- خيارات الإجابة ---------- */

.answer {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, .035);
  margin: 12px 0;
  cursor: pointer;
  line-height: 1.85;
  transition: border-color .22s, background .22s, transform .22s, box-shadow .22s;
}

.answer::before {
  content: "";
  flex-shrink: 0;
  width: 22px; height: 22px;
  margin-top: 4px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .28);
  transition: border-color .22s, background .22s, box-shadow .22s;
}

.answer:hover {
  border-color: rgba(167, 139, 250, .5);
  background: rgba(139, 92, 246, .08);
  transform: translateY(-2px);
}

.answer.selected {
  border-color: rgba(167, 139, 250, .85);
  background: linear-gradient(135deg, rgba(139, 92, 246, .16), rgba(34, 211, 238, .08));
  box-shadow: 0 8px 30px rgba(139, 92, 246, .22), inset 0 0 0 1px rgba(167, 139, 250, .35);
}

.answer.selected::before {
  border-color: transparent;
  background:
    radial-gradient(circle, #fff 0 4.5px, transparent 5.5px),
    var(--grad);
  box-shadow: 0 0 14px rgba(139, 92, 246, .7);
}

.answer input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0; height: 0; min-height: 0;
}

/* حركة تبديل السؤال */

.swap { animation: fadeUp .45s cubic-bezier(.2, .7, .2, 1) both; }

#answers.swap .answer { animation: fadeUp .5s cubic-bezier(.2, .7, .2, 1) both; }
#answers.swap .answer:nth-child(1) { animation-delay: .05s; }
#answers.swap .answer:nth-child(2) { animation-delay: .11s; }
#answers.swap .answer:nth-child(3) { animation-delay: .17s; }
#answers.swap .answer:nth-child(4) { animation-delay: .23s; }
#answers.swap .answer:nth-child(5) { animation-delay: .29s; }
#answers.swap .answer:nth-child(6) { animation-delay: .35s; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
}

.actions button { min-width: 130px; }

/* ---------- بطاقة النتيجة ---------- */

.resultHead {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.resultHead h2 { margin-top: 14px; }

.confidence {
  flex-shrink: 0;
  min-width: 132px;
  text-align: center;
  padding: 18px 16px;
  border-radius: 20px;
  border: 1px solid transparent;
  background:
    linear-gradient(var(--panel-solid), var(--panel-solid)) padding-box,
    var(--grad) border-box;
  box-shadow: 0 14px 40px rgba(139, 92, 246, .25);
}

.confidence b {
  display: block;
  font-size: 34px;
  font-weight: 700;
  background: var(--grad);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
          color: transparent;
}

.confidence small { color: var(--muted); font-size: 12.5px; }

ul { list-style: none; margin: 0; padding: 0; }

#strengths li, #attention li {
  position: relative;
  color: var(--muted);
  line-height: 2;
  padding: 9px 38px 9px 12px;
  margin: 8px 0;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--line);
}

#strengths li::before, #attention li::before {
  position: absolute;
  right: 13px;
  top: 9px;
  font-weight: 700;
}

#strengths li::before { content: "✦"; color: #34d399; text-shadow: 0 0 10px rgba(52, 211, 153, .6); }
#attention li::before { content: "!"; color: #fbbf24; text-shadow: 0 0 10px rgba(251, 191, 36, .6); }

/* مؤشرات الأعمدة */

.trait { margin: 18px 0; }

.traitTop {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14.5px;
}

.traitTop span:last-child {
  font-variant-numeric: tabular-nums;
  color: var(--violet-soft);
}

.bar {
  height: 12px;
  background: rgba(255, 255, 255, .06);
  border-radius: 99px;
  overflow: hidden;
}

.bar div {
  position: relative;
  height: 100%;
  border-radius: 99px;
  background: var(--grad);
  box-shadow: 0 0 14px rgba(139, 92, 246, .5);
  animation: grow 1s cubic-bezier(.2, .7, .2, 1) both;
  transform-origin: right center;
  overflow: hidden;
}

.bar div::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent);
  transform: translateX(-100%);
  animation: sweep 2.8s ease-in-out infinite;
}

@keyframes grow {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* الدليل العملي وصندوق المتابعة */

.guide, .continue {
  margin-top: 26px;
  border-radius: 20px;
  padding: 22px;
  line-height: 1.95;
}

.guide {
  border: 1px solid rgba(139, 92, 246, .28);
  background: rgba(139, 92, 246, .07);
  color: #ddd6fe;
}

.guide h3 { margin-top: 4px; color: var(--text); }

.guide table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(10, 9, 24, .5);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: 6px;
}

.guide th, .guide td {
  border: 1px solid rgba(255, 255, 255, .08);
  padding: 13px 14px;
  text-align: right;
  vertical-align: top;
  font-size: 14.5px;
  color: var(--muted);
}

.guide th {
  background: rgba(139, 92, 246, .16);
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

.continue {
  position: relative;
  text-align: center;
  border: 1px solid rgba(34, 211, 238, .3);
  background: rgba(34, 211, 238, .06);
  color: #a5f3fc;
  animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 211, 238, .0); }
  50%      { box-shadow: 0 0 34px 0 rgba(34, 211, 238, .18); }
}

.continue p { margin: 0 0 4px; line-height: 2; }

/* ---------- تذييل ---------- */

.foot {
  margin-top: 34px;
  text-align: center;
  color: rgba(156, 152, 189, .65);
  font-size: 13px;
  line-height: 1.9;
}

/* ---------- شريط التمرير ---------- */

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, .35);
  border-radius: 99px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: rgba(139, 92, 246, .6); }

/* ---------- الاستجابة للشاشات الصغيرة ---------- */

@media (max-width: 700px) {
  .wrap { padding-top: 32px; }
  .grid { grid-template-columns: 1fr; }
  .resultHead { flex-direction: column; }
  .confidence { width: 100%; }
  .actions { flex-direction: column-reverse; }
  .actions button, button { width: 100%; }
  .guide table, .guide tbody, .guide tr, .guide td, .guide th {
    display: block;
    width: 100%;
  }
  .guide th { border-bottom: 0; }
  .orb { filter: blur(80px); }
}

/* ---------- تقليل الحركة ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- V5.2 Trait Picker ---------- */

.traitsBox {
  margin-top: 28px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, .035);
}

.traitsHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.traitsHead h3 { margin: 0; }

#traitCount {
  color: var(--cyan);
  font-weight: 700;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(34, 211, 238, .08);
}

.traitColumns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.traitColumns h4 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 15px;
}

.traitsGrid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.traitChip {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(10, 9, 24, .55);
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, color .18s ease;
}

.traitChip:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  color: var(--text);
}

.traitChip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.traitChip.selected {
  color: #fff;
  border-color: rgba(167, 139, 250, .55);
  background: linear-gradient(120deg, rgba(139, 92, 246, .25), rgba(34, 211, 238, .14));
  box-shadow: 0 8px 24px rgba(139, 92, 246, .14);
}

.reportStyleLabel {
  display: block;
  margin-top: 22px;
  max-width: 360px;
}

.traitNote {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.levelTag {
  display: inline-flex;
  margin-inline-start: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--cyan);
  background: rgba(34, 211, 238, .08);
  border: 1px solid rgba(34, 211, 238, .18);
}

.resultListCard {
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, .035);
}

@media (max-width: 780px) {
  .traitColumns { grid-template-columns: 1fr; }
  .traitsBox { padding: 16px; }
}
