//==============================================
// Form selector
//==============================================

// Widget Container

.widget_mybooking_rent_engine_selector {
  width: 100%;
}

/*
 *  Selector form structure
    -----------------------

[form .flex-form]
  [div .flex-form-group-wrapper]    // Controls
    [div .flex-form-group]          // flex-form-group acts as columns or rows
    [/div]
    [div .flex-form-group]
    [/div]
  [/div]
  [div .flex-form-box]              // Search button
  [/div]
[/form]

*/

// == Sidebar adjustements

.page_sidebar .widget_mybooking_rent_engine_selector {
  margin-bottom: 2rem;
}

.page_sidebar .widget_mybooking_rent_engine_selector .flex-form {
  background-color: transparent;
}

// == Horizontal Selector [form class]

.flex-form-box {
  .btn {
    font-size: 1em!important;
    border-radius: var(--btn-border-radius);
    position: relative;
    box-shadow: none;
    background-color: var(--selector-btn-bg-color);
    border-color: var(--selector-btn-border-color);
    color: var(--selector-btn-color);
    &:hover {
      opacity: 0.7;
    }
  }
}

.flex-form {
  display: flex;
  flex-direction: column;
  background-color: var(--selector-bg);
  padding: 10px;
  input:not(.mybooking-search-button), select {
    border: 1px solid var(--gray-500) !important;
    border-radius: 3px;
  }
  label {
    color: var(--selector-label-color);
  }
}

.home .flex-form {
  background-color: var(--home-selector-mobile-bg);
  padding: 0 2rem;
}

// Horizontal Selector on Desktop

@media (min-width: 992px) {
  .home .flex-form {
    background-color: var(--home-selector-bg);
  }
  .home-alone .flex-form {
    // 1 column : Max width 745px
    max-width: 745px;
    margin: 0 auto;
  }

  .home-left .flex-form,
  .home-right .flex-form {
    // 2 columns : Width between 350 and 400px
    max-width: 400px;
    .flex-form-group-wrapper,
    .page-template-mybooking-pages .flex-form-group-wrapper {
      flex-direction: column;
    }
    .flex-form-group:nth-child(2n),
    .page-template-mybooking-pages .flex-form-group:nth-child(2n),
    .flex-form-group:nth-child(3n),
    .page-template-mybooking-pages .flex-form-group:nth-child(3n) {
      margin-left: 0px; // 1 column avoid margin between place and date
    }
    .flex-form-group:last-child,
    .page-template-mybooking-pages .flex-form-group:last-child {
      margin-left: 0px;
    }
  }
}

// == Form group wrapper (wraps the controls)

// Default : 2 columns : place / date - time

.flex-form-group-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-grow: 2;
}

@media (min-width: 575.98px) {
  .flex-form-group-wrapper {
    flex-direction: row; // Controls wrapper : 1 column : place - date - time
  }
}

// == Mybooking Landing template adjustements

.page-template-mybooking-landing .flex-form-group-wrapper {
  flex-direction: column;
}

.page-template-mybooking-landing .flex-form-group:nth-child(2n) {
  margin-left: 0px; // 1 column avoid margin between place and date
}

.page-template-mybooking-landing .flex-form-group:last-child {
  margin-left: 0px;
}

// == Form group (acts as columns -high resolutions- or rows -low resolutions- )

.flex-form-group {
  display: flex;
  flex-grow: 1;
  flex-direction: column;
  /*input.hasDatepicker {
    border-left: none;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }*/
  label {
    font-size: 0.8rem;
  }
}

// Separation between place and date

@media (min-width: 576px) {
  .flex-form-group:nth-child(2n) {
    margin-left: 10px;
  }
  .flex-form-group:last-child {
    // margin-left: 10px;
  }
}

// Horizontal item

.flex-form-item {
  display: flex;
  select {
    display: flex;
    flex-grow: 1;
    width: 100%;
    min-width: 70px;
    border: 1px solid var(--gray-500);
    &:focus {
      border: 1px solid var(--gray-500);
    }
  }
}

.inputWithIcon > input[type="text"] {
  padding-left: 40px;
}
.inputWithIcon {
  position: relative;
  width: 100%;
  display: flex;
  flex-grow: 1;
}

.inputWithIcon i {
  position: absolute;
  left: 0;
  top: 2px;
  padding: 9px 8px;
  color: #9e9e9e;
}

input[name=date_from].form-control[readonly]:not(input[disabled=disabled]),
input[name=date_to].form-control[readonly]:not(input[disabled=disabled]) {
  background-color: #ffffff;
}

// Select wrapper for showing the arrow

.form_selector-select_label_wrap {
  width: 100%;
  margin-bottom: 0;
  position: relative;
}

.form_selector-select_dropdown {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}
.form_selector-select_label_wrap:after {
  content: "\f078";
  font-family: "Font Awesome 5 Free";
  position: absolute;
  right: 0;
  top: 0;
  padding: 10px;
  font-size: 13px;
  z-index: 1;
  width: 38px;
  height: var(--form-control-height);
  pointer-events: none;
  color: var(--gray-700);
  font-weight: 900;
  background-color: var(--white);
  border: 1px solid var(--gray-500);
  border-top-right-radius: 3px;
  border-bottom-right-radius: 3px;
  border-left: none;
}

// == Search button (wraps the search button)

.flex-form-box {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
}

.flex-form-group-no-label {
  flex-direction: row;
  align-items: flex-end !important;
}

.flex-form-group-no-label input {
  margin-left: 10px;
  height: var(--form-control-height); /* To match the input height */
}

// == Sticky behaviour (all controls in a row ALWAYS)

.flex-form-sticky {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--selector-sticky-bg) !important;
  border-radius: 10px;
  position: fixed;
  padding: 1rem;
  margin: 1rem;
  z-index: 10000;
  left: 0;
  right: 0;
  top: 0;
  // Form group
  .mybooking-selector_group {
    flex-direction: row;
    width: auto;
  }

  .mybooking-selector_button-box label {
    display: block;
  }
  // Flex-form-sticky > Search button
  .btn {
    height: var(--form-control-height);
    margin-top: 27px !important;
    position: relative;
    box-shadow: none;
    background-color: var(--selector-btn-sticky-bg-color);
    border-color: var(--selector-btn-sticky-border-color);
    color: var(--selector-btn-color);
    &:hover {
      background-color: var(--selector-btn-hover-bg-color);
      border-color: var(--selector-btn-hover-border-color);
    }
  }

  // Labels
  label {
    font-size: 13px;
    color: var(--selector-sticky-labels-color);
  }
} @media (max-width: 1200px) {
  .flex-form-sticky:has(:nth-child(5)) {
    display: none;
  }
}

// Remove footer row fields from sticky selector
.flex-form-sticky .mybooking-selector_family,
.flex-form-sticky .mybooking-selector_promo {
  display: none;
}

.pickup_place_group,
.return_place_group {
  flex-direction: column;
}

.another_pickup_place_group input {
  border-right: 1px solid var(--error) !important  ;
}

.modal .flex-form {
  background-color: var(--modal-selector-bg);
  border-bottom-left-radius: 0.3rem;
  border-bottom-right-radius: 0.3rem;
  label {
    color: var(--modal-selector-label-color);
  }
}

// Push Date time label errors to the right
#widget_time_from-error,
#widget_time_to-error,
#time_from-error,
#time_to-error {
  display: inline-flex;
  // align-self: flex-end;
}

// Custom delivery
.custom-delivery {
  background-image: none !important;
  padding-right: 30px !important;
}

//==============================================
// Only dates selector rules
//==============================================

.btn-only-dates {
  margin-top: 27px;
}
.flex-form-sticky input.hasDatepicker.only-dates,
.flex-form-group input.hasDatepicker.only-dates {
  max-width: 100%;
  width: 100%;
}
@media (max-width: 575.98px) {
  .flex-form-group input.hasDatepicker.only-dates {
    max-width: 100%;
    width: 100%;
  }
}
@media (min-width: 576px) {
  .flex-form-group:nth-child(3n) {
    margin-left: 10px;
  }
}
