@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;700&family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
  --yellow: #fcbd22;
  --rose: #e56b8a;
  --sage: #83b89b;
  --text: #262626;
  --text-soft: #6b6b6b;
  --grey-bg: #f7f7f7;
  --border: #e3e3e3;
  --border-soft: #efefef;
  --white: #ffffff;
  --warn-bg: #fff8e1;
  --warn-border: #f0d27a;
}

/* All booking-modal styles are scoped to #saharna-booking-modal-root so
   nothing leaks into the parent theme on the accommodation pages. The
   mockup's `body { background: #525866 }` was scaffolding for the
   standalone preview only — REMOVED here. */

#saharna-booking-modal-root, #saharna-booking-modal-root * { box-sizing: border-box; }

/* === Modal-root overlay (only present when modal is open) === */
#saharna-booking-modal-root[hidden] { display: none !important; }
#saharna-booking-modal-root {
  position: fixed; inset: 0;
  background: rgba(38, 41, 50, 0.6);
  backdrop-filter: blur(2px);
  z-index: 99999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
}

@media (max-width: 480px) {
  #saharna-booking-modal-root { padding: 0; overflow: hidden; overscroll-behavior: contain; }
}

#saharna-booking-modal-root .modal {
  background: var(--white);
  width: 100%;
  max-width: 460px;
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.35);
  overflow: hidden;
  margin: 0 auto;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
}
@media (min-width: 480px) and (max-width: 1023px) {
  #saharna-booking-modal-root .modal { max-width: 560px; }
}
@media (min-width: 1024px) {
  #saharna-booking-modal-root .modal { max-width: 920px; }
}

@media (max-width: 480px) {
  #saharna-booking-modal-root .modal {
    border-radius: 0;
    height: 100vh;        /* fallback for older Safari */
    height: 100dvh;       /* dynamic viewport — grows/shrinks with iOS URL bar */
    max-height: 100vh;
    max-height: 100dvh;
  }
  #saharna-booking-modal-root .modal-body {
    overscroll-behavior: contain;   /* prevent scroll-chain to body on iOS */
    -webkit-overflow-scrolling: touch;
  }
}

#saharna-booking-modal-root .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border-soft);
}

#saharna-booking-modal-root .modal-title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 22px;
  margin: 0;
  color: var(--text);
}

#saharna-booking-modal-root .modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--grey-bg);
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-soft);
}

#saharna-booking-modal-root .modal-body {
  padding: 18px 22px 22px;
  overflow-y: auto;
  flex: 1 1 auto;
}

/* Body grid: 1 column on phone/tablet, 2 columns at ≥1024px. Use .grid-span-all to span both columns. */
#saharna-booking-modal-root .modal-body-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
@media (min-width: 1024px) {
  #saharna-booking-modal-root .modal-body-grid {
    grid-template-columns: 1fr 1fr;
    gap: 22px 26px;
    align-items: start;
  }
  #saharna-booking-modal-root .modal-body-grid > .grid-span-all { grid-column: 1 / -1; }
}

#saharna-booking-modal-root .notice {
  background: var(--grey-bg);
  border-left: 3px solid var(--rose);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text);
  border-radius: 6px;
  margin-bottom: 18px;
  line-height: 1.45;
}
#saharna-booking-modal-root .notice strong { color: var(--rose); }

#saharna-booking-modal-root label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
  text-transform: none;
  letter-spacing: normal;
}

#saharna-booking-modal-root input[type="text"],
#saharna-booking-modal-root input[type="email"],
#saharna-booking-modal-root input[type="tel"],
#saharna-booking-modal-root input[type="date"],
#saharna-booking-modal-root input[type="number"],
#saharna-booking-modal-root select {
  width: 100%;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 14px;
  border: 1.5px solid var(--rose);
  border-radius: 999px;
  background: var(--white);
  color: var(--text);
  outline: none;
  box-shadow: none;
}
#saharna-booking-modal-root select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='none' stroke='%23555' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 12px 8px;
}
#saharna-booking-modal-root input:focus,
#saharna-booking-modal-root select:focus { border-color: #c4587a; box-shadow: 0 0 0 3px rgba(229,107,138,0.15); }

#saharna-booking-modal-root .field { margin-bottom: 14px; }
/* margin: 0 defeats parent theme's Bootstrap-style .row negative margins
   that would otherwise pull our inputs past the modal padding. */
#saharna-booking-modal-root .row { display: flex; gap: 10px; margin: 0; }
#saharna-booking-modal-root .row > .field { flex: 1; min-width: 0; }

/* Floating labels — scoped to the top-of-modal client fields only.
   Inputs use placeholder=" " so :placeholder-shown drives the resting state. */
#saharna-booking-modal-root .client-fields .field { position: relative; }
#saharna-booking-modal-root .client-fields .field > label {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  margin: 0;
  padding: 0 6px;
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  color: var(--text-soft);
  background: var(--white);
  pointer-events: none;
  transition: top 0.16s ease, font-size 0.16s ease, font-weight 0.16s ease, color 0.16s ease;
}
/* Float the label when the field has focus, has a value,
   or is a select / date input (those always carry a value or native placeholder). */
#saharna-booking-modal-root .client-fields .field:focus-within > label,
#saharna-booking-modal-root .client-fields .field:has(input:not(:placeholder-shown)) > label,
#saharna-booking-modal-root .client-fields .field:has(select) > label,
#saharna-booking-modal-root .client-fields .field:has(input[type="date"]) > label {
  top: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}
/* Date field: label removed visually (dd/mm/yyyy speaks for itself),
   but kept in DOM for screen readers. */
#saharna-booking-modal-root .client-fields .field[data-field-name="checkin"] > label {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

#saharna-booking-modal-root .section-title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 17px;
  margin: 22px 0 12px;
  color: var(--text);
}
#saharna-booking-modal-root .section-title:first-of-type { margin-top: 12px; }

#saharna-booking-modal-root .btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 13px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  width: 100%;
}
#saharna-booking-modal-root .btn-primary { background: var(--rose); color: var(--white); }
#saharna-booking-modal-root .btn-primary:hover { background: #c4587a; }

#saharna-booking-modal-root .btn-primary[disabled],
#saharna-booking-modal-root .btn-primary.is-submitting {
  opacity: 0.65;
  cursor: not-allowed;
}
#saharna-booking-modal-root .btn-primary.is-submitting::after {
  content: "";
  display: inline-block;
  width: 14px; height: 14px;
  margin-left: 8px;
  border: 2px solid rgba(255,255,255,0.6);
  border-top-color: #fff;
  border-radius: 50%;
  animation: saharna-spin 0.8s linear infinite;
  vertical-align: middle;
}
@keyframes saharna-spin { to { transform: rotate(360deg); } }

#saharna-booking-modal-root .contact-link {
  display: block;
  text-align: center;
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 10px;
}
#saharna-booking-modal-root .contact-link a { color: var(--rose); text-decoration: underline; }

#saharna-booking-modal-root .total-bar {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--grey-bg);
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#saharna-booking-modal-root .total-bar .label {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 700;
}
#saharna-booking-modal-root .total-bar .amount {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

#saharna-booking-modal-root .btn-submit-wrap { margin-top: 16px; }

#saharna-booking-modal-root .inv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
@media (max-width: 479px) {
  #saharna-booking-modal-root .inv-grid {
    grid-template-columns: 1fr;
  }
}
#saharna-booking-modal-root .inv-card {
  display: flex;
  align-items: stretch;
  gap: 10px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 8px 10px 8px 8px;
  cursor: pointer;
  background: var(--white);
  text-align: left;
  font-family: inherit;
  position: relative;
  transition: border-color .15s, background .15s;
}
#saharna-booking-modal-root .inv-card:hover { border-color: var(--rose); background: rgba(229,107,138,0.04); }
#saharna-booking-modal-root .inv-card .name {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.2;
  margin-bottom: 4px;
}
#saharna-booking-modal-root .inv-card .meta { font-size: 11px; color: var(--text-soft); }
#saharna-booking-modal-root .inv-card .from { font-size: 12px; font-weight: 600; margin-top: 6px; }
#saharna-booking-modal-root .inv-card .badge {
  position: absolute;
  top: 6px; right: 8px;
  font-size: 10px;
  padding: 1px 6px;
  background: var(--grey-bg);
  border-radius: 999px;
  color: var(--text-soft);
}
#saharna-booking-modal-root .inv-card.taken {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--grey-bg);
}
#saharna-booking-modal-root .inv-card.taken .badge { background: var(--rose); color: var(--white); }

/* Thumbnail layout inside .inv-card.
   Card becomes a flex row: thumb (3:4, fixed) + body (flex 1).
   Default 60×80; phone steps down to 48×64. */
#saharna-booking-modal-root .inv-thumb {
  flex: 0 0 60px;
  width: 60px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--grey-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
#saharna-booking-modal-root .inv-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
#saharna-booking-modal-root .inv-thumb-empty {
  background: linear-gradient(135deg, #ECE7DD 0%, #d8d2c4 100%);
}
#saharna-booking-modal-root .inv-thumb-monogram {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-soft);
}
#saharna-booking-modal-root .inv-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1 1 auto;
  min-width: 0;
}

@media (max-width: 479px) {
  #saharna-booking-modal-root .inv-thumb {
    flex: 0 0 48px;
    width: 48px;
    height: 64px;
  }
  #saharna-booking-modal-root .inv-thumb-monogram { font-size: 15px; }
}

#saharna-booking-modal-root .inv-card.sauna { border-color: rgba(131,184,155,0.5); }
#saharna-booking-modal-root .inv-card.sauna .name { color: var(--sage); }

#saharna-booking-modal-root .selected-card {
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
  position: relative;
}
#saharna-booking-modal-root .selected-card .remove {
  position: absolute;
  top: 10px; right: 10px;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
#saharna-booking-modal-root .selected-card .remove:hover {
  background: #b42318;
  border-color: #b42318;
  color: #fff;
}
#saharna-booking-modal-root .selected-card .head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
  padding-right: 38px;
}
#saharna-booking-modal-root .selected-card .head .price { white-space: nowrap; font-weight: 600; font-size: 13px; }
#saharna-booking-modal-root .selected-card .head .title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 14px;
}
#saharna-booking-modal-root .selected-card.sauna { border-color: var(--sage); }
#saharna-booking-modal-root .selected-card.sauna .title { color: var(--sage); }

/* === Success state === */
#saharna-booking-modal-root .success-state {
  text-align: center;
  padding: 30px 20px 10px;
}
#saharna-booking-modal-root .success-state .check {
  width: 60px; height: 60px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--rose);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
}
#saharna-booking-modal-root .success-state h3 { color: var(--rose); }
#saharna-booking-modal-root .success-state h3 {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  margin: 0 0 10px;
}
#saharna-booking-modal-root .success-state p {
  font-size: 14px;
  color: var(--text-soft);
  margin: 0 0 22px;
  line-height: 1.5;
}

/* === Error banner === */
#saharna-booking-modal-root .error-banner {
  background: #fde8e8;
  border: 1px solid #f5b5b5;
  color: #8a1f1f;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
  line-height: 1.4;
}
#saharna-booking-modal-root .error-banner a { color: inherit; text-decoration: underline; }

/* === Per-field validation message === */
#saharna-booking-modal-root .field.has-error input,
#saharna-booking-modal-root .field.has-error select { border-color: #c84f4f; }
#saharna-booking-modal-root .field-error {
  font-size: 11px;
  color: #c84f4f;
  margin-top: 4px;
}

/* === Empty selection — Total bar shows zero === */
#saharna-booking-modal-root .selected-empty .total-bar { color: var(--text-soft); }

/* === Tier chip row inside .selected-card =================== */
#saharna-booking-modal-root .tier-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
#saharna-booking-modal-root .tier-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
#saharna-booking-modal-root .tier-chip {
  flex: 0 1 auto;
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  line-height: 1;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
#saharna-booking-modal-root .tier-chip:hover {
  border-color: var(--rose);
  color: var(--rose);
}
#saharna-booking-modal-root .tier-chip.is-active {
  background: var(--rose);
  border-color: var(--rose);
  color: var(--white);
}
#saharna-booking-modal-root .tier-chip.is-active:hover {
  background: #c4587a;
  border-color: #c4587a;
  color: var(--white);
}
#saharna-booking-modal-root .tier-chip.is-warn::after {
  content: ' ⚠';
  margin-left: 4px;
  color: #d2741b;
}
#saharna-booking-modal-root .tier-chip.is-active.is-warn::after {
  color: #fff;
}

/* Long/short label switch — long visible by default; phone shows short */
#saharna-booking-modal-root .tier-chip-short { display: none; }
@media (max-width: 479px) {
  #saharna-booking-modal-root .tier-chip-long  { display: none; }
  #saharna-booking-modal-root .tier-chip-short { display: inline; }
  #saharna-booking-modal-root .tier-chip { padding: 7px 11px; font-size: 12px; }
}

/* Sauna's selected card — chips lean sage rather than rose */
#saharna-booking-modal-root .selected-card.sauna .tier-chip:hover {
  border-color: var(--sage);
  color: var(--sage);
}
#saharna-booking-modal-root .selected-card.sauna .tier-chip.is-active {
  background: var(--sage);
  border-color: var(--sage);
  color: var(--white);
}
#saharna-booking-modal-root .selected-card.sauna .tier-chip.is-active:hover {
  background: #5e8d76;
  border-color: #5e8d76;
}

/* === Sticky header & footer on phone ============= */
/* Sticky-footer is rendered always but only displays at <480px. */
#saharna-booking-modal-root .sticky-footer {
  display: none;
}
@media (max-width: 479px) {
  #saharna-booking-modal-root .sticky-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: var(--white);
    border-top: 1px solid var(--border);
    position: sticky;
    bottom: 0;
    flex: 0 0 auto;
    z-index: 5;
  }
  #saharna-booking-modal-root .sticky-total {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
  }
  #saharna-booking-modal-root .sticky-total-label {
    font-size: 11px;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }
  #saharna-booking-modal-root .sticky-total-amount {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 18px;
  }
  #saharna-booking-modal-root .sticky-submit {
    flex: 1 1 auto;
    width: auto;
    padding: 11px 16px;
    font-size: 13px;
  }

  /* Hide the inline total + submit (they'd duplicate the sticky pair) */
  #saharna-booking-modal-root .col-selection .total-bar { display: none; }
  #saharna-booking-modal-root .col-selection .btn-submit-wrap { display: none; }

  /* Sticky header */
  #saharna-booking-modal-root .modal-header {
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 5;
  }
}
