/* =========================
   BASE STYLES (shared)
   Fixes Choices.js search input being styled like normal inputs
   ========================= */

/* General container */
#formio {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  background: #fff;
  border-radius: 12px;
}

body::before {
  content: "";
  display: block;
  height: 48px;
  margin: 1rem auto;
  max-width: 640px;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: left center;
}

/* Labels */
.formio-component label {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
  color: #1a1a1a;
  display: block;
}

/* Inputs + Selects + Textareas
   Exclude Choices.js internal inputs AND exclude checkbox/radio */
.formio-component input:not(.choices__input):not(.choices__input--cloned):not([type="checkbox"]):not([type="radio"]),
.formio-component select,
.formio-component textarea {
  width: 100% !important;
  border: none;
  border-radius: 8px;
  background-color: #f5f7fa;
  padding: 0.9rem 1rem;
  font-size: 1rem;
  color: #333;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.formio-component input:focus:not(.choices__input):not(.choices__input--cloned):not([type="checkbox"]):not([type="radio"]),
.formio-component select:focus,
.formio-component textarea:focus {
  outline: none;
  background-color: #eef2f7;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.25);
}

/* Make checkbox/radio visible and not full-width */
.formio-component input[type="checkbox"],
.formio-component input[type="radio"] {
  width: 18px !important;
  height: 18px !important;
  padding: 0 !important;
  margin: 0.25rem 0.6rem 0 0 !important;
  border: 1px solid #ced4da !important;
  border-radius: 4px;
  background: #fff !important;
  box-shadow: none !important;
  appearance: auto; /* key: undo any “custom input” styling */
}

/* Align the checkbox with its label (Form.io uses Bootstrap-ish markup) */
/* Restore Bootstrap checkbox layout (prevents checkbox being pushed off-screen) */
/* -----------------------------
   Checkboxes / preventing weird Bootstrap positioning
   ----------------------------- */

/* Kill any bootstrap float positioning for checkboxes/radios */
.form-check-input {
  float: none !important;
  margin-left: 0 !important;
}

/* Form.io checkboxes often render input inside the label */
.form-check.checkbox,
.form-check.radio,
.form-check {
  padding-left: 0 !important;
  margin: 0.25rem 0 0.75rem;
}

/* If the input is a sibling of the label, this targets it */
.form-check > input[type="checkbox"],
.form-check > input[type="radio"] {
  margin: 0.2rem 10px 0 0 !important;
}

.formio-component input[type="checkbox"],
.formio-component input[type="radio"] {
  margin: 0 !important;
}



/* Dropdown styling (native select only) */
.formio-component select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,<svg fill='black' height='24' width='24' viewBox='0 0 24 24'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1rem;
}

/* Hide blank first option in native selects */
.formio-component select option[value=""] {
  display: none;
}

/* Hide blank option when Choices.js is applied */
.choices__list .choices__item[data-value=""] {
  display: none !important;
}

/* -----------------------------
   Choices.js search input
   Keep it visible and usable
   ----------------------------- */
.choices__list--dropdown .choices__input--cloned {
  display: block !important;
  width: 100% !important;
  padding: 0.5rem 0.75rem !important;
  border: 1px solid #ced4da !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  color: #333 !important;
  box-shadow: none !important;
  margin: 0.5rem 0.5rem 0.25rem 0.5rem !important;
}

/* Ensure dropdown isn't hidden behind other elements */
.choices__list--dropdown {
  z-index: 9999;
}

/* ===============================
   FIX: Date / DateTime components
   =============================== */

/* Restore inline input + calendar icon layout */
.formio-component-datetime .input-group,
.formio-component-day .input-group,
.formio-component-dateTime .input-group {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
}

/* Let input shrink correctly inside input-group */
.formio-component-datetime .input-group > input,
.formio-component-day .input-group > input,
.formio-component-dateTime .input-group > input {
  width: auto !important;
  flex: 1 1 auto;
}

/* Calendar button container */
.formio-component-datetime .input-group-append,
.formio-component-day .input-group-append,
.formio-component-dateTime .input-group-append {
  display: flex;
}

/* Calendar icon styling */
.formio-component-datetime .input-group-text,
.formio-component-day .input-group-text,
.formio-component-dateTime .input-group-text {
  border: none;
  background-color: #f5f7fa;
  border-radius: 0 8px 8px 0;
  padding: 0 0.9rem;
  display: flex;
  align-items: center;
}

/* Prevent calendar icon from wrapping below */
.formio-component-datetime .input-group-text button,
.formio-component-day .input-group-text button,
.formio-component-dateTime .input-group-text button {
  padding: 0;
  background: transparent;
  border: none;
}

/* Wizard nav */
.formio-wizard-nav-container {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 2rem;
}

.formio-wizard-nav-container .btn {
  border-radius: 8px;
  font-weight: 600;
  padding: 0.8rem 1.5rem;
  font-size: 0.95rem;
  min-width: 120px;
}

/* Primary button */
.btn-primary,
.formio-component .btn.btn-primary {
  background-color: #1a73e8;
  color: #fff;
  border: none;
}

.btn-primary:hover {
  background-color: #1669c1;
}

/* Secondary button */
.btn-secondary,
.formio-component .btn.btn-secondary {
  background-color: #e5e7eb;
  color: #333;
}

.btn-secondary:hover {
  background-color: #d4d6da;
}

/* Responsiveness */
@media (max-width: 768px) {
  #formio {
    padding: 1rem;
  }

  .formio-wizard-nav-container {
    flex-direction: column;
  }

  .formio-wizard-nav-container .btn {
    width: 100%;
  }
}

/* -----------------------------
   Form.io address manual-mode checkbox fix
   (This checkbox sits outside .formio-component)
   ----------------------------- */

/* The wrapper Form.io uses */
.form-check.checkbox {
  display: block !important;
  margin: 0.25rem 0 0.75rem !important;
  padding-left: 0 !important;
}

/* Label contains the input + span */
.form-check.checkbox > .form-check-label {
  display: inline-flex !important;
  align-items: center !important;
  gap: 12px !important;
  margin: 0 !important;
  cursor: pointer;
}

/* The actual checkbox input (your DOM uses .form-check-input) */
.form-check.checkbox > .form-check-label > input.form-check-input[type="checkbox"] {
  width: 18px !important;
  height: 18px !important;
  margin: 0 !important;
  padding: 0 !important;
  flex: 0 0 auto !important;
  appearance: auto !important;
}

/* Prevent the checkbox from inheriting any 100% width rules */
.form-check.checkbox input[type="checkbox"] {
  width: 18px !important;
  max-width: 18px !important;
}

/* Ensure the text sits nicely */
.form-check.checkbox > .form-check-label > span {
  display: inline-block;
}

/* =============================
   FIX: Form.io manual mode checkbox layout
   checkbox on LEFT, text on RIGHT
   ============================= */

.form-check.checkbox {
  padding-left: 0 !important;
  margin: 0.25rem 0 0.75rem !important;
}

/* Label wraps input + span */
.form-check.checkbox > label.form-check-label {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  width: 100% !important;
  margin: 0 !important;
}

/* Kill bootstrap default offsets/positioning */
.form-check.checkbox > label.form-check-label > input.form-check-input {
  position: static !important;
  float: none !important;
  margin: 0 !important;
  width: 18px !important;
  height: 18px !important;
  flex: 0 0 18px !important;
  appearance: auto !important;
}

/* Make sure the text is not doing anything weird */
.form-check.checkbox > label.form-check-label > span {
  display: block !important;
  flex: 1 1 auto !important;
}


