/* ══════════════════════════════════════════════
   DISC App — style.css
   Mobile-first · CSS custom properties
   ══════════════════════════════════════════════ */

:root {
  --D: #C0392B; --I: #E67E22; --S: #27AE60; --C: #2980B9;
  --dark: #1A252F;
  --mid:  #2C3E50;
  --muted:#7F8C8D;
  --light:#F4F6F7;
  --border:#E8ECEF;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
  --font: 'Helvetica Neue', Arial, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: #F0F2F5;
  color: var(--mid);
  min-height: 100vh;
  padding-top: 60px;          /* header height */
}

/* ── Header ─────────────────────────────────── */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: white;
  box-shadow: 0 1px 6px rgba(0,0,0,.1);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; height: 48px;
}
.logo {
  font-size: 18px; font-weight: 900; letter-spacing: 1px; color: var(--dark);
}
.progress-label {
  font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .5px;
}
.progress-track {
  height: 3px; background: var(--border); width: 100%;
}
.progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--D), var(--I), var(--S), var(--C));
  transition: width .4s ease;
}
.back-link {
  font-size: 13px; color: var(--muted); text-decoration: none; font-weight: 500;
  width: 80px;
}
.back-link:hover { color: var(--dark); }

/* ── Layout ──────────────────────────────────── */
main { max-width: 720px; margin: 0 auto; padding: 20px 16px 60px; }

.card {
  background: white; border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; margin-bottom: 16px;
}

/* ── Intro card ──────────────────────────────── */
.disc-stripe { display: flex; height: 5px; }
.disc-stripe span { flex: 1; }
.intro-body { padding: 24px 20px 28px; }
.intro-body h1 { font-size: 24px; font-weight: 400; color: var(--dark); line-height: 1.3; margin-bottom: 10px; }
.intro-body h1 strong { font-weight: 800; }
.intro-sub { font-size: 14px; line-height: 1.6; color: var(--muted); margin-bottom: 20px; }

.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field { flex: 1; min-width: 200px; }
.field-sm { flex: 0 0 160px; }
label { display: block; font-size: 12px; font-weight: 600; color: var(--muted);
        letter-spacing: .6px; text-transform: uppercase; margin-bottom: 6px; }
.req { color: var(--D); }
input[type=text] {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 15px; color: var(--dark); outline: none;
  transition: border-color .2s;
}
input[type=text]:focus { border-color: var(--C); }
input[type=text].error { border-color: var(--D); }

/* ── Section header ──────────────────────────── */
.questions-section { margin-bottom: 16px; }
.section-header {
  display: flex; align-items: flex-start; gap: 14px;
  background: white; border-radius: var(--radius) var(--radius) 0 0;
  padding: 18px 20px 14px; box-shadow: var(--shadow);
  position: sticky; top: 51px; z-index: 50;
  border-bottom: 1px solid var(--border);
}
.section-badge {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; letter-spacing: 1px; color: white;
}
.badge-piu  { background: var(--dark); }
.badge-meno { background: var(--muted); }
.section-title-block h2 { font-size: 16px; font-weight: 700; color: var(--dark); margin-bottom: 2px; }
.section-title-block p  { font-size: 13px; color: var(--muted); line-height: 1.4; }

/* ── Scale header ────────────────────────────── */
.scale-header {
  display: flex; justify-content: flex-end; gap: 0;
  padding: 8px 16px 6px;
  background: #FAFBFB; border-bottom: 1px solid var(--border);
}
.scale-lbl {
  width: 52px; text-align: center; font-size: 11px; font-weight: 600;
  color: var(--muted); line-height: 1.3;
}
.scale-lbl small { font-weight: 400; font-size: 10px; }

/* ── Question items ──────────────────────────── */
.items-list { background: white; border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow); }

.q-item {
  display: flex; align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
  gap: 10px;
}
.q-item:last-child { border-bottom: none; }
.q-item.answered   { background: #FAFFFE; }

.q-num {
  flex-shrink: 0; width: 22px; font-size: 11px; font-weight: 600;
  color: var(--border); text-align: right;
}
.q-dim-dot {
  flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%;
}
.q-text {
  flex: 1; font-size: 14px; line-height: 1.45; color: var(--mid);
}
.q-options {
  display: flex; gap: 6px; flex-shrink: 0;
}

/* Radio circles */
.q-options input[type=radio] { display: none; }
.q-options label {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: var(--muted);
  cursor: pointer; transition: all .15s; margin: 0;
  text-transform: none; letter-spacing: 0;
}
.q-options input[type=radio]:checked + label {
  border-color: currentColor;
  color: white;
  background: currentColor;
}
.q-options label:hover { border-color: currentColor; background: rgba(0,0,0,.04); }

/* Dim colors on radio labels */
.dim-D label { color: var(--D); }
.dim-I label { color: var(--I); }
.dim-S label { color: var(--S); }
.dim-C label { color: var(--C); }

/* ── Submit area ─────────────────────────────── */
.submit-area {
  text-align: center; padding: 28px 0 8px;
}
.submit-hint {
  font-size: 13px; color: var(--muted); margin-bottom: 14px;
}
.btn-primary {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--dark); color: white;
  border: none; border-radius: 10px; cursor: pointer;
  font-size: 16px; font-weight: 700; padding: 16px 36px;
  transition: background .2s, opacity .2s;
  letter-spacing: .3px;
}
.btn-primary:disabled { opacity: .35; cursor: default; }
.btn-primary:not(:disabled):hover { background: var(--mid); }
.btn-arrow { font-size: 18px; }
.spinner { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-msg { margin-top: 12px; font-size: 13px; color: var(--D); min-height: 18px; }

/* ══════════════════════════════════════════════
   RESULTS PAGE
   ══════════════════════════════════════════════ */

.page-results { background: #F0F2F5; }
.results-header { background: white; }

/* Loading */
.loading-screen {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 60vh; gap: 16px;
}
.loading-spinner {
  font-size: 40px; animation: spin 1s linear infinite; color: var(--muted);
}

/* Hero */
.hero-section {
  background: var(--dark); color: white;
  padding: 32px 20px 0; position: relative; overflow: hidden;
}
.hero-inner {
  max-width: 720px; margin: 0 auto;
  display: flex; align-items: center; gap: 20px; padding-bottom: 28px;
}
.hero-badge {
  width: 72px; height: 72px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 900; color: white; letter-spacing: -1px;
}
.hero-name     { font-size: 13px; font-weight: 600; opacity: .5; letter-spacing: 1.5px;
                 text-transform: uppercase; margin-bottom: 4px; }
.hero-archetype{ font-size: 22px; font-weight: 700; line-height: 1.2; margin-bottom: 4px; }
.hero-for      { font-size: 14px; opacity: .65; font-style: italic; }
.hero-stripe   { display: flex; height: 4px; }
.hero-stripe span { flex: 1; }

/* Results sections */
#results-content .card { max-width: 720px; margin: 0 auto 16px; padding: 0; }
.section-title {
  font-size: 13px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--muted); padding: 18px 20px 0; margin-bottom: 14px;
}

/* Chart */
.chart-section { padding-bottom: 4px; }
.chart-wrap { padding: 0 20px 10px; }
#disc-svg { width: 100%; display: block; }

/* Score bars */
.score-bars { padding: 0 20px 14px; }
.score-bars-label {
  font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px; padding-top: 4px;
  border-top: 1px solid var(--border);
}
.score-bar-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 7px;
}
.score-bar-dim  { width: 14px; font-size: 13px; font-weight: 800; text-align: center; }
.score-bar-bg   { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 4px; transition: width .6s ease; }
.score-bar-pct  { width: 36px; font-size: 12px; font-weight: 600; text-align: right; }
.score-bar-tag  {
  font-size: 10px; font-weight: 600; padding: 1px 7px; border-radius: 8px;
  background: #eaf3de; color: #1e8449;
}

/* Dimensions grid */
.dims-section { padding: 0 0 4px; }
.dims-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--border); margin: 0;
}
.dim-card {
  background: white; padding: 16px 18px;
}
.dim-card-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.dim-card-letter { font-size: 20px; font-weight: 800; }
.dim-card-name   { font-size: 12px; font-weight: 600; color: var(--muted); }
.dim-card-level  { font-size: 11px; font-weight: 600; letter-spacing: .4px;
                   padding: 2px 8px; border-radius: 8px; display: inline-block; margin-bottom: 6px; }
.dim-card-pct    { font-size: 22px; font-weight: 700; }

/* Download */
.download-section { padding: 20px; }
.download-inner { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.download-text h2 { font-size: 16px; font-weight: 700; color: var(--dark); margin-bottom: 6px; }
.download-text p  { font-size: 13px; color: var(--muted); line-height: 1.5; }
.btn-download {
  flex-shrink: 0; background: var(--dark); color: white;
  border: none; border-radius: 10px; cursor: pointer;
  font-size: 15px; font-weight: 700; padding: 14px 28px;
  transition: background .2s; white-space: nowrap;
}
.btn-download:hover  { background: var(--mid); }
.btn-download:disabled { opacity: .5; cursor: default; }
.download-note { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* ── Responsive ──────────────────────────────── */
@media (max-width: 520px) {
  .scale-lbl       { width: 40px; font-size: 10px; }
  .q-options label { width: 30px; height: 30px; font-size: 12px; }
  .q-text          { font-size: 13px; }
  .hero-archetype  { font-size: 18px; }
  .dims-grid       { grid-template-columns: 1fr; }
  .download-inner  { flex-direction: column; }
  .btn-download    { width: 100%; text-align: center; }
}

@media (min-width: 640px) {
  main { padding: 28px 20px 80px; }
  .q-item { padding: 13px 20px; }
  .q-text { font-size: 14.5px; }
}

/* ── UNDEFINED profile message ─────────────────── */
.undefined-msg {
  padding: 20px;
  text-align: center;
  color: #7F8C8D;
  font-size: 14px;
  font-style: italic;
  background: #F8F9FA;
  border-radius: 6px;
  margin: 10px 20px 16px;
  border: 1px dashed #D5D8DC;
}
