/**
 * Styling for webforms shown as a ParentZone dialog box.
 *
 * Lives in the module so the dialog works under every theme. Colours use
 * the active theme's palette, falling back to the Parent Zone defaults.
 *
 * Selectors are scoped to .pz-dialog-box because module CSS always loads
 * before theme CSS; the extra specificity keeps these rules ahead of
 * Bootstrap and theme defaults, as they were when this lived in the theme.
 */

.pz-dialog-box .image_picker_image {
  cursor: pointer;
}

.pz-dialog-box {
  max-width: 671.2px;
  min-width: 671.2px;
  border-radius: 50px;
  background-color: white !important;
  padding: 20px;
  z-index: 9999;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  position: fixed;
  margin: auto;
  height: fit-content;
  box-shadow: 10px 10px 100vw 100vh #37155C22;
}

/* Keep the dialog within the screen and scroll its content when it's taller.
   The 80px leaves the box's 20px padding plus a 20px gap above and below. */
.pz-dialog-box__content {
  max-height: calc(100vh - 80px);
  max-height: calc(100dvh - 80px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Optional title, pinned to the top of the scrolling content. */
.pz-dialog-box .pz-dialog-box__title {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0 0 16px;
  /* Side padding keeps the centred title clear of the close button. */
  padding: 4px 50px 12px;
  background-color: white;
  text-align: center;
  font-size: 26px;
  line-height: 1.25;
  font-weight: bold;
  color: var(--accent-1, #37155C);
}

/* Fade and rise into place when the dialog first opens. dialogbox.js adds the
   class, and not when webform re-renders an already open dialog. */
@keyframes pz-dialog-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.pz-dialog-box--opening {
  animation: pz-dialog-in 0.35s ease-out both;
}

@media (prefers-reduced-motion: reduce) {
  .pz-dialog-box--opening {
    animation: none;
  }
}

.pz-dialog-box ul.thumbnails.image_picker_selector {
  display: flex;
  justify-content: center;
}

.pz-dialog-box div.svg.rateit-large {
  width: 100%;
  justify-content: center;
  display: flex;
}

.pz-dialog-box .ui-dialog-titlebar-close {
  width: 40px;
  height: 40px;
  background-color: transparent;
  border: none;
  padding: 0px;
  font-size: 40px;
  margin: 0px;
  line-height: 20px;
}

.pz-dialog-box .ui-dialog-titlebar-close::after {
  content: '×';
  color: var(--core-color, #8F27F6);
}

.pz-dialog-box.ui-dialog .ui-dialog-titlebar {
  background: none;
  margin: 20px;
}

.pz-dialog-box .ui-widget-content {
  background: none;
  display: flex;
  justify-content: center;
  border-top: transparent;
}

.pz-dialog-box .ui-dialog-title {
  display: none;
}

.pz-dialog-box .ui-widget-header {
  border-bottom: none;
  border: none;
}

/* Regular (non-survey) forms: centre each block in the dialog while keeping
   the text inside it left-aligned, e.g. a checkbox list sits in the middle but
   its options still line up. Full-width fields and panels are unaffected. */
.pz-dialog-box:not(.pz-dialog-box--survey) legend,
.pz-dialog-box:not(.pz-dialog-box--survey) .form-actions {
  text-align: center;
}

.pz-dialog-box:not(.pz-dialog-box--survey) .form-checkboxes,
.pz-dialog-box:not(.pz-dialog-box--survey) .form-radios,
.pz-dialog-box:not(.pz-dialog-box--survey) :not(.form-checkboxes) > .js-form-type-checkbox,
.pz-dialog-box:not(.pz-dialog-box--survey) :not(.form-radios) > .js-form-type-radio,
.pz-dialog-box:not(.pz-dialog-box--survey) .form-inline.form-item {
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* Survey look: big centred questions, custom radios and pill buttons, made for
   one-question-per-page wizard webforms. bil_collapsible_fields_form_alter()
   adds .pz-dialog-box--survey to dialogs for webforms with wizard pages; other
   webforms keep the theme's normal form styling inside the dialog. */
.pz-dialog-box--survey .fieldset__wrapper--group>div {
  display: flex;
  flex-direction: column;
  align-items: start;
}

.pz-dialog-box--survey .form-radio {
  height: 40px;
  width: 20px;
  position: absolute;
  left: 80px;
}

.pz-dialog-box--survey legend {
  width: 100%;
  padding: 0px 100px;
  text-align: center;
  height: auto;
  font-size: 32px;
  color: var(--accent-1, #37155C);
}

.pz-dialog-box--survey label {
  width: 100%;
  padding: 0px 100px;
  text-align: center;
  height: auto;
  font-size: 32px;
  color: var(--accent-1, #37155C);
}

.pz-dialog-box .other-input {
  margin: auto;
  width: 100%;
}

.pz-dialog-box--survey .webform-element-description{
  font-size: 24px;
  margin: 20px 40px;
}

.pz-dialog-box--survey input {
  font-size: 24px;
  height: 50px;
  max-width: 100%;
  width: 450px;
  margin: auto;
  color: var(--accent-1, #37155C);
  border: 2px solid var(--accent-1, #37155C);
}

.pz-dialog-box-multi-select input {
  font-size: 24px;
  height: 20px;
  max-width: none;
  width: 50px;
  margin: auto;
  color: var(--accent-1, #37155C);
  border: 2px solid var(--accent-1, #37155C);
}

.pz-dialog-box-multi-select .checkbox input[type="checkbox"] {
  position: relative;
}

.pz-dialog-box--survey .form-radio::before {
  content: url(../images/answer-unchecked.svg);
  position: absolute;
  height: 20px;
  width: 20px;
  top: 5px;
  left: 0px;
  cursor: pointer;
}

.pz-dialog-box--survey .form-radio:checked::before {
  content: url(../images/answer-checked.svg);
}

.pz-dialog-box .js-webform-image-select {
  height: 0px;
  padding: 0px;
  margin: 0px;
}

.pz-dialog-box .thanks-page {
  padding: 60px;
}

.pz-dialog-box .thanks-page img {
  padding: 30px;
}

.pz-dialog-box .thanks-page h2 {
  text-align: center;
}

.pz-dialog-box .thanks-page .thanks-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pz-dialog-box .thanks-page #closepzdialog,
#closepzdialog2 {
  width: 100%;
  position: inherit;
  text-align: center;
}

.pz-dialog-box--survey .btn-default {
  color: white;
  margin: 5px 50px;
  background-color: var(--core-color, #8F27F6);
  border-radius: 50px;
  font-size: 24px;
  border: none;
  width: 175px;
}

.pz-dialog-box--survey .btn-primary {
  color: white;
  margin: 5px 50px;
  background-color: var(--accent-1, #37155C);
  border-radius: 50px;
  font-size: 24px;
  border: none;
  width: 175px;
}

.pz-dialog-box--survey .form-actions {
  width: 100%;
  text-align: center;
  height: auto;
  font-size: 32px;
}

#closepzdialog {
  color: var(--core-color, #8F27F6);
  font-size: 30px;
  background: none;
  border: none;
  font-weight: bold;
  position: absolute;
  right: 25px;
  z-index: 10;
}

#closepzdialog2 {
  color: var(--core-color, #8F27F6);
  font-size: 24px;
  background: none;
  border: none;
  font-weight: bold;
  position: inherit;
  right: 25px;
}

.pz-dialog-box--survey .btn-primary a {
  color: white;
}

@media screen and (max-width: 672px) {
  .pz-dialog-box {
    max-width: 100%;
    min-width: auto;
  }

  .pz-dialog-box .pz-dialog-box__title {
    padding: 4px 40px 0;
    font-size: 22px;
  }

  .pz-dialog-box--survey .control-label {
    padding: 0px 40px;
    font-size: 18px;
  }

  .pz-dialog-box--survey legend {
    padding: 0px 40px;
    font-size: 20px;
  }

  .pz-dialog-box--survey .form-radio {
    left: 0px;
    top: -5px;
  }

  .pz-dialog-box--survey .btn-default,
  .pz-dialog-box--survey .btn-primary {
    margin: 5px 10px;
    font-size: 15px;
    width: 100px;
  }

  .pz-dialog-box--survey .fieldset__wrapper--group>div {
    margin-left: 40px;
  }

  .pz-dialog-box .thanks-page {
    padding: 10px;
  }

  #closepzdialog2 {
    font-size: 15px;
  }

  .pz-dialog-box--survey .webform-element-description{
    font-size: 12px;
    margin: 10px 30px;
  }
}
