/* Assessment Suite — Frontend Styles v2 */
:root {
  --as-primary: #2563eb;
  --as-border:  #e5e7eb;
  --as-bg:      #f9fafb;
  --as-text:    #111827;
  --as-muted:   #6b7280;
  --as-radius:  10px;
  --as-shadow:  0 2px 16px rgba(0,0,0,.07);
}

.as-survey {
  font-family: var(--as-font-family, Georgia, serif);
  color: var(--as-text);
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px 60px;
  border-radius: var(--as-survey-card-radius, var(--as-radius));
}

/* Loading */
.as-survey__loading { text-align:center; padding:40px; }
.as-spinner { display:inline-block; width:28px; height:28px; border:3px solid var(--as-border); border-top-color:var(--as-section-title-color,var(--as-primary)); border-radius:50%; animation:as-spin .7s linear infinite; }
@keyframes as-spin { to { transform:rotate(360deg); } }

/* Header */
.as-survey__header { text-align:center; padding:32px 24px 24px; border-bottom:1px solid var(--as-border); margin-bottom:28px; }
.as-survey__title { font-size:24px; font-weight:700; margin:0 0 8px; }
.as-survey__description { font-size:var(--as-survey-desc-size,14px); color:var(--as-survey-desc-color,var(--as-muted)); margin:0; line-height:1.6; }

/* Progress */
.as-survey__progress { margin-bottom:24px; }
.as-survey__progress-track { height:5px; background:var(--as-border); border-radius:3px; overflow:hidden; margin-bottom:6px; }
.as-survey__progress-fill { height:100%; background:var(--as-progress-fill,var(--as-primary)); border-radius:3px; transition:width .4s ease; }
.as-survey__progress-row { display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; }
.as-survey__progress-section { font-size:12px; font-weight:600; color:var(--as-muted); text-transform:uppercase; letter-spacing:.05em; }
.as-survey__progress-pct { font-size:12px; color:var(--as-muted); flex-shrink:0; margin-left:12px; }

/* Section */
.as-section { margin-bottom:28px; }
.as-section__header { margin-bottom:16px; }
.as-section__title { font-size:18px; font-weight:700; margin:0 0 5px; color:var(--as-primary); }
.as-section__description { font-size:14px; color:var(--as-muted); margin:0; line-height:1.5; }

/* Question section label (one-per-page mode) */
.as-question-section-label { font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--as-section-tag-color,var(--as-primary)); background:var(--as-section-tag-bg,rgba(37,99,235,.07)); display:inline-block; padding:3px 10px; border-radius:20px; margin-bottom:14px; }

/* Scale legend */
.as-scale-legend { display:none; gap:0; border:1px solid var(--as-border); border-radius:8px; overflow:hidden; margin-bottom:20px; background:var(--as-bg); }
.as-scale-legend__item { flex:1; text-align:center; padding:7px 4px; border-right:1px solid var(--as-border); font-size:12px; color:var(--as-muted); }
.as-scale-legend__item:last-child { border-right:none; }
.as-scale-legend__item strong { display:block; font-size:14px; color:var(--as-text); }
.as-scale-legend__item em { display:block; font-style:normal; font-size:10px; margin-top:1px; line-height:1.2; }

/* Question */
.as-question { padding:16px 0; border-bottom:1px solid var(--as-border); }
.as-question:last-child { border-bottom:none; }
.as-question__prompt { display:flex; gap:8px; margin-bottom:12px; align-items:flex-start; }
.as-question__num { font-size:11px; font-weight:700; color:var(--as-bubble-color,var(--as-primary)); background:var(--as-bubble-bg,rgba(37,99,235,.1)); width:22px; height:22px; border-radius:50%; display:flex; align-items:center; justify-content:center; flex-shrink:0; margin-top:2px; }
.as-question__text { font-size:15px; line-height:1.55; }

/* Likert */
.as-likert-row { display:flex; gap:6px; padding:4px; border-radius:8px; transition:background .2s; }
.as-likert-row.as-error { background:#fef2f2; outline:2px solid #f87171; }
.as-likert-option { flex:1; }
.as-likert-radio { position:absolute; opacity:0; width:0; height:0; }
.as-likert-btn { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; padding:10px 4px; border:1.5px solid var(--as-border); border-radius:8px; cursor:pointer; transition:all .15s; background:#fff; min-height:52px; text-align:center; user-select:none; }
.as-likert-btn:hover { border-color:var(--as-likert-hover-border,var(--as-primary)); background:var(--as-likert-hover-bg,#eff6ff); }
.as-likert-radio:checked + .as-likert-btn { border-color:var(--as-likert-selected-border,var(--as-primary)); background:var(--as-likert-selected-bg,var(--as-primary)); color:var(--as-likert-selected-color,#fff); }
.as-likert-num { font-size:15px; font-weight:700; line-height:1; }
.as-likert-label { font-size:var(--as-answer-size, 9px); line-height:1.2; opacity:.8; max-width:52px; }

/* Contact step */
.as-contact-step { padding:20px 0; }
.as-contact-fields { max-width:380px; display:flex; flex-direction:column; gap:14px; margin-top:20px; }
.as-contact-name-row { display:flex; gap:12px; }
.as-contact-name-row .as-field { flex:1; min-width:0; }
.as-field { display:flex; flex-direction:column; gap:5px; }
.as-field label { font-size:13px; font-weight:600; }
.as-field-input { padding:9px 12px; border:1.5px solid var(--as-border); border-radius:8px; font-size:14px; font-family:inherit; transition:border-color .15s; }
.as-field-input:focus { outline:none; border-color:var(--as-primary); box-shadow:0 0 0 3px rgba(37,99,235,.1); }
.as-field-note { font-size:11px; color:var(--as-muted); margin:0; }
.as-optional { font-size:11px; color:var(--as-muted); font-weight:400; }

/* Nav */
.as-survey__nav { display:flex; justify-content:space-between; align-items:center; padding:24px 0 0; border-top:1px solid var(--as-border); margin-top:8px; }
.as-nav-right { display:flex; gap:10px; }
.as-btn { display:inline-flex; align-items:center; gap:6px; padding:11px 22px; border-radius:8px; font-size:14px; font-weight:600; font-family:inherit; cursor:pointer; border:1.5px solid transparent; transition:all .15s; line-height:1; }
.as-btn--primary { background:var(--as-primary); color:#fff; border-color:var(--as-primary); }
.as-btn--primary:hover { filter:brightness(1.08); }
.as-btn--ghost { background:transparent; color:var(--as-muted); border-color:var(--as-border); }
.as-btn--ghost:hover { background:var(--as-bg); }
.as-btn--secondary { background:transparent; color:var(--as-results-link-color,var(--as-primary)); border-color:var(--as-results-link-color,var(--as-primary)); }
.as-btn--secondary:hover { background:var(--as-bg); }
.as-btn:disabled { opacity:.6; cursor:not-allowed; }

/* Error */
.as-survey__error { margin-top:12px; padding:10px 14px; background:#fef2f2; border:1px solid #fca5a5; border-radius:8px; color:#dc2626; font-size:14px; }
.as-error-msg { display:none; }

/* Results */
.as-survey__results { padding:4px 0; }

/* Full results page (shortcode) — match survey container width */
.as-results-page {
  font-family: var(--as-font-family, Georgia, serif);
  color: var(--as-text);
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 16px 60px;
}
.as-results__header { text-align:center; padding:28px 0 24px; border-bottom:1px solid var(--as-border); margin-bottom:24px; border-radius:var(--as-results-header-radius,0px); }
.as-results__title { font-size:24px; font-weight:700; margin:0 0 5px; }
.as-results__subtitle { font-size:14px; color:var(--as-muted); margin:0; }
.as-results__cards { display:flex; flex-direction:column; gap:18px; }
.as-result-card { background:#fff; border:1px solid var(--as-border); border-radius:var(--as-radius); padding:20px; box-shadow:var(--as-shadow); }
.as-result-card__header { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; flex-wrap:wrap; }
.as-result-card__section { font-size:16px; font-weight:700; margin:0; }
.as-result-card__badge { display:inline-block; padding:3px 12px; background:var(--as-primary); color:#fff; border-radius:20px; font-size:12px; font-weight:600; }
.as-result-card__score { display:flex; justify-content:space-between; margin-bottom:7px; }
.as-result-card__numbers { font-size:13px; color:var(--as-muted); }
.as-result-card__pct { font-size:14px; font-weight:700; }
.as-progress-bar { background:var(--as-bg); border-radius:4px; height:8px; overflow:hidden; margin-bottom:14px; }
.as-progress-bar__fill { height:100%; background:var(--as-progress-fill, var(--as-primary)); border-radius:4px; transition:width .6s ease; }
.as-result-card__description { font-size:14px; color:var(--as-muted); line-height:1.65; margin:0 0 12px; }
.as-result-card__section-desc { margin-top:0; }
.as-result-card__recommendations { border-left:3px solid var(--as-reco-border,var(--as-primary)); padding:10px 14px; background:var(--as-reco-bg,var(--as-bg)); border-radius:0 8px 8px 0; }
.as-result-card__recommendations strong { display:block; font-size:12px; font-weight:700; margin-bottom:4px; }
.as-result-card__recommendations p { font-size:13px; color:var(--as-muted); margin:0; line-height:1.5; }

/* Error state */
.as-error { color:#dc2626; font-size:14px; padding:12px; border:1px solid #fca5a5; border-radius:8px; background:#fef2f2; }

/* Mobile */
@media(max-width:560px) {
  .as-likert-row { flex-direction:column; gap:4px; }
  .as-likert-option { flex:none; width:100%; }
  .as-likert-btn { flex-direction:row; justify-content:flex-start; min-height:44px; padding:10px 14px; gap:10px; }
  .as-likert-num { font-size:15px; min-width:24px; text-align:center; }
  .as-likert-label { font-size:13px; max-width:none; opacity:1; }
  .as-scale-legend { display:none; }
  .as-survey__title { font-size:20px; }
}

/* ── Print styles ──────────────────────────────────────────────────────────── */
.as-print-btn { margin-top: 12px; }

@media print {
  .as-survey__form,
  .as-survey__progress,
  .as-survey__nav,
  .as-print-btn,
  .as-results__link,
  header, footer, nav, aside { display: none !important; }

  .as-results-page,
  .as-survey__results { display: block !important; }

  .as-result-card {
    break-inside: avoid;
    page-break-inside: avoid;
    border: 1px solid #ddd;
    margin-bottom: 16px;
  }

  .as-progress-bar__fill { print-color-adjust: exact; -webkit-print-color-adjust: exact; }

  body { font-size: 12pt; color: #000; }

  .as-results__title { font-size: 18pt; }
  .as-result-card__section { font-size: 13pt; }

  .as-profile-sections-detail {
    break-before: page;
    page-break-before: always;
  }
}

/* ── Overall result card accent ────────────────────────────────────────────── */
.as-result-card--overall {
  border-left: var(--as-overall-card-border-width, 4px) solid var(--as-overall-card-accent, #6c63ff);
  background: var(--as-overall-card-bg, #f9f8ff);
  margin-bottom: 24px;
}

/* ── Profile results layout ─────────────────────────────────────────────────── */
.as-profile-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 24px;
  margin-bottom: 24px;
}

/* Spider chart SVG wrapper — replaces circumplex */
.as-spider-wrap {
  background: #fff;
  border: 1px solid var(--as-border);
  border-radius: var(--as-radius);
  padding: 16px;
  box-shadow: var(--as-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}
.as-spider-wrap--bar {
  width: 100%;
  max-width: 100%;
  justify-content: stretch;
  align-items: stretch;
}
.as-bar-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.as-spider-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible; /* labels outside viewBox are still visible */
}

/* Spider chart CSS custom properties (overridable via theme) */
:root {
  --as-spider-axis:              #d1d5db;
  --as-spider-ring:              #e5e7eb;
  --as-spider-ring-label-color:  #9ca3af;
  --as-spider-ring-label-size:   7px;
  --as-spider-fill:              rgba(37,99,235,0.18);
  --as-spider-stroke:            rgba(37,99,235,0.75);
  --as-spider-dot:               #2563eb;
  --as-spider-label-color:       #374151;
  --as-spider-label-size:        9px;
}

/* Profile card */
.as-profile-detail { display: flex; flex-direction: column; gap: 20px; }

.as-profile-card {
  background: #fff;
  border: 1px solid var(--as-border);
  border-radius: var(--as-radius);
  padding: 20px;
  box-shadow: var(--as-shadow);
}
.as-profile-card__intensity {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 10px;
}
.as-intensity--moderate     { background: #dbeafe; color: #1d4ed8; }
.as-intensity--strong       { background: #ede9fe; color: #6d28d9; }
.as-intensity--very-strong  { background: #fce7f3; color: #9d174d; }

.as-profile-card__label {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 10px;
  color: var(--as-text);
  line-height: 1.2;
}
.as-profile-card__description {
  font-size: 14px;
  color: var(--as-muted);
  line-height: 1.6;
  margin: 0 0 12px;
}
.as-profile-card__reco {
  background: var(--as-bg);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  margin-top: 12px;
}
.as-profile-card__reco strong { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--as-muted); margin-bottom: 6px; }
.as-profile-card__reco p { margin: 0; line-height: 1.5; }

/* Dimension bars */
.as-dim-bars {
  background: #fff;
  border: 1px solid var(--as-border);
  border-radius: var(--as-radius);
  padding: 16px;
  box-shadow: var(--as-shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.as-dim-bar__label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}
.as-dim-bar__pct { color: var(--as-primary); }
.as-dim-bar__track {
  height: 28px;
  background: var(--as-border);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}
.as-dim-bar__fill {
  height: 100%;
  background: var(--as-primary);
  border-radius: 5px;
  transition: width .5s ease;
  position: relative;
  display: flex;
  align-items: center;
  min-width: 2px;
}
.as-dim-bar__inner-label {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 20px);
  pointer-events: none;
}
.as-dim-bar__midline {
  display: none;
}
