/* Call booking widget (assets/js/booking.js).

   Loaded INSIDE the widget's shadow root, not by the page, so nothing here can
   leak out and no page's own CSS (the old site's global button rules included)
   can leak in. The widget therefore looks the same on every page.

   Phone first: one column, full-height sheet. From 720px the calendar and the
   times sit side by side in a centred dialog. */

:host {
  --ink: #194A7A;
  --mid: #476F95;
  --text: #1E293B;
  --soft: #475569;
  --paper: #F1F5F9;
  --line: #DCE3EC;
  --line-strong: #7593AF;
  --card: #FFFFFF;
  --accent: #2E6DB4;
  --accent-t: #E6EFFA;
  --green: #2F7D5B;
  --green-t: #E4F4EC;
  --red: #B91C1C;
  --red-t: #FEF2F2;
  --focus: #B45309;
  --radius: 18px;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;

  all: initial;
  display: block;
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
:host([hidden]) { display: none; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h2, h3, p { margin: 0; }

/* ---- pop-up shell -------------------------------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: rgba(15, 35, 60, .55);
  opacity: 0;
  transition: opacity .18s ease;
}
.overlay.is-open { opacity: 1; }
.dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 100%;
  background: var(--card);
  transform: translateY(16px);
  transition: transform .2s ease;
  overflow: hidden;
}
.overlay.is-open .dialog { transform: none; }
.dialog .scroll { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; flex: 1 1 auto; padding-bottom: env(safe-area-inset-bottom); }
.close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: var(--paper);
}
.close:hover { background: var(--accent-t); }
.close svg { width: 20px; height: 20px; }

@media (min-width: 720px) {
  .overlay { align-items: center; padding: 24px; }
  .dialog { width: min(820px, 100%); max-height: min(720px, 100%); border-radius: var(--radius); box-shadow: 0 30px 80px -20px rgba(15, 35, 60, .5); }
}

/* ---- inline shell -------------------------------------------------------- */

.inline {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-align: left;
}

/* ---- header -------------------------------------------------------------- */

.head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 64px 14px 16px;
  border-bottom: 1px solid var(--line);
}
.inline .head { padding-right: 16px; }
.head img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none; background: var(--paper); }
.head h2 { font-family: var(--display); font-weight: 600; font-size: 21px; line-height: 1.2; color: var(--ink); letter-spacing: -.005em; }
.head p { font-size: 15px; color: var(--soft); margin-top: 2px; }
@media (min-width: 720px) {
  .head { padding: 20px 72px 18px 24px; }
  .inline .head { padding-right: 24px; }
  .head h2 { font-size: 24px; }
}

.body { padding: 16px; }
@media (min-width: 720px) { .body { padding: 24px; } }

/* ---- messages ------------------------------------------------------------ */

.note {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 600;
  background: var(--red-t);
  color: var(--red);
  border: 1px solid #F3C7C7;
}
.empty { padding: 28px 8px; text-align: center; color: var(--soft); }
.empty strong { display: block; color: var(--ink); font-size: 19px; margin-bottom: 6px; }
.empty a { color: var(--ink); font-weight: 700; }
.empty .btn { margin-top: 16px; }

/* ---- step 1: day and time ------------------------------------------------ */

.pick { display: grid; gap: 20px; }
@media (min-width: 720px) {
  .pick { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 28px; align-items: start; }
}

.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-nav h3 { font-family: var(--display); font-weight: 600; font-size: 20px; color: var(--ink); }
.cal-nav button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  border: 1.5px solid var(--line);
  background: var(--card);
}
.cal-nav button:hover:not(:disabled) { border-color: var(--ink); background: var(--paper); }
.cal-nav button:disabled { opacity: .35; cursor: default; }
.cal-nav svg { width: 18px; height: 18px; }

.dow, .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.dow span { text-align: center; font-size: 13px; font-weight: 700; color: var(--soft); padding: 4px 0; text-transform: uppercase; letter-spacing: .04em; }
.day {
  position: relative;
  aspect-ratio: 1 / 1;
  min-height: 44px;
  width: 100%;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-weight: 600;
  font-size: 17px;
  color: #94A3B8;
}
.day:disabled { cursor: default; }
.day.is-open { background: var(--accent-t); color: var(--ink); font-weight: 700; }
.day.is-open:hover { background: #D3E3F7; }
.day.is-today::after { content: ""; position: absolute; bottom: 6px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: currentColor; }
.day.is-picked, .day.is-picked:hover { background: var(--ink); color: #fff; }
.day.is-blank { visibility: hidden; }

.times h3 { font-family: var(--display); font-weight: 600; font-size: 20px; color: var(--ink); margin-bottom: 2px; }
.times .tz { font-size: 14px; color: var(--soft); margin-bottom: 12px; }
.times .part { font-size: 13px; font-weight: 700; color: var(--soft); text-transform: uppercase; letter-spacing: .05em; margin: 14px 0 8px; }
.times .part:first-of-type { margin-top: 0; }
.slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.slot {
  min-height: 48px;
  border-radius: 12px;
  border: 1.5px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
  font-weight: 700;
  font-size: 17px;
  transition: background .12s ease, border-color .12s ease;
}
.slot:hover { border-color: var(--ink); background: var(--accent-t); }
.slot:active { transform: scale(.98); }
@media (min-width: 720px) {
  .times-scroll { max-height: 400px; overflow-y: auto; padding: 4px 6px 4px 4px; margin: -4px -6px -4px -4px; }
}
@media (max-width: 359px) { .slots { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---- step 2: details ----------------------------------------------------- */

.chosen {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 18px;
  border-radius: 14px;
  background: var(--accent-t);
  color: var(--ink);
}
.chosen b { display: block; font-size: 18px; line-height: 1.3; }
.chosen span { font-size: 14px; color: var(--mid); }
.link { color: var(--ink); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; min-height: 44px; padding: 0 6px; flex: none; }
.link:hover { color: var(--accent); }

form { display: grid; gap: 14px; max-width: 520px; }
.field label { display: block; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.field label small { font-weight: 500; color: var(--soft); font-size: 14px; }
.field .hint { font-size: 14px; color: var(--soft); margin-top: 4px; }
.field input, .field textarea {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  font: inherit;
  font-size: 17px;
  color: var(--text);
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 12px;
  appearance: none;
  -webkit-appearance: none;
}
.field textarea { min-height: 84px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--ink); }
.field.is-bad input, .field.is-bad textarea { border-color: var(--red); background: var(--red-t); }
.field .err { color: var(--red); font-weight: 600; font-size: 15px; margin-top: 4px; }
.row { display: grid; gap: 14px; }
@media (min-width: 520px) { .row { grid-template-columns: 1fr 1fr; } }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 26px;
  border-radius: 999px;
  background: var(--ink);
  border: 2px solid var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  line-height: 1.2;
  text-decoration: none;
  transition: background .15s ease, transform .15s ease;
}
.btn:hover { background: var(--mid); border-color: var(--mid); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--paper); border-color: var(--ink); }
.btn.danger { background: var(--red); border-color: var(--red); }
.btn.danger:hover { background: #991B1B; border-color: #991B1B; }
.btn.block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.actions .btn { flex: 1 1 200px; }
.small { font-size: 14px; color: var(--soft); }

.spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- step 3: done -------------------------------------------------------- */

.done { text-align: center; padding: 12px 0 8px; max-width: 480px; margin: 0 auto; }
.done .tick { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; background: var(--green-t); color: var(--green); }
.done .tick svg { width: 32px; height: 32px; }
.done h3 { font-family: var(--display); font-weight: 600; font-size: 26px; color: var(--ink); line-height: 1.2; }
.done .when { font-size: 20px; font-weight: 700; color: var(--ink); margin: 10px 0 2px; }
.done p { margin-top: 10px; color: var(--soft); }
.done .actions { margin-top: 20px; justify-content: center; }

/* ---- loading ------------------------------------------------------------- */

.skeleton { display: grid; gap: 10px; }
.skeleton i { display: block; height: 44px; border-radius: 12px; background: linear-gradient(90deg, var(--paper) 25%, #E8EEF5 50%, var(--paper) 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skeleton i:first-child { width: 50%; height: 28px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .overlay, .dialog, .btn, .slot { transition: none; }
  .dialog { transform: none; }
  .spin, .skeleton i { animation: none; }
}
