/* Modal base */
.modal{position:fixed; inset:0; display:none; z-index:1000;}
.modal[aria-hidden="false"]{display:block;}
.modal__backdrop{position:absolute; inset:0; background:rgba(8,10,16,.6); backdrop-filter:saturate(120%) blur(2px);}
.modal__dialog{
  position:relative; margin:6vh auto; max-width:560px; width:min(92vw,560px);
  background:#fff; color:#0e1116; border-radius:16px; border:1px solid #eef1f4;
  box-shadow:0 20px 80px rgba(15,23,42,.22); padding:20px 18px;
}
@media (max-width:480px){ .modal__dialog{margin:4vh auto; padding:16px 14px;} }

.modal__title{margin:0 0 6px; font-size:22px; letter-spacing:-.01em}
.modal__sub{margin:0 0 14px; color:#667085; font-size:14px}

.modal__close{
  position:absolute; top:8px; right:8px; width:36px; height:36px; border-radius:10px;
  border:1px solid #eef1f4; background:#fff; cursor:pointer; font-size:22px; line-height:1;
}
.modal__close:hover{background:#f6f8fb}

.field{display:flex; flex-direction:column; gap:6px; margin:10px 0}
.field label{font-size:13px; color:#475467}
.field input{
  appearance:none; border:1px solid #e6eaf0; border-radius:12px; padding:10px 12px; font-size:15px;
}
.field input:focus{outline:2px solid #2563eb22; border-color:#2563eb}
.error{color:#b42318; font-size:12px; min-height:14px}

.checks{display:flex; flex-direction:column; gap:8px; margin:12px 0 6px}
.check{display:flex; gap:10px; align-items:flex-start; font-size:14px}
.check input{transform:translateY(2px)}

.modal__actions{display:flex; gap:10px; margin-top:12px}
.form-status{font-size:13px; color:#475467; margin:10px 0 0}
.form-status.success{color:#027a48}
.form-status.error{color:#b42318}

.hp{position:absolute; left:-9999px; opacity:0; pointer-events:none}

.modal__meta{ margin:4px 0; color:#475467; font-size:14px }


/* Book modal options */
.book-options { margin-top: .5rem; }
.option-list { display: grid; gap: .6rem; margin: .8rem 0 1rem; }
.option-item {
  display: flex; align-items: center; justify-content: space-between;
  border: 1px solid #eee; border-radius: 10px; padding: .75rem .9rem; background: #fff;
}
.option-item__label { font-weight: 700; }
.option-item__meta { color: #666; font-size: .9rem; margin-left: .8rem; }
.option-item__btn { white-space: nowrap; }
.option-empty { color: #777; text-align: center; margin: 1rem 0; }

.book-payment .option-summary {
  font-weight: 700;
  margin-bottom: .6rem;
}
#payment-element {
  padding: .8rem;
  border: 1px solid #eee;
  border-radius: 10px;
  background: #fff;
}
#bookPayMsg { display:block; margin-top:.6rem; color:#555; }

.qty { display:flex; align-items:center; gap:.6rem; margin:.6rem 0 .2rem; }
.qty label { font-weight:700; }
.qty-ctl { display:inline-flex; align-items:center; border:1px solid #eee; border-radius:10px; }
.qty-ctl button { border:0; background:#f8f8f8; padding:.4rem .7rem; font-size:1rem; cursor:pointer; }
.qty-ctl input { width:3.5rem; text-align:center; border:0; padding:.35rem 0; }

/* Allow the overlay to scroll on mobile */
.modal{
  overflow: auto;                 /* enable scrolling in the overlay */
  height: 100svh;                 /* mobile-safe viewport height */
  height: 100dvh;                 /* modern browsers */
  -webkit-overflow-scrolling: touch;
}

/* Cap the dialog and make its content scroll if taller than viewport */
.modal__dialog{
  max-height: calc(100svh - 8svh);   /* accounts for top/bottom margin */
  max-height: calc(100dvh - 8svh);
  overflow: auto;                     /* scroll inside the dialog if needed */
  display: flex;                      /* optional: keep footer visible */
  flex-direction: column;
  padding-bottom: max(16px, env(safe-area-inset-bottom)); /* iOS safe area */
}

/* On very small screens, reduce margins so the dialog fits better */
@media (max-width: 480px){
  .modal__dialog{
    margin: 3svh auto;
    max-height: calc(100svh - 6svh);
    max-height: calc(100dvh - 6svh);
  }
}

/* Ensure the Stripe container itself doesn’t force layout weirdly */
#payment-element{
  max-width: 100%;
  overflow: hidden;     /* avoid any inner overflow causing sideways scroll */
}

/* Keep action row from shrinking awkwardly when the dialog scrolls */
.modal__actions{
  margin-top: 12px;
  flex-shrink: 0;
}

/* Tidy summary card above the payment element */
.summary-card{
  border: 1px solid #eef1f4;
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(15,23,42,.04);
  margin-bottom: 12px;
}
.summary-row{
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: .75rem;
  padding: 6px 0;
  border-bottom: 1px dashed #eef1f4;
}
.summary-row:last-of-type{ border-bottom: 0; }
.summary-label{
  color: #475467;
  font-size: 14px;
}
.summary-value{
  font-weight: 600;
  font-size: 15px;
}
.summary-total .summary-label{ font-weight: 700; color:#0e1116; }
.summary-total .summary-value{ font-size: 16px; }

.summary-note{
  margin: 8px 2px 2px;
  font-size: 12.5px;
  color: #475467;
}

/* Align the qty control so it looks native to the UI */
.qty-ctl{
  display:inline-flex; align-items:center;
  border:1px solid #e6eaf0; border-radius:10px; overflow:hidden;
}
.qty-ctl button{
  border:0; background:#f6f8fb; padding:.38rem .65rem;
  font-size:1rem; cursor:pointer;
}
.qty-ctl input{
  width:3.25rem; text-align:center; border:0; padding:.35rem 0; font-size:15px;
}

/* Optional: visually mute the dialog while processing */
.modal.is-processing .modal__dialog{
  filter: blur(.5px);
  pointer-events: none;
}

.book-processing__spinner {
  width: 34px; height: 34px; border-radius: 999px;
  border: 3px solid #e6eaf0; border-top-color: #2563eb;
  animation: bookspin 0.9s linear infinite; margin-bottom: 10px;
}
@keyframes bookspin { to { transform: rotate(360deg); } }

.book-processing__title {
  font-weight: 700; margin: 4px 0 2px; color: #0e1116; font-size: 16px;
}
.book-processing__sub {
  color: #475467; font-size: 13px; line-height: 1.35;
}

/* Optional: button spinner state */
.button[aria-busy="true"] { position: relative; pointer-events: none; }
.button[aria-busy="true"]::after {
  content: ""; position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; border-radius: 999px;
  border: 2px solid #e6eaf0; border-top-color: #2563eb; animation: bookspin 0.9s linear infinite;
}

/* Qty controls inside the options list */
.option-item { gap: .75rem; }
.option-item__right { display:flex; align-items:center; gap:.75rem; }
.option-qty {
  display:inline-flex; align-items:center; border:1px solid #e6eaf0; border-radius:10px; overflow:hidden;
}
.option-qty button{ border:0; background:#f6f8fb; padding:.35rem .6rem; font-size:1rem; cursor:pointer; }
.option-qty input{ width:3rem; text-align:center; border:0; padding:.3rem 0; font-size:15px; }

/* Footer row under the options list */
.option-actions{
  display:flex; align-items:center; justify-content:space-between;
  border-top:1px dashed #eef1f4; padding-top:.8rem; margin-top:.6rem;
}
.option-actions__total .label{ color:#475467; margin-right:.6rem; }
.option-actions__total .value{ font-size:1.05rem; }

/* Processing overlay cart list */
.book-processing__cart { margin-top: .6rem; width: 100%; }
.bp-items { list-style: none; padding: 0; margin: 0; text-align: left; }
.bp-items li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: .5rem;
  padding: .25rem .5rem;
  font-size: 13.5px;
}
.bp-items .bp-total {
  border-top: 1px dashed #e6eaf0;
  margin-top: .25rem;
  padding-top: .4rem;
  font-weight: 700;
}
.bp-item-label { color: #0e1116; }
.bp-item-qty   { color: #475467; }
.bp-item-amt   { font-variant-numeric: tabular-nums; }

/* Ensure the dialog forms the containing block and clips children */
#bookModal .modal__dialog {
  position: relative;          /* anchor absolutely positioned children */
  border-radius: 16px;         /* example */
}

/* Show only when aria-hidden=false (or when not hidden) */
#bookModal .modal__dialog .book-processing[aria-hidden="false"] {
  display: grid;
  place-items: center;
}

/* Also hide when [hidden] is present (belt & braces) */
#bookModal .modal__dialog .book-processing[hidden] {
  display: none !important;
}

/* Contained overlay */
/* Base: inside the dialog but HIDDEN by default */
#bookModal .modal__dialog .book-processing {
  position: absolute;
  inset: 0;
  /* DO NOT set display here */
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(2px);
  z-index: 10;
}

/* page-wide dim/blur */
#bookModal .modal__backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(2px);
}

/* hide when [hidden] is present */
#bookModal .modal__dialog .book-processing[hidden] {
  display: none !important;
}

/* show only when aria-hidden="false" */
#bookModal .modal__dialog .book-processing[aria-hidden="false"] {
  display: grid;
  place-items: center;
}
