:root {
  --ei-blue-dark: #043d5d;
  --ei-blue: #0877a9;
  --ei-cyan: #11a9df;
  --ei-primary: #0b8fc8;
  --ei-primary-dark: #0876a6;
  --ei-ink: #102033;
  --ei-muted: #657487;
  --ei-border: #d8e0e7;
  --ei-card-radius: 22px;
}

html, body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ei-ink);
  background: linear-gradient(135deg, #0b8fc8 0%, #0874a2 48%, #043d5d 100%);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
}

.ei-background-layer {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: var(--ei-background);
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
}

.ei-background-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 50, 78, 0.02) 0%,
    rgba(0, 50, 78, 0.02) 44%,
    rgba(0, 50, 78, 0.16) 66%,
    rgba(0, 50, 78, 0.28) 100%
  );
}

.app-shell {
  max-width: 960px;
  /* Keep the questionnaire high enough in the viewport so the action buttons
     are usually visible without scrolling, while leaving room for the logo. */
  padding-top: clamp(7rem, 16vh, 10rem);
  padding-bottom: 2rem;
}

.mobile-brand {
  display: none;
}

.ei-page-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: .75rem;
}

.ei-new-questionnaire-btn,
.ei-new-questionnaire-btn:visited {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: #fff;
  background: rgba(3, 61, 93, .72);
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 9px;
  padding: .52rem .85rem;
  font-size: .9rem;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(3, 44, 67, .16);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.ei-new-questionnaire-btn:hover,
.ei-new-questionnaire-btn:focus {
  color: #fff;
  background: rgba(11, 143, 200, .92);
  border-color: rgba(255, 255, 255, .82);
}

.ei-new-questionnaire-icon {
  font-size: 1.1rem;
  line-height: 1;
  font-weight: 400;
}

.ei-card {
  background: rgba(255, 255, 255, 0.975);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: var(--ei-card-radius);
  box-shadow: 0 22px 55px rgba(3, 44, 67, 0.24);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow: hidden;
}

.ei-card-body {
  padding: 2.35rem 2.6rem;
}

.ei-card-kicker {
  color: var(--ei-primary);
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
  margin-bottom: .6rem;
}

.ei-card-title {
  margin: 0 0 .75rem;
  font-size: clamp(1.65rem, 3vw, 2.2rem);
  font-weight: 650;
  letter-spacing: -.025em;
}

.ei-card-intro,
.question-description,
.summary-meta {
  color: var(--ei-muted);
}

.question-block {
  padding: .35rem 0;
}

.question-divider {
  border-bottom: 1px solid #e5ebf0;
  padding-bottom: 1.7rem;
  margin-bottom: 1.7rem;
}

.question-title {
  font-size: 1.36rem;
  line-height: 1.3;
  font-weight: 650;
  margin: 0 0 .85rem;
  letter-spacing: -.015em;
}

.answer-option {
  display: flex;
  gap: .9rem;
  align-items: flex-start;
  border: 1px solid var(--ei-border);
  border-radius: 13px;
  padding: .95rem 1rem;
  cursor: pointer;
  background: #fff;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.answer-option:hover {
  border-color: rgba(11, 143, 200, .55);
  box-shadow: 0 5px 18px rgba(4, 61, 93, .08);
  transform: translateY(-1px);
}

.answer-option:has(input:checked) {
  border-color: var(--ei-primary);
  box-shadow: 0 0 0 3px rgba(11, 143, 200, .12);
  background: #f8fdff;
}

.answer-option input {
  margin-top: .25rem;
  accent-color: var(--ei-primary);
}

.answer-copy strong {
  font-weight: 650;
}

.answer-copy small {
  display: block;
  color: var(--ei-muted);
  font-weight: 400;
  margin-top: .18rem;
}

.ei-label {
  font-weight: 600;
}

.ei-input,
.form-control {
  border: 1px solid var(--ei-border);
  border-radius: 10px;
  min-height: 44px;
  box-shadow: none !important;
}

.ei-input:focus,
.form-control:focus {
  border-color: var(--ei-primary);
  box-shadow: 0 0 0 .2rem rgba(11, 143, 200, .11) !important;
}

.slider-wrap {
  display: grid;
  grid-template-columns: 1fr 74px;
  align-items: center;
  gap: 1rem;
}

.form-range::-webkit-slider-thumb {
  background: var(--ei-primary);
}

.form-range::-moz-range-thumb {
  background: var(--ei-primary);
}

.slider-wrap output {
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  padding: .45rem;
  color: var(--ei-primary-dark);
  border: 1px solid var(--ei-border);
  border-radius: 10px;
  background: #f8fbfd;
}

/* Horizontal layout for text questions: label left, input right */
.question-inline {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  align-items: center;
  column-gap: 2rem;
  row-gap: .45rem;
}

.question-inline-copy {
  min-width: 0;
}

.question-inline-label {
  display: block;
  margin: 0;
}

.question-inline-description {
  margin: .35rem 0 0;
}

.question-inline-input {
  display: flex;
  align-items: center;
  min-width: 0;
}

.question-inline-input .form-control {
  margin: 0;
  max-width: 100%;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  padding: 1rem 0 .15rem;
  border-top: 1px solid #e8edf1;

  /* Keep Previous / Next visible when a questionnaire page is taller than
     the browser viewport. */
  position: sticky;
  bottom: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 -10px 18px rgba(16, 32, 51, .04);
}

.ei-btn-primary,
.ei-btn-primary:visited {
  color: #fff;
  background: linear-gradient(135deg, var(--ei-cyan), var(--ei-primary));
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 600;
  padding: .68rem 1.25rem;
  box-shadow: 0 7px 18px rgba(11, 143, 200, .2);
}

.ei-btn-primary:hover,
.ei-btn-primary:focus {
  color: #fff;
  background: linear-gradient(135deg, #0d9ace, var(--ei-primary-dark));
}

.ei-btn-secondary,
.ei-btn-secondary:visited {
  color: #395064;
  background: #fff;
  border: 1px solid #bfcbd5;
  border-radius: 9px;
  font-weight: 600;
  padding: .68rem 1.1rem;
}

.ei-btn-secondary:hover,
.ei-btn-secondary:focus {
  color: var(--ei-primary-dark);
  border-color: var(--ei-primary);
  background: #f8fdff;
}

.result-box {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ei-blue-dark);
  background: linear-gradient(135deg, #f6fbfe, #eef8fc);
  border: 1px solid #d8ebf3;
  border-radius: 14px;
  padding: 1.25rem;
}

.technical-details summary {
  cursor: pointer;
  color: var(--ei-primary-dark);
  font-weight: 600;
}

.ei-error-panel {
  padding: 1.15rem 1.25rem;
  border-radius: 14px;
  background: #fff4f4;
  border: 1px solid #f0c8c8;
  color: #862727;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #17242d;
  color: #f5f8fa;
  padding: 1rem;
  border-radius: 10px;
  font-size: .86rem;
}

.ei-alert {
  border: 0;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(3, 44, 67, .16);
}

.ei-footer {
  color: rgba(255, 255, 255, .72);
  text-align: center;
  font-size: .78rem;
  letter-spacing: .08em;
  padding: 1.25rem 0 0;
}

@media (max-width: 767.98px) {
  .ei-background-layer {
    background-position: 58% top;
  }

  .ei-background-layer::after {
    background: linear-gradient(to bottom, rgba(0, 61, 93, .08), rgba(0, 61, 93, .32));
  }

  .app-shell {
    padding-top: 8.5rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .mobile-brand {
    display: block;
    color: white;
    font-size: .82rem;
    letter-spacing: .11em;
    text-transform: uppercase;
    margin-bottom: 1rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, .25);
  }

  .ei-card-body {
    padding: 1.5rem 1.25rem;
  }

  .question-title {
    font-size: 1.18rem;
  }

  .form-actions {
    flex-wrap: wrap;
  }
}


@media (max-width: 700px) {
  .question-inline {
    grid-template-columns: 1fr;
    align-items: start;
    row-gap: .75rem;
  }

  .question-inline-input {
    width: 100%;
  }
}

@media (max-width: 576px) {
  .ei-page-actions {
    justify-content: stretch;
  }

  .ei-new-questionnaire-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ==========================================================
   DEMO DEVICE PREVIEW MODES
   Browser / iPad / iPhone simulator for sales demos.
   ========================================================== */

.ei-demo-toolbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .45rem;
  padding: .65rem 1rem;
  background: rgba(5, 31, 48, .94);
  border-bottom: 1px solid rgba(255, 255, 255, .16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.ei-demo-toolbar-label {
  color: rgba(255, 255, 255, .72);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-right: .3rem;
}

.ei-device-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, .32);
  background: rgba(255, 255, 255, .08);
  color: #fff;
  border-radius: 8px;
  padding: .42rem .78rem;
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
}

.ei-device-btn:hover,
.ei-device-btn:focus-visible {
  background: rgba(255, 255, 255, .16);
  border-color: rgba(255, 255, 255, .65);
}

.ei-device-btn.active {
  background: var(--ei-primary);
  border-color: var(--ei-cyan);
}

.ei-preview-stage {
  min-height: calc(100vh - 54px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.ei-preview-device {
  position: relative;
  width: 100%;
  transition: width .25s ease, max-width .25s ease, border-radius .25s ease, padding .25s ease;
}

.ei-preview-viewport {
  position: relative;
  min-height: calc(100vh - 54px);
  overflow: visible;
}

.ei-device-top,
.ei-device-home {
  display: none;
}

/* Browser: existing full-screen experience */
.preview-browser .ei-preview-viewport {
  min-height: calc(100vh - 54px);
}

.preview-browser .ei-background-layer {
  position: fixed;
  top: 54px;
  right: 0;
  bottom: 0;
  left: 0;
}

/* Tablet frame, approximately iPad portrait viewport. */
.preview-ipad {
  width: min(860px, calc(100vw - 36px));
  margin: 24px 0 40px;
  padding: 15px;
  border-radius: 34px;
  background: #171b1f;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .34);
}

.preview-ipad .ei-preview-viewport {
  height: min(1080px, calc(100vh - 110px));
  min-height: 720px;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 22px;
  background: var(--ei-blue-dark);
}

.preview-ipad .ei-background-layer,
.preview-iphone .ei-background-layer {
  position: absolute;
  inset: 0;
  min-height: 100%;
  background-attachment: scroll;
}

.preview-ipad .app-shell {
  max-width: 760px;
  padding-top: 7.5rem;
  padding-left: 1.4rem;
  padding-right: 1.4rem;
}

/* Phone frame, approximately modern iPhone portrait viewport. */
.preview-iphone {
  width: min(410px, calc(100vw - 28px));
  margin: 20px 0 40px;
  padding: 10px;
  border-radius: 48px;
  background: #111519;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .38);
}

.preview-iphone .ei-preview-viewport {
  height: min(844px, calc(100vh - 96px));
  min-height: 620px;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 38px;
  background: var(--ei-blue-dark);
  scrollbar-width: thin;
}

.preview-iphone .ei-device-top {
  display: block;
  position: absolute;
  z-index: 30;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 116px;
  height: 31px;
  border-radius: 18px;
  background: #050607;
  pointer-events: none;
}

.preview-iphone .ei-device-camera {
  position: absolute;
  right: 13px;
  top: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #182e3b;
}

.preview-iphone .ei-device-home {
  display: block;
  position: absolute;
  z-index: 31;
  left: 50%;
  bottom: 15px;
  transform: translateX(-50%);
  width: 125px;
  height: 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .9);
  pointer-events: none;
}

/* Force the same responsive layout inside the simulated iPhone even when
   the real desktop browser is wide. */
.preview-iphone .ei-background-layer {
  background-position: 58% top;
}

.preview-iphone .app-shell {
  max-width: none;
  padding-top: 7.6rem;
  padding-left: .85rem;
  padding-right: .85rem;
  padding-bottom: 1.6rem;
}

.preview-iphone .mobile-brand {
  display: block;
  color: white;
  font-size: .72rem;
  letter-spacing: .11em;
  text-transform: uppercase;
  margin-bottom: .8rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}

.preview-iphone .ei-page-actions {
  justify-content: stretch;
}

.preview-iphone .ei-new-questionnaire-btn {
  width: 100%;
  justify-content: center;
  font-size: .82rem;
}

.preview-iphone .ei-card {
  border-radius: 18px;
}

.preview-iphone .ei-card-body {
  padding: 1.3rem 1rem;
}

.preview-iphone .ei-card-kicker {
  font-size: .64rem;
  letter-spacing: .12em;
}

.preview-iphone .ei-card-title {
  font-size: 1.45rem;
}

.preview-iphone .question-title {
  font-size: 1.08rem;
}

.preview-iphone .question-inline {
  grid-template-columns: 1fr;
  align-items: start;
  row-gap: .6rem;
}

.preview-iphone .question-inline-input,
.preview-iphone .question-inline-input .form-control {
  width: 100% !important;
  max-width: 100% !important;
}

.preview-iphone .answer-option {
  padding: .8rem .85rem;
}

.preview-iphone .slider-wrap {
  grid-template-columns: 1fr 60px;
  gap: .65rem;
}

.preview-iphone .form-actions {
  gap: .65rem;
  margin-top: 1.25rem;
  padding-top: .8rem;
}

.preview-iphone .form-actions .btn {
  flex: 1 1 0;
  padding-left: .7rem !important;
  padding-right: .7rem !important;
  white-space: nowrap;
}

.preview-iphone .ei-footer {
  padding-bottom: .8rem;
}

/* Tablet should retain the desktop two-column text field layout unless
   available width becomes genuinely narrow. */
@media (max-width: 900px) {
  .preview-ipad .question-inline {
    grid-template-columns: minmax(190px, 240px) minmax(0, 1fr);
    column-gap: 1.25rem;
  }
}

@media (max-width: 520px) {
  .ei-demo-toolbar-label {
    display: none;
  }

  .ei-demo-toolbar {
    padding-left: .45rem;
    padding-right: .45rem;
  }

  .ei-device-btn {
    flex: 1 1 0;
    padding-left: .45rem;
    padding-right: .45rem;
  }
}

/* ==========================================================
   v10 - Questionnaire typography and compact spacing
   ========================================================== */

/* Make the API questionnaire name (e.g. OFFERTE POLIS NIEUW) more prominent. */
.ei-card-kicker {
  font-size: .94rem;
  font-weight: 700;
  letter-spacing: .11em;
  margin-bottom: .75rem;
}

/* Slightly smaller labels for individual questions. */
.question-title,
.question-inline-label {
  font-size: 1.05rem;
  line-height: 1.25;
  font-weight: 600;
}

/* Bring questions closer together vertically. */
.question-block {
  padding: .15rem 0;
}

.question-divider {
  padding-bottom: 1.05rem;
  margin-bottom: 1.05rem;
}

/* Compact horizontal input rows without changing the two-column layout. */
.question-inline {
  grid-template-columns: minmax(210px, 280px) minmax(0, 1fr);
  column-gap: 1.4rem;
  row-gap: .3rem;
}

.question-inline-description {
  margin-top: .22rem;
}

/* Keep device preview modes visually balanced as well. */
.preview-iphone .ei-card-kicker {
  font-size: .78rem;
  letter-spacing: .1em;
}

.preview-iphone .question-title,
.preview-iphone .question-inline-label {
  font-size: .98rem;
}

.preview-iphone .question-divider {
  padding-bottom: .8rem;
  margin-bottom: .8rem;
}

.preview-ipad .ei-card-kicker {
  font-size: .88rem;
}

/* ==========================================================
   v11 - Use the same branded background inside iPad/iPhone previews
   ========================================================== */

/* The preview viewport becomes the positioning context for the same
   background layer that is used in normal browser mode. */
.preview-ipad .ei-preview-viewport,
.preview-iphone .ei-preview-viewport {
  position: relative;
  background: transparent;
}

/* Re-use exactly the same background image in the simulated devices. */
.preview-ipad .ei-background-layer,
.preview-iphone .ei-background-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  z-index: 0;
  background-image: var(--ei-background);
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: scroll;
}

/* Keep all questionnaire content above the branded background. */
.preview-ipad .app-shell,
.preview-iphone .app-shell {
  position: relative;
  z-index: 2;
}

/* iPad has enough width to retain a composition close to browser mode. */
.preview-ipad .ei-background-layer {
  background-position: center top;
}

/* On iPhone we crop the desktop artwork so that the brighter centre and
   everyoneINVESTED visual remain useful instead of shrinking the full image. */
.preview-iphone .ei-background-layer {
  background-position: 61% top;
}

/* Apply the same subtle readability overlay used in browser mode. */
.preview-ipad .ei-background-layer::after,
.preview-iphone .ei-background-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 50, 78, .03) 0%,
    rgba(0, 50, 78, .05) 42%,
    rgba(0, 50, 78, .18) 72%,
    rgba(0, 50, 78, .30) 100%
  );
  pointer-events: none;
}


/* ==========================================================
   v13 - Dedicated branded background for iPad/iPhone previews
   IMPORTANT: keep the existing v9/v10/v11 class names used by base.html.
   ========================================================== */

/* Use the new portrait artwork only inside simulated devices.
   File expected at:
   questionnaire/static/questionnaire/img/background-mobile.png
*/
.preview-ipad .ei-background-layer,
.preview-iphone .ei-background-layer {
  background-image: url("img/background-mobile.png");
  background-repeat: no-repeat;
  background-attachment: scroll;
  background-color: #064e70;
}

/* iPad: show the upper logo and a generous portion of the artwork. */
.preview-ipad .ei-background-layer {
  background-size: cover;
  background-position: center top;
}

/* iPhone: portrait artwork already matches the aspect ratio well. */
.preview-iphone .ei-background-layer {
  background-size: cover;
  background-position: center top;
}

/* The logo is part of background-mobile.png, so suppress the old textual
   mobile brand in the simulated devices. */
.preview-ipad .mobile-brand,
.preview-iphone .mobile-brand {
  display: none;
}

/* Leave enough space above the white questionnaire card for the logo
   embedded in the new mobile/tablet background. */
.preview-ipad .app-shell {
  padding-top: 11.5rem;
}

.preview-iphone .app-shell {
  padding-top: 8.7rem;
}

/* Keep the generated artwork visible and do not darken it too strongly. */
.preview-ipad .ei-background-layer::after,
.preview-iphone .ei-background-layer::after {
  background: linear-gradient(
    to bottom,
    rgba(0, 48, 75, .00) 0%,
    rgba(0, 48, 75, .00) 35%,
    rgba(0, 48, 75, .08) 70%,
    rgba(0, 48, 75, .18) 100%
  );
}

/* Small-screen safeguard for the simulator itself. */
@media (max-width: 520px) {
  .preview-iphone .app-shell {
    padding-top: 8rem;
  }
}
