/*!
 * Shared form styles for Dataverse INeKO forms and modern CI templates.
 */

:root {
  /* Input Background and Border */
  --input-background: rgba(255, 255, 255, 0.8);
  --input-border: 1px solid;
  --input-border-color: var(--slate);
  --input-border-radius: 12px;
  --input-padding: .7rem;

  /* Font Settings */
  --input-font-size: 1rem;
  --input-text-color: var(--cool-black);
  --input-placeholder-color: var(--cool-black);

  /* Focus and Transition */
  --input-focus-border: var(--royal);
  --transition-speed: 0.3s;
  --transition-ease: ease;

  /* Layout helpers */
  --field-wrapper-gap: 20px;

  /* Checkbox + radio animation variables */
  --checked-color: var(--royal);
  --unchecked-color: var(--oxford-20);
  --checkbox-height: 1.2rem;
  --background-color: var(--white);
  --duration: 0.2s;

  --radio-checked-color: var(--royal);
  --radio-unchecked-color: var(--oxford-20);
  --radio-height: 1.4rem;
  --radio-background-color: var(--white);
  --radio-duration: var(--duration);
}

/*
 * INeKO form wrapper
 */
.ineko-form__heading {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.ineko-form__intro {
  margin-bottom: 1.5rem;
}

.ineko-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.ineko-form__fields {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 1.5rem 1rem;
}

.ineko-form-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1 1 300px;
  flex-grow: 1;
  flex-shrink: 1;
  flex-basis: 300px;
  min-width: 0;
}

.ineko-form-field.is-hidden,
.ineko-form__group.is-hidden {
  display: none;
}

.ineko-form-field.full {
  flex-basis: 100%;
  max-width: 100%;
}

.ineko-form__hidden-inputs {
  display: none;
}

.ineko-form-field__label {

  font-size: 1rem;
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
}

.ineko-form-field__required {
  color: var(--secondary-red-2);
  font-weight: 700;
}

.ineko-form .ts-wrapper {
  width: 100%;
}

.ineko-form .ts-control {
  background-color: var(--white);
  min-height: 3rem;
}

.ineko-form .ts-dropdown {
  z-index: 40;
}

/* BEGIN floating labels for Dataverse sync forms */
.ineko-form__wrapper .ineko-form-field--floating .ineko-form-field__control {
  position: relative;
}

.ineko-form__wrapper .ineko-form-field--floating .ineko-form-field__label {
  position: absolute;
  left: var(--input-padding);
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  margin: 0;
  transition: top 0.2s ease, transform 0.2s ease, font-size 0.2s ease, color 0.2s ease;
  font-size: 1rem;
  padding: 0 0.35rem;
  background-color: transparent;
  z-index: 30;
}

.ineko-form__wrapper .ineko-form-field--floating textarea+.ineko-form-field__label {
  top: var(--input-padding);
  transform: none;
}

.ineko-form__wrapper .ineko-form-field--floating.is-filled .ineko-form-field__label,
.ineko-form__wrapper .ineko-form-field--floating input:focus+.ineko-form-field__label,
.ineko-form__wrapper .ineko-form-field--floating textarea:focus+.ineko-form-field__label,
.ineko-form__wrapper .ineko-form-field--floating select:focus+.ineko-form-field__label,
.ineko-form__wrapper .ineko-form-field--floating .ts-wrapper.has-items+.ineko-form-field__label,
.ineko-form__wrapper .ineko-form-field--floating .ts-wrapper.input-active+.ineko-form-field__label,
.ineko-form__wrapper .ineko-form-field--floating .ts-wrapper.focus+.ineko-form-field__label {
  top: 0;
  transform: translateY(-50%);
  font-size: 0.85rem;
  color: var(--royal);
  background-color: var(--white);
  border-radius: 8px;
  z-index: 10;
}

/* END floating labels for Dataverse sync forms */

.ci-form p {
  padding: unset;
}

.ineko-form-field__radio,
.ineko-form-field__checkboxes {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

[data-field-name="customer_type"] .ineko-form-field__radio {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 1.5rem 3rem;
}

.ineko-form-field__checkbox {
  display: inline-flex;
  gap: 0.6rem;
  align-items: center;
}

.ineko-form-field__help {
  margin: 0;
  color: var(--oxford);
  font-size: 0.9rem;
}

.ineko-form-field__error {
  min-height: 1.25rem;
  margin: 0;
  color: var(--secondary-red-2);
  font-size: 0.9rem;
}

.ineko-form__messages {
  display: none;
  align-items: flex-start;
  gap: 0.5rem;
  min-height: 1.5rem;
  font-weight: 600;
  transition: color var(--transition-speed) var(--transition-ease);
}

.ineko-form__messages.is-error,
.ineko-form__messages.is-success {
  display: flex;
}

.ineko-form__messages .icon {
  flex: 0 0 1.25rem;
  height: 1.25rem;
  margin-top: 0.1rem;
  line-height: 1;
}

.ineko-form__messages .icon.confirm {
  color: var(--secondary-green-3);
}

.ineko-form__messages .icon.warn {
  color: var(--secondary-red-2);
}

.ineko-form__messages .ineko-form__messages-text {
  flex: 1;
}

.ineko-form__messages.is-success {
  color: var(--secondary-green-3);
}

.ineko-form__messages.is-error {
  color: var(--secondary-red-2);
}

.ineko-form--success-only .ineko-form__fields,
.ineko-form--success-only .ineko-form__hidden-inputs,
.ineko-form--success-only .dp-hint,
.ineko-form--success-only .ineko-form__submit,
.ineko-form--success-only .ineko-form-recaptcha {
  display: none;
}

.ineko-form__submit {
  display: flex;
  justify-content: flex-start;
}

.ineko-form__submit button[type="submit"] {
  min-width: 220px;
}

.ineko-form__suggestion {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background-color: rgba(0, 0, 0, 0.03);
  border-radius: 8px;
  font-size: 0.9rem;
}

.ineko-form__suggestion-button {
  background: none;
  border: none;
  padding: 0.2rem 0.4rem;
  text-decoration: underline;
  cursor: pointer;
  color: inherit;
}

.ineko-form-field--has-error .ineko-form-field__control input,
.ineko-form-field--has-error .ineko-form-field__control textarea,
.ineko-form-field--has-error .ineko-form-field__control select {
  border-color: var(--secondary-red-2);
}

.ineko-form-field--has-error .ts-control {
  border-color: var(--secondary-red-2);
}

.ineko-form-field--has-error .ineko-form-field__label {
  color: var(--secondary-red-2);
}

.ci-form * {
  font-family: 'Inter', sans-serif;
}

.ci-form h2 {
  padding: 2em 0 0 0;
  font-size: 1.5rem;
}

.ci-form h3 {
  padding: 0;
  font-size: 1.2rem;
}

.field-wrapper {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--field-wrapper-gap);
}

.field-wrapper div {
  flex: 1 1 300px;
  min-width: 0;
}

.field-wrapper .full {
  flex-basis: 100%;
  max-width: 100%;
}

.ineko-form__group {
  display: flex;
  width: 100%;
  flex-wrap: wrap;
  gap: .75rem;
}

.choice-heading {
  margin-bottom: 0.35rem;
}

.choice-heading h3 {
  margin: 0;
  font-size: 1.1rem;
}

.widget .field-wrapper div {
  flex-basis: calc(50% - (var(--field-wrapper-gap) / 2));
  min-width: 300px;
}

@media (min-width: 981px) {
  .widget .field-wrapper div {
    flex-basis: 100%;
    min-width: unset;
    max-width: 100%;
  }
}

.input-list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex-grow: 1;
  flex-basis: 320px;
  gap: 10px;
}

.text-area-wrapper {
  width: 100%;
}

.input-list-wrapper {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 30px;
  padding: 2em 0;
}

input[type="text"],
input[type="search"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="checkbox"],
select,
textarea {
  flex: 1;
  border: 1px solid var(--oxford-20);
  font-size: var(--input-font-size);
  color: var(--input-text-color);
  border-radius: var(--input-border-radius);
  background-color: var(--input-background);
  padding: var(--input-padding);
  box-sizing: border-box;
  width: 100%;
  transition: var(--cabg-transition);
  font-family: 'Inter', sans-serif;
}

input[type="checkbox"] {
  width: auto;
  min-width: 0;
  padding: 0;
  border: none;
}

input[type="text"]:focus,
input[type="search"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  border-color: var(--royal);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .15);
}

input[type="search"]::placeholder {
  color: var(--input-placeholder-color) !important;
}

select {
  appearance: none;
  -moz-appearance: none;
  -webkit-appearance: none;
}

.select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.select-wrapper::after {
  content: '\f107';
  font-family: "FontAwesome";
  position: absolute;
  right: 10px;
  top: 1em;
  pointer-events: none;
  font-size: 14px;
  color: #000;
}

.ineko-form-field--is-valid .ineko-form-field__control input,
.ineko-form-field--is-valid .ineko-form-field__control textarea,
.ineko-form-field--is-valid .ineko-form-field__control select {
  box-shadow: unset;
  border-color: var(--secondary-green-3);
}

.ineko-form-field--is-valid .ts-control {
  border-color: var(--secondary-green-3);
}

.ineko-form-field--is-valid .ineko-form-field__label {
  color: var(--secondary-green-3);
}

.icds-form select.form-control.valid {
  box-shadow: unset;
  border-color: var(--secondary-green-3);
}

.icds-form select.error,
.icds-form input.error {
  box-shadow: unset;
  border-color: var(--secondary-red-2);
}

form .error,
.form-error {
  color: var(--secondary-red-2);
}

.icds-form .contact .error {
  color: var(--secondary-red-2);
  font-size: .9em;
}

label.error {
  display: block;
  line-height: 1em;
  padding: 10px 0 0;
}

.heading-checkbox-group {
  font-size: 1.2rem;
  padding: 1em 0 0.5em 0;
}

.checkbox-wrapper {
  display: flex;
  align-items: center;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.checkbox-wrapper__label {
  display: flex;
  align-items: center;
  gap: 15px;
  cursor: pointer;
  width: 100%;
}

.checkbox-wrapper span,
.radio-wrapper span {
  cursor: pointer;
  margin-left: 15px;
}

.checkbox-wrapper__label .toggle-checkbox {
  margin-left: 0;
}

.radio-wrapper {
  display: flex;
  align-items: center;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.radio-wrapper span {
  cursor: pointer;
}

input[type=radio] {
  display: none;
}

.radio-box {
  height: var(--radio-height);
  width: var(--radio-height);
  min-width: var(--radio-height);
  background-color: transparent;
  border: calc(var(--radio-height) * 0.07) solid var(--radio-unchecked-color);
  border-radius: 999px;
  position: relative;
  display: inline-block;
  box-sizing: border-box;
  transition: border-color ease calc(var(--radio-duration) / 2);
  cursor: pointer;
}

.radio-box::before,
.radio-box::after {
  box-sizing: border-box;
  position: absolute;
  height: 0;
  width: calc(var(--radio-height) * 0.2);
  background-color: var(--radio-checked-color);
  display: inline-block;
  transform-origin: left top;
  border-radius: 5px;
  content: ' ';
  transition: opacity ease 0.5s;
}

.radio-box::before {
  top: calc(var(--radio-height) * 0.72);
  left: calc(var(--radio-height) * 0.41);
  box-shadow: 0 0 0 calc(var(--radio-height) * 0.05) var(--radio-background-color);
  transform: rotate(-135deg);
}

.radio-box::after {
  top: calc(var(--radio-height) * 0.37);
  left: calc(var(--radio-height) * 0.05);
  transform: rotate(-45deg);
}

input[type=radio]:checked+.radio-box,
.radio-box.checked {
  border-color: var(--radio-checked-color);
}

input[type=radio]:checked+.radio-box::after,
.radio-box.checked::after {
  height: calc(var(--radio-height) * 0.5);
  animation: dothabottomcheck calc(var(--radio-duration) / 2) ease forwards;
}

input[type=radio]:checked+.radio-box::before,
.radio-box.checked::before {
  height: calc(var(--radio-height) * 1.2);
  animation: dothatopcheck var(--radio-duration) ease forwards;
}

input[type=checkbox] {
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  position: absolute;
}

.check-box {
  height: var(--checkbox-height);
  width: var(--checkbox-height);
  min-width: var(--checkbox-height);
  min-height: var(--checkbox-height);
  background-color: transparent;
  border: calc(var(--checkbox-height) * 0.07) solid var(--unchecked-color);
  border-radius: 2px;
  position: relative;
  display: inline-block;
  box-sizing: border-box;
  transition: border-color ease calc(var(--duration) / 2);
  cursor: pointer;
}

.check-box::before,
.check-box::after {
  box-sizing: border-box;
  position: absolute;
  height: 0;
  width: calc(var(--checkbox-height) * 0.2);
  background-color: var(--checked-color);
  display: inline-block;
  transform-origin: left top;
  border-radius: 5px;
  content: ' ';
  transition: opacity ease 0.5s;
}

.check-box::before {
  top: calc(var(--checkbox-height) * 0.72);
  left: calc(var(--checkbox-height) * 0.41);
  box-shadow: 0 0 0 calc(var(--checkbox-height) * 0.05) var(--background-color);
  transform: rotate(-135deg);
}

.check-box::after {
  top: calc(var(--checkbox-height) * 0.37);
  left: calc(var(--checkbox-height) * 0.05);
  transform: rotate(-45deg);
}

input[type=checkbox]:checked+.check-box,
.check-box.checked {
  border-color: var(--checked-color);
}

input[type=checkbox]:checked+.check-box::after,
.check-box.checked::after {
  height: calc(var(--checkbox-height) * 0.5);
  animation: dothabottomcheck calc(var(--duration) / 2) ease forwards;
}

input[type=checkbox]:checked+.check-box::before,
.check-box.checked::before {
  height: calc(var(--checkbox-height) * 1.2);
  animation: dothatopcheck var(--duration) ease forwards;
}

@keyframes dothabottomcheck {
  0% {
    height: 0;
  }

  50% {
    height: 0;
  }

  100% {
    height: calc(var(--checkbox-height) * 0.5);
  }
}

@keyframes dothatopcheck {
  0% {
    height: 0;
  }

  50% {
    height: 0;
  }

  100% {
    height: calc(var(--checkbox-height) * 1.2);
  }
}