/* The scheduler takes the full width beneath the consultation toolbar. */
.booking-modal {
  padding: max(.5rem, env(safe-area-inset-top)) max(.5rem, env(safe-area-inset-right))
    max(.5rem, env(safe-area-inset-bottom)) max(.5rem, env(safe-area-inset-left));
}

.booking-modal .booking-backdrop {
  background: radial-gradient(ellipse at 50% 8%, rgba(28, 80, 103, .68), rgba(3, 18, 31, .9) 74%);
}

.brevo-booking-dialog {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  width: min(64rem, 100%);
  height: min(58rem, 100%);
  min-width: 0;
  max-height: 100%;
  overflow: hidden;
  border: 1px solid rgba(229, 185, 104, .3);
  border-radius: 1.125rem;
  animation: booking-dialog-enter .2s ease-out;
}

@keyframes booking-dialog-enter {
  from { opacity: 0; transform: translateY(.375rem); }
  to { opacity: 1; transform: none; }
}

.booking-toolbar {
  display: grid;
  grid-template-areas: "heading providers close" "details details details";
  grid-template-columns: minmax(0, 1fr) clamp(20rem, 49vw, 31rem) auto;
  align-items: center;
  gap: .625rem clamp(.625rem, 1.8vw, 1.25rem);
  min-height: 0;
  max-height: calc(var(--viewport-height) * .45);
  padding: .75rem clamp(.75rem, 2vw, 1.375rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-bottom: 1px solid var(--gold);
  background:
    repeating-radial-gradient(ellipse at 95% -45%, transparent 0 1.15rem, rgba(231, 193, 122, .09) 1.19rem 1.23rem, transparent 1.27rem 2.35rem),
    linear-gradient(115deg, #0b2d46 15%, #174c63 69%, #0a293d);
  color: #fff;
}

.booking-heading { grid-area: heading; min-width: 0; }

.booking-heading h2 {
  margin: 0;
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.3125rem, 2.65vw, 1.8125rem);
  font-weight: 600;
  line-height: 1.15;
}

.booking-heading p {
  margin: .1875rem 0 0;
  color: #c5d3db;
  font-size: .875rem;
  line-height: 1.4;
}

.booking-providers {
  grid-area: providers;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem;
}

.booking-providers button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(.375rem, 1vw, .625rem);
  min-width: 0;
  min-height: 56px;
  padding: .375rem .5rem;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: .75rem;
  background: rgba(7, 30, 46, .64);
  color: #fff;
  text-align: left;
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.booking-providers button[aria-pressed="true"] {
  border-color: #f5d498;
  background: #f6e0b7;
  color: #0b2d46;
}

.booking-portrait {
  display: block;
  width: clamp(1.875rem, 4.3vw, 2.75rem);
  height: auto;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 50%;
  background: #c5d3db;
  object-fit: cover;
  object-position: center 28%;
}

.booking-provider-copy { display: grid; min-width: 0; gap: .125rem; }
.booking-providers strong { font-size: .9375rem; line-height: 1.2; }
.booking-providers small { font-size: .8125rem; color: #d9e7ee; line-height: 1.25; }
.booking-providers button[aria-pressed="true"] small { color: #4f4129; }

.booking-provider-check {
  display: grid;
  place-items: center;
  width: 1rem;
  height: 1rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: #a7bbc8;
}

.booking-providers button[aria-pressed="true"] .booking-provider-check {
  border-color: #0b2d46;
  background: #0b2d46;
  color: #fff;
}

.booking-providers button[aria-pressed="true"] .booking-provider-check::after {
  content: "";
  width: .375rem;
  height: .2rem;
  margin-top: -.125rem;
  border: solid currentColor;
  border-width: 0 0 2px 2px;
  transform: rotate(-45deg);
}

.booking-details {
  grid-area: details;
  min-width: 0;
  border-top: 1px solid rgba(255, 255, 255, .22);
  color: #e8f0f5;
  font-size: .875rem;
}

.booking-details summary {
  width: fit-content;
  padding: .5rem .125rem .125rem;
  color: #ffe6b7;
  cursor: pointer;
  font-weight: 700;
}

.booking-details summary::marker { color: #f6d495; }

.booking-toolbar .booking-details p {
  max-width: 72ch;
  margin: .45rem 0 .125rem;
  color: inherit;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.brevo-booking-dialog .booking-close {
  position: static;
  grid-area: close;
  justify-self: end;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: .75rem;
  background: transparent;
  color: #fff;
  font-size: 1.625rem;
  transition: background-color .18s ease, border-color .18s ease;
}

.brevo-frame-shell {
  /* Brevo's transparent page shows this backdrop around its calendar cards. */
  --booking-surface: linear-gradient(135deg, #fff8ee 0%, #f8eedc 56%, #f1e4cb 100%);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  background: var(--booking-surface);
}

.booking-calendar { position: relative; min-height: 0; }

.booking-calendar iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  color-scheme: light;
}

.booking-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .625rem;
  margin: 0;
  background: var(--booking-surface);
  color: #4f616c;
  font-size: .875rem;
  pointer-events: none;
}

.booking-loading::before {
  content: "";
  width: 1.125rem;
  height: 1.125rem;
  border: 2px solid #e7dbc6;
  border-top-color: #8b6529;
  border-radius: 50%;
  animation: booking-loading-spin .75s linear infinite;
}

@keyframes booking-loading-spin { to { transform: rotate(360deg); } }

.booking-calendar-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 .75rem;
  padding: 0 clamp(.75rem, 2vw, 1.25rem);
  border-top: 1px solid #e2cda9;
  background: #f8f0e2;
  color: #4f616c;
  font-size: .8125rem;
}

.booking-calendar-footer a {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  min-height: 44px;
  color: #76531c;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: .2em;
}

.booking-providers button:focus-visible, .brevo-booking-dialog .booking-close:focus-visible, .booking-details summary:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.booking-calendar-footer a:focus-visible { outline-offset: -2px; }
.booking-calendar iframe:focus-visible { outline: 2px solid #9d7128; outline-offset: -2px; }

@media (hover: hover) and (pointer: fine) {
  .booking-providers button[aria-pressed="false"]:hover, .brevo-booking-dialog .booking-close:hover {
    border-color: var(--gold);
    background-color: rgba(229, 185, 104, .13);
  }
  .booking-providers button:hover { transform: translateY(-1px); }
  .booking-details summary:hover { text-decoration: underline; text-underline-offset: .2em; }
}

@media (max-width: 700px) {
  .booking-toolbar {
    grid-template-areas: "heading close" "providers providers" "details details";
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .5rem .625rem;
    padding: .625rem .75rem;
  }
}

@media (max-width: 380px) {
  .booking-providers button { grid-template-columns: auto minmax(0, 1fr); }
  .booking-provider-check { display: none; }
}

@media (max-height: 480px) {
  .booking-toolbar { padding: .375rem .75rem; gap: .25rem .625rem; }
  .booking-providers button { min-height: 44px; }
  .booking-portrait { width: 1.875rem; }
  .booking-details summary { padding-top: .25rem; }
}

@media (min-width: 540px) and (max-width: 700px) and (max-height: 480px) {
  .booking-toolbar {
    grid-template-areas: "heading providers close" "details details details";
    grid-template-columns: minmax(0, 1fr) minmax(16.5rem, 1.5fr) auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .brevo-booking-dialog, .booking-loading::before { animation: none; }
  .booking-providers button, .brevo-booking-dialog .booking-close { transition: none; }
}
