/* ─── Brand tokens ─────────────────────────────────────────────────────────── */
:root {
  --brand1: #009bd2;
  --brand2: #91be1b;
  --brand3: #d15b05;
  --bg:     #f7fbff;
  --card:   #ffffff;
  --ink:    #0b1723;
  --muted:  #506577;
  --line:   #e5edf5;
}

/* ─── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box }
html, body { height: 100%; margin: 0; padding: 0 }

body {
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu,
               'Helvetica Neue', Arial, sans-serif;
}

/* ─── Layout ───────────────────────────────────────────────────────────────── */
.wrap { max-width: 740px; margin: 0 auto; padding: 16px 12px 40px; }

/* ─── Survey header card ───────────────────────────────────────────────────── */
.survey-header {
  border-radius: 16px 16px 0 0;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom: none;
}
.survey-header img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  display: block;
}
.survey-header-text { padding: 20px 24px 16px; }
.survey-header-text h1 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
}
.survey-header-text p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* ─── Main card ────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 16px 16px;
  box-shadow: 0 6px 18px rgba(20, 40, 70, 0.07);
  padding: 12px !important;
}

/* ─── SurveyJS theme overrides ─────────────────────────────────────────────── */
.sv-root-modern {
  --sjs-general-backcolor:      transparent;
  --sjs-general-forecolor:      var(--ink);
  --sjs-primary-backcolor:      var(--brand1);
  --sjs-primary-backcolor-dark: #0576a8;
  --sjs-base-unit:              6px;
  --sjs-border-default:         var(--line);
  --sjs-shadow-small:           0 4px 12px rgba(20, 40, 70, 0.06);
}

.sv-page__title    { font-size: 16px; font-weight: 800; color: var(--ink); margin-bottom: 2px }
.sv-description    { color: var(--muted) }
.sv-question__title { font-size: 15px }

.sv-footer__complete-btn,
.sv-footer__next-btn {
  border-radius: 10px;
  background: #04A24C;
  color: white;
  font-weight: 800;
}
.sv-footer__prev-btn {
  border-radius: 10px;
  background: #eef4f9;
  color: var(--ink);
  font-weight: 800;
}
.sv-progress { border-radius: 10px; overflow: hidden }

/* Misc SurveyJS fixes */
.sv-list__item                            { list-style: none !important }
.sv-question__header .sv-action-bar,
.sv-question__header .sv-action           { display: none !important }
.sd-row__question                         { padding: 10px !important }
.sd-body                                  { padding: 12px !important; background: #fff }
.sd-error                                 { margin-left: 0 !important; margin-right: 0 !important; width: 100% !important }
.sd-body__navigation .sd-btn              { width: 300px !important }

/* ─── Utility ──────────────────────────────────────────────────────────────── */
.note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
  text-align: center;
}

/* ─── Error box ────────────────────────────────────────────────────────────── */
#errorBox {
  margin-top: 10px;
  padding: 12px;
  border-radius: 8px;
  background: #ffefef;
  color: #8a1f1f;
  font-size: 14px;
  display: none;
}
#errorBox.visible { display: block }

/* ─── Submitting overlay ───────────────────────────────────────────────────── */
#submittingOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.88);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}
#submittingOverlay.active { display: flex }

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--line);
  border-top-color: var(--brand1);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

/* ─── Honeypot (must stay invisible — do not remove) ───────────────────────── */
.hp-field {
  opacity: 0;
  position: absolute;
  top: 0;
  left: 0;
  height: 0;
  width: 0;
  z-index: -1;
  pointer-events: none;
  tab-index: -1;
}

/* ─── Panel section headers (Part I / Part II / About You) ─────────────────── */
.sd-panel__header {
  padding: 20px 0 8px !important;
  border-bottom: 2px solid var(--brand1) !important;
  margin-bottom: 12px !important;
}
.sd-panel__title {
  font-size: 17px !important;
  font-weight: 800 !important;
  color: var(--ink) !important;
  font-style: italic !important;
  text-decoration: underline !important;
}
/* Remove extra panel indent */
.sd-panel__content { padding-left: 0 !important; padding-right: 0 !important; }


/* Outer wrapper: stack labels on top, scale below */
.sd-rating {
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
}

/* Labels row — sits above the numbers */
.sd-rating__labels-container,
.sd-rating__labels {
  display: flex !important;
  justify-content: space-between !important;
  width: 100% !important;
  order: 1 !important;
}

.sd-rating__min-text,
.sd-rating__max-text {
  font-size: 12px !important;
  color: var(--muted) !important;
  font-weight: 500 !important;
  white-space: nowrap !important;
}

/* Numbers row — single row, no wrap */
.sd-rating__items-container,
.sd-rating__items {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 4px !important;
  order: 2 !important;
  width: 100% !important;
  overflow-x: auto !important;
}

/* Individual rating buttons — equal width, compact */
.sd-rating__item {
  flex: 1 1 0 !important;
  min-width: 0 !important;
}

.sd-rating__item .sd-rating__item-text {
  width: 100% !important;
  min-width: 28px !important;
  height: 36px !important;
  font-size: 14px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
}

/* ─── NPS Rating — single row, labels above ────────────────────────────────── */

/* Grid: row1 = [min-label  .  max-label], row2 = [items spans all 3 cols] */
.sd-rating {
  display: grid !important;
  grid-template-areas:
    "minlabel gap maxlabel"
    "items    items items" !important;
  grid-template-columns: auto 1fr auto !important;
  grid-template-rows: auto auto !important;
  gap: 4px 0 !important;
  align-items: end !important;
}

.sd-rating__min-text {
  grid-area: minlabel !important;
  font-size: 12px !important;
  color: var(--muted) !important;
  font-weight: 500 !important;
  white-space: nowrap !important;
  padding-bottom: 2px !important;
}

.sd-rating__max-text {
  grid-area: maxlabel !important;
  font-size: 12px !important;
  color: var(--muted) !important;
  font-weight: 500 !important;
  white-space: nowrap !important;
  padding-bottom: 2px !important;
  text-align: right !important;
}

.sd-rating__items-container,
.sd-rating__items {
  grid-area: items !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 4px !important;
  width: 100% !important;
}

/* Equal-width buttons that stay on one row */
.sd-rating__item {
  flex: 1 1 0 !important;
  min-width: 0 !important;
}

.sd-rating__item-text {
  width: 100% !important;
  min-width: 0 !important;
  height: 36px !important;
  font-size: 14px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 6px !important;
}