/**
 * REZDY BOOKING UI-03 — first-party calendar modal shell.
 * Colors mirror theme tokens ($color-black, $color-cta-blue, $color-blue, borders).
 * Does not style Rezdy iframe internals (cross-origin).
 */

.bh-rezdy-cal-modal {
  position: fixed;
  inset: 0;
  /* Above Rezdy vendor #rzd-modal if it briefly appears before scrub. */
  z-index: 100050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  padding-top: max(12px, env(safe-area-inset-top));
}

.bh-rezdy-cal-modal[hidden] {
  display: none !important;
}

.bh-rezdy-cal-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 40, 58, 0.55);
}

.bh-rezdy-cal-modal__dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: calc(100% - 24px);
  /* Dual-phase default: wide enough for calendar AND booking-details without
     cross-origin checkout detection (targetFrame=_self may not update src). */
  max-width: min(920px, calc(100vw - 24px));
  max-height: min(92dvh, 900px);
  margin: 0 auto;
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid rgba(72, 98, 132, 0.16);
  box-shadow: 0 12px 40px rgba(6, 40, 58, 0.28);
  overflow: hidden;
  transition: max-width 0.2s ease;
}

/* Optional enhancement when diversion sets is-checkout (message-based only). */
.bh-rezdy-cal-modal.is-checkout .bh-rezdy-cal-modal__dialog {
  max-width: min(1100px, calc(100vw - 24px));
  max-height: min(96dvh, 980px);
}

.bh-rezdy-cal-modal.is-checkout .bh-rezdy-cal-modal__frame {
  min-height: 560px;
  height: min(78dvh, 820px);
  max-height: min(78dvh, 820px);
}

/* Prevent Rezdy iframe-resizer from exploding modal height. */
.bh-rezdy-cal-modal__frame {
  max-height: min(78dvh, 820px);
}

.bh-rezdy-cal-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(72, 98, 132, 0.16);
  background: #ffffff;
}

.bh-rezdy-cal-modal__heading {
  min-width: 0;
}

.bh-rezdy-cal-modal__title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
  color: #06283a;
}

.bh-rezdy-cal-modal__subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.35;
  color: #616668;
}

.bh-rezdy-cal-modal__subtitle[hidden] {
  display: none !important;
}

.bh-rezdy-cal-modal__close {
  appearance: none;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  margin: -6px -4px 0 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: #e0f1ff;
  color: #06283a;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.bh-rezdy-cal-modal__close:hover,
.bh-rezdy-cal-modal__close:focus-visible {
  background: #d0e5f1;
  outline: none;
}

.bh-rezdy-cal-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0;
  background: #f8fafc;
}

.bh-rezdy-cal-modal__frame-shell {
  position: relative;
  width: 100%;
  min-height: 420px;
}

.bh-rezdy-cal-modal__loading {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 16px;
  font-size: 14px;
  color: #616668;
  background: #f8fafc;
  pointer-events: none;
}

.bh-rezdy-cal-modal__frame-shell.is-loading .bh-rezdy-cal-modal__loading {
  display: flex;
}

.bh-rezdy-cal-modal__frame {
  display: block;
  width: 100%;
  min-height: 420px;
  height: 560px;
  max-width: 100%;
  border: 0;
  background: #ffffff;
}

.bh-rezdy-cal-modal__footer {
  flex-shrink: 0;
  padding: 10px 16px 14px;
  text-align: center;
  border-top: 1px solid rgba(72, 98, 132, 0.16);
  background: #ffffff;
}

.bh-rezdy-cal-modal__fallback {
  font-size: 13px;
  font-weight: 600;
  color: #016db6;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.bh-rezdy-cal-modal__fallback:hover,
.bh-rezdy-cal-modal__fallback:focus-visible {
  color: #2069df;
}

html.bh-rezdy-cal-modal-open,
html.bh-rezdy-cal-modal-open body {
  overflow: hidden;
}

@media (min-width: 768px) {
  .bh-rezdy-cal-modal {
    padding: 24px;
  }

  .bh-rezdy-cal-modal__dialog {
    width: 100%;
    max-width: min(920px, calc(100vw - 48px));
    max-height: min(88vh, 860px);
  }

  .bh-rezdy-cal-modal.is-checkout .bh-rezdy-cal-modal__dialog {
    max-width: min(1080px, calc(100vw - 48px));
  }

  .bh-rezdy-cal-modal__header {
    padding: 16px 20px 12px;
  }

  .bh-rezdy-cal-modal__title {
    font-size: 20px;
  }

  .bh-rezdy-cal-modal__frame-shell {
    min-height: 480px;
  }

  .bh-rezdy-cal-modal__frame {
    min-height: 480px;
    height: 620px;
  }

  .bh-rezdy-cal-modal__footer {
    padding: 12px 20px 16px;
  }
}

@media (min-width: 1024px) {
  .bh-rezdy-cal-modal__dialog {
    max-width: min(960px, calc(100vw - 48px));
  }

  .bh-rezdy-cal-modal__frame {
    height: 640px;
  }
}
