/**
 * Driver application form - visual polish.
 *
 * Applies to both the /driver/ page form (#lddfw_application_frm) and the
 * shortcode form (.lddfw-sc-form). Styles are scoped so they can't bleed
 * into the rest of the site.
 */

/* Field spacing */
.lddfw_application_frm .lddfw-field,
.lddfw-sc-form .lddfw-field {
  margin-bottom: 18px;
}

/* Labels */
.lddfw_application_frm .lddfw-field > label,
.lddfw-sc-form .lddfw-field > label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: #1f2937;
  margin-bottom: 6px;
}
.lddfw_application_frm .lddfw-req,
.lddfw-sc-form .lddfw-req {
  color: #dc2626;
  margin-left: 2px;
}

/* Inputs, textarea, select - consistent, modern look */
.lddfw_application_frm .lddfw-field input[type="text"],
.lddfw_application_frm .lddfw-field input[type="email"],
.lddfw_application_frm .lddfw-field input[type="tel"],
.lddfw_application_frm .lddfw-field input[type="url"],
.lddfw_application_frm .lddfw-field input[type="number"],
.lddfw_application_frm .lddfw-field input[type="date"],
.lddfw_application_frm .lddfw-field input[type="file"],
.lddfw_application_frm .lddfw-field textarea,
.lddfw_application_frm .lddfw-field select,
.lddfw-sc-form .lddfw-field input[type="text"],
.lddfw-sc-form .lddfw-field input[type="email"],
.lddfw-sc-form .lddfw-field input[type="tel"],
.lddfw-sc-form .lddfw-field input[type="url"],
.lddfw-sc-form .lddfw-field input[type="number"],
.lddfw-sc-form .lddfw-field input[type="date"],
.lddfw-sc-form .lddfw-field input[type="file"],
.lddfw-sc-form .lddfw-field textarea,
.lddfw-sc-form .lddfw-field select {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  line-height: 1.4;
  color: #111827;
  background-color: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.lddfw_application_frm .lddfw-field textarea,
.lddfw-sc-form .lddfw-field textarea {
  min-height: 96px;
  resize: vertical;
}

.lddfw_application_frm .lddfw-field input:focus,
.lddfw_application_frm .lddfw-field textarea:focus,
.lddfw_application_frm .lddfw-field select:focus,
.lddfw-sc-form .lddfw-field input:focus,
.lddfw-sc-form .lddfw-field textarea:focus,
.lddfw-sc-form .lddfw-field select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

/* Help text */
.lddfw_application_frm .lddfw-help,
.lddfw-sc-form .lddfw-help {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-top: 6px;
}

/* Section heading + html block */
.lddfw_application_frm .lddfw-section-heading,
.lddfw-sc-form .lddfw-section-heading {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  margin: 24px 0 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

/* Checkbox / radio groups */
.lddfw_application_frm .lddfw-check-group,
.lddfw_application_frm .lddfw-radio-group,
.lddfw-sc-form .lddfw-check-group,
.lddfw-sc-form .lddfw-radio-group {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0;
  background: #f9fafb;
}
.lddfw_application_frm .lddfw-check-group legend,
.lddfw_application_frm .lddfw-radio-group legend,
.lddfw-sc-form .lddfw-check-group legend,
.lddfw-sc-form .lddfw-radio-group legend {
  padding: 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
}
.lddfw_application_frm .lddfw-check,
.lddfw_application_frm .lddfw-radio,
.lddfw-sc-form .lddfw-check,
.lddfw-sc-form .lddfw-radio {
  display: block;
  padding: 4px 0;
  font-size: 14px;
  color: #374151;
  cursor: pointer;
}

/* ----- Select2 integration -----
 * Match the SIBLING <input>/<select> fields in this form (styled at the top of
 * THIS file). Canonical recipe:
 *   padding 10px 12px; font 15px/1.4; color #111827; border 1px solid #d1d5db;
 *   border-radius 8px; box-shadow 0 1px 2px rgba(0,0,0,.02).
 *
 * Computed box height: 2(border) + 20(v-padding) + 15*1.4(line) = ~43px.
 * We use a fixed height with flex centering on the rendered value so the text
 * sits in the same baseline as a native <input value="...">.
 */

.lddfw_application_frm .select2-container,
.lddfw-sc-form .select2-container {
  width: 100% !important;
  display: block;
  vertical-align: middle;
}

/* Outer selection box - identical box model to the form's <input> / <select>. */
.lddfw_application_frm .select2-container--default .select2-selection--single,
.lddfw-sc-form .select2-container--default .select2-selection--single {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: calc(1.4em + 20px + 2px); /* same math as the sibling inputs */
  min-height: calc(1.4em + 20px + 2px);
  padding: 10px 12px;
  padding-right: 36px; /* reserve room for the caret */
  margin: 0;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.4;
  color: #111827;
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  box-sizing: border-box;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

/* Rendered selected option - zero padding, flex-centered by the parent. */
.lddfw_application_frm
  .select2-container--default
  .select2-selection--single
  .select2-selection__rendered,
.lddfw-sc-form
  .select2-container--default
  .select2-selection--single
  .select2-selection__rendered {
  display: block;
  flex: 1 1 auto;
  padding: 0;
  margin: 0;
  color: #111827;
  font-size: 15px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Placeholder colour - matches native <input>::placeholder in this form. */
.lddfw_application_frm
  .select2-container--default
  .select2-selection--single
  .select2-selection__placeholder,
.lddfw-sc-form
  .select2-container--default
  .select2-selection--single
  .select2-selection__placeholder {
  color: #9ca3af;
}

/* Dropdown arrow - absolutely positioned so it sits cleanly on the right edge. */
.lddfw_application_frm
  .select2-container--default
  .select2-selection--single
  .select2-selection__arrow,
.lddfw-sc-form
  .select2-container--default
  .select2-selection--single
  .select2-selection__arrow {
  position: absolute;
  top: 0;
  right: 10px;
  height: 100%;
  width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lddfw_application_frm
  .select2-container--default
  .select2-selection--single
  .select2-selection__arrow
  b,
.lddfw-sc-form
  .select2-container--default
  .select2-selection--single
  .select2-selection__arrow
  b {
  position: static;
  margin: 0;
  border-color: #6b7280 transparent transparent transparent;
}

/* Allow-clear × sits next to the caret without pushing the text. */
.lddfw_application_frm
  .select2-container--default
  .select2-selection--single
  .select2-selection__clear,
.lddfw-sc-form
  .select2-container--default
  .select2-selection--single
  .select2-selection__clear {
  margin-right: 6px;
  padding: 0 4px;
  color: #6b7280;
  font-weight: 400;
  line-height: 1;
}

/* Focus / open state - identical to the <input>:focus rule above. */
.lddfw_application_frm
  .select2-container--default.select2-container--focus
  .select2-selection--single,
.lddfw_application_frm
  .select2-container--default.select2-container--open
  .select2-selection--single,
.lddfw-sc-form
  .select2-container--default.select2-container--focus
  .select2-selection--single,
.lddfw-sc-form
  .select2-container--default.select2-container--open
  .select2-selection--single {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

/* When open, keep the corners on the side that fuses with the dropdown square
 * so the selection box + dropdown read as a single combobox. */
.lddfw_application_frm
  .select2-container--default.select2-container--open.select2-container--below
  .select2-selection--single,
.lddfw-sc-form
  .select2-container--default.select2-container--open.select2-container--below
  .select2-selection--single {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.lddfw_application_frm
  .select2-container--default.select2-container--open.select2-container--above
  .select2-selection--single,
.lddfw-sc-form
  .select2-container--default.select2-container--open.select2-container--above
  .select2-selection--single {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

/* Dropdown panel - same border colour as the focused control, corners fused on
 * the side that touches the control (so the combobox looks welded together). */
.select2-dropdown {
  border: 1px solid #2563eb;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}
.select2-dropdown.select2-dropdown--below {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-top: 0;
}
.select2-dropdown.select2-dropdown--above {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom: 0;
}

/* Search field inside the dropdown - small version of the form's input. */
.select2-search--dropdown {
  padding: 8px;
}
.select2-search--dropdown .select2-search__field {
  padding: 8px 10px !important;
  font-size: 14px !important;
  line-height: 1.4 !important;
  color: #111827 !important;
  border: 1px solid #d1d5db !important;
  border-radius: 6px !important;
  box-shadow: none !important;
  width: 100% !important;
}
.select2-search--dropdown .select2-search__field:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18) !important;
  outline: 0 !important;
}

/* Results list. */
.select2-results__options {
  font-size: 14px;
  color: #111827;
}
.select2-container--default .select2-results__option {
  padding: 8px 12px;
}
.select2-container--default
  .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted {
  background-color: #2563eb !important;
  color: #fff !important;
}
.select2-container--default .select2-results__option[aria-selected="true"] {
  background-color: #eef2ff;
  color: #1e3a8a;
}

/* ----- jQuery UI datepicker polish (front-end) -----
 * The admin bundles jquery-ui.css; on the /driver/ page we print it too. Add a few tweaks
 * so the picker matches the new form look on the front-end. */
.ui-datepicker {
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
  padding: 6px;
  z-index: 10050 !important; /* sit above the driver panel overlay */
}
.ui-datepicker .ui-datepicker-header {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}
.ui-datepicker .ui-datepicker-calendar .ui-state-default {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  text-align: center;
}
.ui-datepicker .ui-datepicker-calendar .ui-state-highlight,
.ui-datepicker .ui-datepicker-calendar .ui-state-active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}
