/**
 * Wallop Booking Widget Styles
 *
 * Note: This stylesheet uses native CSS nesting (e.g., &.selected).
 * Browser support: Chrome 120+, Safari 17.2+, Firefox 117+.
 * For older browser support, run through a preprocessor or PostCSS.
 */

#wallop-booking-widget {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  z-index: 9999;
  visibility: hidden;
  pointer-events: none;
  font-family: inherit;
}

#wallop-booking-widget.open {
  visibility: visible;
  pointer-events: all;
}

.wb-drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.32s ease;
}

#wallop-booking-widget.open .wb-drawer-overlay {
  opacity: 1;
}

.wb-drawer-content {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 400px;
  height: 100%;
  background: #eee;
  padding: 32px;
  box-sizing: border-box;
  transform: translateX(100%);
  transition:
    transform 0.32s ease,
    visibility 0s linear 0.3s;
  display: flex;
  flex-direction: column;
}

#wallop-booking-widget.open .wb-drawer-content {
  transform: translateX(0);
  transition:
    transform 0.32s ease,
    visibility 0s linear 0s;
}

.wb-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  height: 24px;
}

.wb-location-select {
  cursor: pointer;
}

.wb-close-btn,
.wb-back-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  text-transform: uppercase;
  color: inherit;
  transition: background 0.32s ease;
}

.wb-close-btn:hover,
.wb-back-btn:hover {
  background: #000;
  color: #fff;
}

.wb-close-btn {
  font-size: 24px;
  padding: 0;
}

.wb-title {
  font-size: 32px;
  margin-bottom: 32px;
  line-height: 1.2;
}

.wb-exp-btn {
  display: block;
  width: 100%;
  background: transparent;
  border: 1px solid #000;
  padding: 16px;
  margin-bottom: 16px;
  text-transform: uppercase;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.32s ease;
}

.wb-exp-btn:hover {
  background: #000;
  color: #fff;
}

.wb-field-group {
  margin-bottom: 24px;
}

.wb-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.wb-select-wrapper select {
  width: 100%;
  padding: 8px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 0;
  height: 40px;
}

/* Guest Stepper */
.wb-stepper {
  display: flex;
  align-items: center;
  border: 1px solid #ccc;
  background: #fff;
  width: fit-content;
}

.wb-step-btn {
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: #000;
  display: flex; /* Center the symbol */
  align-items: center;
  justify-content: center;
  transition: background 0.32s ease;
}

.wb-step-btn:hover {
  background-color: #000 !important;
  color: #fff;
}

.wb-guest-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.wb-guest-group .wb-label {
  margin: 0;
}

.wb-guest-input {
  width: 40px;
  height: 40px;
  text-align: center;
  border: none;
  background: #fff;
  color: #000;
  font-size: 16px;
  padding: 0;
  margin: 0;
  display: block;
  opacity: 1;
  -webkit-appearance: none;
  appearance: none;
}

.wb-submit-btn {
  width: 100%;
  background: #ccc;
  color: #000;
  border: none;
  padding: 16px;
  text-transform: uppercase;
  cursor: pointer;
  margin-top: auto;
  transition: background 0.32s ease;
}

.wb-submit-btn:hover {
  background-color: #000 !important;
  color: #fff;
}

.wb-error-message {
  color: red;
  font-size: 12px;
  margin-top: 8px;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .wb-drawer-content {
    transition: none;
    transform: none;
  }
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Flatpickr Overrides */
#wb-calendar-group {
  .flatpickr-calendar {
    margin: 0 auto;
    box-shadow: none;
    background: transparent;
  }

  .flatpickr-day {
    &.selected,
    &.startRange,
    &.endRange {
      background: #ccc;
      border-color: #ccc;
      color: #000;
      box-shadow: none;
    }

    &.inRange {
      background: #ccc;
      border-color: #ccc;
      color: #000;
      box-shadow:
        -5px 0 0 #ccc,
        5px 0 0 #ccc;
    }

    &.startRange {
      box-shadow: 5px 0 0 #ccc;
      z-index: 1;
    }

    &.endRange {
      box-shadow: -5px 0 0 #ccc;
    }
  }

  .flatpickr-current-month {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .flatpickr-monthDropdown-months,
  .numInput {
    min-height: 0;
    height: 100%;
    width: 100%;
    font-size: 16px;
    line-height: 16px;
    text-align: center;
  }

  .numInputWrapper {
    width: 100%;
  }

  .flatpickr-next-month:hover,
  .flatpickr-prev-month:hover {
    svg {
      fill: #000;
    }
  }

  .wb-date-display {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-top: 24px;
    text-transform: uppercase;
  }
}

#wallop-booking-widget .wb-guest-input::-webkit-outer-spin-button,
#wallop-booking-widget .wb-guest-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#wallop-booking-widget :focus {
  outline: none;
}

html.wb-keyboard #wallop-booking-widget :focus {
  outline: 2px dashed currentColor;
  outline-offset: 2px;
}

html.wb-keyboard
  #wallop-booking-widget
  #wb-calendar-input:focus
  + #wb-calendar-mount
  .flatpickr-calendar {
  outline: 2px dashed currentColor;
  outline-offset: 2px;
}

/* Don't show rings on calendar internals (month dropdown, year input, nav arrows, etc) */
html.wb-keyboard #wallop-booking-widget .flatpickr-calendar :focus {
  outline: none;
}

/* BUT DO show a clear focus indicator for the day cells (so arrow navigation is visible) */
html.wb-keyboard #wallop-booking-widget .flatpickr-day:focus {
  outline: 2px dashed currentColor;
  outline-offset: -2px; /* keeps it inside the cell */
}
