/**
 * booking-bar.css — the search bar + calendar, lifted out of the 1889 Schoolhouse
 * landing page and made portable.
 *
 * Every colour, radius and font in here comes from a --bb-* custom property, so
 * dropping this into a different B&B is a matter of setting nine variables on
 * the page. Nothing below hard-codes a brand colour.
 *
 * Defaults are deliberately neutral. tenant.js supplies the real ones.
 */

.bb {
  /* ---- the whole theme surface, override these and nothing else ---- */
  --bb-paper: #fff;
  --bb-ink: #1c1c1c;
  --bb-muted: #6b6b6b;
  --bb-line: #e3e3e3;
  --bb-accent: #40675A;
  --bb-accent-ink: #fff;
  --bb-sel: var(--bb-ink);
  --bb-range: rgba(64, 103, 90, .16);
  --bb-radius: 18px;
  --bb-radius-sm: 14px;
  --bb-font: inherit;
  --bb-display: inherit;
  --bb-shadow: 0 18px 44px rgba(9, 45, 35, .18);
  --bb-note: #fff;

  position: relative;
  width: 100%;
  max-width: 940px;
  font-family: var(--bb-font);
}

/* ------------------------------------------------------------------ the bar */

.bb-bar {
  display: flex;
  align-items: stretch;
  background: var(--bb-paper);
  border-radius: var(--bb-radius);
  box-shadow: var(--bb-shadow);
  padding: 8px;
}

.bb-cell {
  flex: 1;
  padding: 14px 20px;
  cursor: pointer;
  border-radius: var(--bb-radius-sm);
  transition: .15s;
  text-shadow: none;
  min-width: 0;
}
.bb-cell:hover { background: color-mix(in oklab, var(--bb-accent) 7%, transparent); }
.bb-cell + .bb-cell { border-left: 1px solid var(--bb-line); }
.bb-cell.is-active { box-shadow: inset 0 0 0 2px var(--bb-ink); }
.bb-cell.is-disabled { opacity: .45; }
.bb-cell.is-disabled:hover { background: transparent; }
.bb-cell.is-flash { box-shadow: inset 0 0 0 2px #b3261e; }

.bb-lab {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--bb-ink);
}
.bb-sub { font-weight: 600; color: var(--bb-muted); font-size: 10px; letter-spacing: .02em; }

.bb-val { font-size: 18px; color: var(--bb-muted); margin-top: 4px; }
.bb-val.is-set { color: var(--bb-ink); font-weight: 600; }

.bb-guests { cursor: default; }
.bb-step { display: flex; align-items: center; gap: 16px; margin-top: 4px; }
.bb-step button {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1.6px solid var(--bb-line); background: var(--bb-paper);
  font-size: 20px; cursor: pointer; color: var(--bb-ink); line-height: 1;
  transition: border-color .15s;
}
.bb-step button:hover { border-color: var(--bb-accent); }
.bb-step button:disabled { opacity: .35; cursor: not-allowed; border-color: var(--bb-line); }
.bb-step b { min-width: 18px; text-align: center; font-size: 19px; font-weight: 700; color: var(--bb-ink); }

.bb-go {
  flex: none;
  margin-left: 8px;
  background: var(--bb-accent);
  color: var(--bb-accent-ink);
  border: none;
  border-radius: var(--bb-radius-sm);
  padding: 0 30px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--bb-font);
  cursor: pointer;
  letter-spacing: .01em;
  transition: filter .15s;
}
.bb-go:hover { filter: brightness(1.1); }

.bb-warn {
  display: none;
  margin-top: 10px;
  background: #fbedea;
  border: 1px solid #e9c4bd;
  color: #9a3526;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
}
.bb-warn.is-shown { display: block; }

.bb-note { color: var(--bb-note); font-size: 15px; margin-top: 14px; font-weight: 500; }
.bb-note b { font-weight: 800; }

/* ------------------------------------------------------------- the calendar */

.bb-backdrop { display: none; }

.bb-pop {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 40;
  width: 360px;
  max-width: 92vw;
  background: var(--bb-paper);
  border: 1px solid var(--bb-line);
  border-radius: var(--bb-radius);
  box-shadow: var(--bb-shadow);
  padding: 16px;
}
.bb-pop.is-open { display: block; }

.bb-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.bb-cal-title { font-family: var(--bb-display); font-size: 16px; font-weight: 600; color: var(--bb-ink); }
.bb-cal-nav {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--bb-line); background: var(--bb-paper);
  cursor: pointer; font-size: 17px; color: var(--bb-ink); line-height: 1;
}
.bb-cal-nav:hover { background: color-mix(in oklab, var(--bb-accent) 8%, transparent); }
.bb-cal-nav:disabled { opacity: .3; cursor: not-allowed; }

.bb-cal-status {
  font-size: 13px; font-weight: 600; color: var(--bb-muted);
  text-align: center; margin: -2px 0 10px;
}
.bb-cal-status.is-ready { color: var(--bb-accent); }

.bb-dow {
  display: grid; grid-template-columns: repeat(7, 1fr); text-align: center;
  font-size: 10.5px; font-weight: 700; color: var(--bb-muted);
  text-transform: uppercase; margin-bottom: 4px;
}
.bb-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }

.bb-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 13px; border-radius: 9px; cursor: pointer; transition: .1s;
  user-select: none; color: var(--bb-ink);
}
.bb-day:hover:not(.is-off):not(.is-booked):not(.is-past),
.bb-day.is-checkout-ok:hover { background: color-mix(in oklab, var(--bb-accent) 10%, transparent); }
.bb-day.is-off { visibility: hidden; }
.bb-day.is-past { color: color-mix(in oklab, var(--bb-muted) 35%, transparent); cursor: not-allowed; }
.bb-day.is-booked { color: #cda9a9; text-decoration: line-through; cursor: not-allowed; }
/* A fully-booked night is still a legal CHECK-OUT: the stay a→b sleeps a … b-1,
   so b itself is never occupied by this guest. */
.bb-day.is-booked.is-checkout-ok {
  color: var(--bb-ink); text-decoration: none; cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--bb-line);
}
.bb-day.is-sel { background: var(--bb-sel) !important; color: var(--bb-paper); font-weight: 600; }
.bb-day.is-range { background: var(--bb-range); }
.bb-day.is-today { box-shadow: inset 0 0 0 1px var(--bb-accent); }

.bb-legend { display: flex; gap: 14px; margin-top: 10px; font-size: 11px; color: var(--bb-muted); flex-wrap: wrap; }
.bb-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 4px; }
.bb-legend .b1 { background: var(--bb-sel); }
.bb-legend .b2 { background: #f0dede; }

.bb-done {
  display: block; width: 100%; margin-top: 12px;
  background: var(--bb-accent); color: var(--bb-accent-ink);
  border: none; border-radius: 11px; padding: 12px;
  font-size: 15px; font-weight: 700; font-family: var(--bb-font); cursor: pointer;
}
.bb-done:hover { filter: brightness(1.08); }

/* ------------------------------------------------------- availability result */

.bb-result {
  display: none;
  margin-top: 14px;
  background: var(--bb-paper);
  border-radius: var(--bb-radius);
  box-shadow: var(--bb-shadow);
  padding: 20px 22px;
  color: var(--bb-ink);
  text-align: left;
}
.bb-result.is-shown { display: block; }
.bb-result-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.bb-result-head h4 { font-family: var(--bb-display); font-size: 21px; font-weight: 600; margin: 0; }
.bb-result-head span { font-size: 14px; color: var(--bb-muted); font-weight: 600; }

.bb-opt {
  display: flex; align-items: center; gap: 16px;
  padding: 13px 0; border-top: 1px solid var(--bb-line);
}
.bb-opt img { width: 74px; height: 60px; object-fit: cover; border-radius: 10px; flex: none; }
.bb-opt-body { flex: 1; min-width: 0; }
.bb-opt-body strong { display: block; font-size: 16px; font-weight: 700; }
.bb-opt-body small { color: var(--bb-muted); font-size: 13px; }
.bb-opt-price { text-align: right; flex: none; }
.bb-opt-price b { display: block; font-size: 18px; font-weight: 800; }
.bb-opt-price small { color: var(--bb-muted); font-size: 12px; }
.bb-opt-pick {
  flex: none; background: var(--bb-accent); color: var(--bb-accent-ink);
  border: none; border-radius: 10px; padding: 11px 18px;
  font-weight: 700; font-size: 14px; font-family: var(--bb-font); cursor: pointer;
}
.bb-opt-pick:hover { filter: brightness(1.1); }
.bb-opt.is-gone { opacity: .45; }
.bb-opt.is-gone .bb-opt-pick { background: var(--bb-line); color: var(--bb-muted); cursor: not-allowed; }

/* ----------------------------------------------------------------- mobile */

/* Was 760, which left an iPad in portrait and a 768 tablet using the desktop
   single-row bar. Five cells and a button need about 780px of min-content, so
   the row blew its grid track out past the viewport by 28px. Everything under a
   real desktop gets the 2x2 grid, which is better for a finger anyway. */
@media (max-width: 899px) {
  .bb-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding: 8px; }
  .bb-cell { padding: 9px 11px; border: 1px solid var(--bb-line); border-radius: 11px; }
  .bb-cell + .bb-cell { border-left: 1px solid var(--bb-line); }
  .bb-lab { font-size: 10.5px; }
  .bb-sub { font-size: 9px; }
  .bb-val { font-size: 15px; }
  .bb-guests { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
  .bb-guests .bb-step { margin-top: 0; gap: 7px; }
  .bb-step button { width: 30px; height: 30px; font-size: 17px; }
  .bb-step b { font-size: 16px; min-width: 12px; }
  /* Nothing in the bar may force the page wider than the screen. */
  .bb-cell, .bb-guests, .bb-step { min-width: 0; }
  .bb-go { grid-column: 1 / -1; margin: 0; padding: 15px; width: auto; font-size: 16px; }
  .bb-note { font-size: 13.5px; }

  /* the calendar becomes a bottom sheet, the way every booking app does it */
  .bb-backdrop.is-open {
    display: block; position: fixed; inset: 0;
    background: rgba(12, 38, 30, .55); z-index: 90;
  }
  .bb-pop {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; max-width: 100%; z-index: 100;
    border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  }
  .bb-grid { gap: 3px; }
  .bb-day { font-size: 16px; border-radius: 11px; }
  .bb-cal-title { font-size: 18px; }
  .bb-cal-status { font-size: 14px; }
  .bb-done { margin-top: 14px; padding: 14px; font-size: 16px; border-radius: 12px; }

  .bb-opt { flex-wrap: wrap; }
  .bb-opt img { width: 56px; height: 48px; }
  .bb-opt-pick { width: 100%; }
}

body.bb-locked { overflow: hidden; }
