/* ==========================================================================
   Tower Bridge Hospital London — Cookie Consent
   Central modal + preferences. Vanilla, no dependencies.
   Design tokens fall back gracefully if the page's vars are absent.
   ========================================================================== */
:root{
  --tbhcc-navy:#003087;
  --tbhcc-navy-2:#0a1f44;
  --tbhcc-ink:#14181F;
  --tbhcc-muted:#55617a;
  --tbhcc-line:#e3e8f0;
  --tbhcc-panel:#ffffff;
  --tbhcc-tint:#f2f6fc;      /* very pale hospital blue */
  --tbhcc-tint-2:#e9f0fb;
  --tbhcc-radius:18px;
  --tbhcc-radius-sm:12px;
  --tbhcc-shadow:0 30px 80px -24px rgba(2,17,48,.45), 0 8px 24px -12px rgba(2,17,48,.30);
  --tbhcc-font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --tbhcc-serif: 'Fraunces', Georgia, 'Times New Roman', serif;
}

/* ---- Overlay (dim + blur, blocks the page) ------------------------------ */
.tbh-cc{
  position:fixed; inset:0;
  z-index:2147483000;               /* above sticky nav, FABs, WhatsApp */
  display:flex; align-items:center; justify-content:center;
  padding:24px;
  background:rgba(6,17,40,.55);
  -webkit-backdrop-filter:saturate(120%) blur(6px);
  backdrop-filter:saturate(120%) blur(6px);
  opacity:0; visibility:hidden;
  transition:opacity .28s ease, visibility 0s linear .28s;
  font-family:var(--tbhcc-font);
  -webkit-font-smoothing:antialiased;
}
.tbh-cc.is-open{ opacity:1; visibility:visible; transition:opacity .28s ease; }

/* ---- Panel -------------------------------------------------------------- */
.tbh-cc__panel{
  position:relative;
  width:100%; max-width:520px;
  max-height:calc(100vh - 48px);
  display:flex; flex-direction:column;
  background:var(--tbhcc-panel);
  color:var(--tbhcc-ink);
  border:1px solid var(--tbhcc-line);
  border-radius:var(--tbhcc-radius);
  box-shadow:var(--tbhcc-shadow);
  overflow:hidden;
  transform:translateY(14px) scale(.985);
  transition:transform .3s cubic-bezier(.2,.7,.2,1);
}
.tbh-cc.is-open .tbh-cc__panel{ transform:none; }
.tbh-cc__panel--wide{ max-width:600px; }

.tbh-cc__scroll{ overflow-y:auto; -webkit-overflow-scrolling:touch; padding:30px 30px 26px; }

/* ---- Header (icon + title) --------------------------------------------- */
.tbh-cc__icon{
  width:46px; height:46px; border-radius:13px;
  display:flex; align-items:center; justify-content:center;
  background:linear-gradient(160deg, var(--tbhcc-tint-2), var(--tbhcc-tint));
  border:1px solid var(--tbhcc-line);
  margin-bottom:16px;
}
.tbh-cc__icon svg{ width:24px; height:24px; color:var(--tbhcc-navy); }
.tbh-cc__title{
  font-family:var(--tbhcc-serif);
  font-weight:500; font-size:1.5rem; line-height:1.2;
  margin:0 0 10px; color:var(--tbhcc-navy-2);
  letter-spacing:-.01em;
}
.tbh-cc__body{ font-size:.95rem; line-height:1.6; color:var(--tbhcc-muted); margin:0 0 22px; }

/* ---- Buttons ------------------------------------------------------------ */
.tbh-cc__actions{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.tbh-cc__actions .tbh-cc__btn--wide{ grid-column:1 / -1; }
.tbh-cc__btn{
  appearance:none; -webkit-appearance:none; cursor:pointer;
  font-family:inherit; font-weight:600; font-size:.94rem;
  padding:13px 18px; border-radius:11px; border:1.5px solid transparent;
  transition:background .18s ease, color .18s ease, border-color .18s ease, transform .12s ease;
  line-height:1.1; text-align:center;
}
.tbh-cc__btn:active{ transform:translateY(1px); }
.tbh-cc__btn:focus-visible{ outline:3px solid #9dbdf0; outline-offset:2px; }
.tbh-cc__links a:focus-visible,
.tbh-cc__close:focus-visible{ outline:3px solid #9dbdf0; outline-offset:2px; border-radius:6px; }
.tbh-cc__btn--primary{ background:var(--tbhcc-navy); color:#fff; }
.tbh-cc__btn--primary:hover{ background:#00246a; }
.tbh-cc__btn--ghost{ background:#fff; color:var(--tbhcc-navy-2); border-color:var(--tbhcc-line); }
.tbh-cc__btn--ghost:hover{ background:var(--tbhcc-tint); border-color:#c9d6ea; }
.tbh-cc__btn--link{
  background:transparent; color:var(--tbhcc-navy); border:none; padding:12px 8px;
  text-decoration:underline; text-underline-offset:3px; font-weight:600;
}
.tbh-cc__btn--link:hover{ color:#00246a; }

/* Accept-dominant layout: hero primary + quieter (but legible) secondary row */
.tbh-cc__actions--stack{ display:block; }
.tbh-cc__btn--hero{
  display:block; width:100%;
  font-size:1.08rem; font-weight:700;
  padding:17px 20px; border-radius:13px;
  box-shadow:0 10px 24px -12px rgba(0,48,135,.55);
}
.tbh-cc__secondary{
  display:flex; align-items:center; justify-content:center;
  flex-wrap:wrap; gap:4px 8px; margin:14px 0 0;
}
.tbh-cc__sep{ color:var(--tbhcc-line); font-weight:700; }
.tbh-cc__btn--minor{
  background:transparent; border:none;
  padding:8px 10px; border-radius:8px;
  font-size:.85rem; font-weight:600;
  color:var(--tbhcc-muted);            /* legible (~5:1), not pale/low-contrast */
  text-decoration:underline; text-underline-offset:3px;
}
.tbh-cc__btn--minor:hover{ color:var(--tbhcc-navy-2); background:var(--tbhcc-tint); }

.tbh-cc__note{ font-size:.8rem; line-height:1.5; color:var(--tbhcc-muted); margin:18px 0 0; }
.tbh-cc__links{ display:flex; flex-wrap:wrap; gap:6px 18px; margin:14px 0 0; }
.tbh-cc__links a{ font-size:.82rem; color:var(--tbhcc-navy); text-decoration:none; font-weight:600; }
.tbh-cc__links a:hover{ text-decoration:underline; }

/* ---- Preferences categories -------------------------------------------- */
.tbh-cc__prefs{ margin:4px 0 0; }
.tbh-cc__cat{
  display:flex; align-items:flex-start; gap:14px;
  padding:16px 0; border-top:1px solid var(--tbhcc-line);
}
.tbh-cc__cat:first-child{ border-top:none; }
.tbh-cc__cat-text{ flex:1 1 auto; min-width:0; }
.tbh-cc__cat-title{ font-weight:700; font-size:.95rem; color:var(--tbhcc-ink); display:flex; align-items:center; gap:9px; }
.tbh-cc__badge{
  font-size:.62rem; font-weight:700; letter-spacing:.05em; text-transform:uppercase;
  color:#1f7a4d; background:#e7f6ee; padding:3px 8px; border-radius:999px;
}
.tbh-cc__cat-desc{ font-size:.85rem; line-height:1.55; color:var(--tbhcc-muted); margin:5px 0 0; }

/* Toggle switch */
.tbh-cc__switch{ position:relative; flex:0 0 auto; width:46px; height:27px; display:inline-block; }
.tbh-cc__switch input{ position:absolute; opacity:0; width:100%; height:100%; margin:0; cursor:pointer; }
.tbh-cc__track{
  position:absolute; inset:0; border-radius:999px; background:#cdd6e4;
  transition:background .2s ease;
}
.tbh-cc__track::after{
  content:""; position:absolute; top:3px; left:3px; width:21px; height:21px;
  border-radius:50%; background:#fff; box-shadow:0 1px 3px rgba(0,0,0,.25);
  transition:transform .2s ease;
}
.tbh-cc__switch input:checked ~ .tbh-cc__track{ background:var(--tbhcc-navy); }
.tbh-cc__switch input:checked ~ .tbh-cc__track::after{ transform:translateX(19px); }
.tbh-cc__switch input:focus-visible ~ .tbh-cc__track{ outline:3px solid #9dbdf0; outline-offset:2px; }
.tbh-cc__switch input:disabled{ cursor:not-allowed; }
.tbh-cc__switch input:disabled ~ .tbh-cc__track{ background:var(--tbhcc-navy); opacity:.5; }

.tbh-cc__prefs-actions{ display:flex; flex-wrap:wrap; gap:10px; margin:22px 0 0; }
.tbh-cc__prefs-actions .tbh-cc__btn--primary{ flex:1 1 100%; }
.tbh-cc__prefs-actions .tbh-cc__btn--ghost{ flex:1 1 0; }

/* Close (X) — only shown in manage mode */
.tbh-cc__close{
  position:absolute; top:14px; right:14px; z-index:2;
  width:38px; height:38px; border-radius:10px; border:1px solid transparent;
  background:transparent; color:var(--tbhcc-muted); cursor:pointer;
  display:none; align-items:center; justify-content:center;
}
.tbh-cc__close svg{ width:20px; height:20px; pointer-events:none; }
.tbh-cc__close:hover{ background:var(--tbhcc-tint); color:var(--tbhcc-ink); }
.tbh-cc[data-mode="manage"] .tbh-cc__close{ display:flex; }

/* Views */
.tbh-cc__view[hidden]{ display:none; }

/* Discreet footer control injected by JS */
.tbh-cc-settings-link{
  background:none; border:none; padding:0; margin:0; cursor:pointer;
  font:inherit; color:inherit; text-decoration:none;
}
.tbh-cc-settings-link:hover{ text-decoration:underline; }

/* Hide floating action buttons while the consent modal is active */
body.tbh-cc-active .whatsapp-fab,
body.tbh-cc-active .book-fab,
body.tbh-cc-active .call-fab,
body.tbh-cc-active .status-fab{ display:none !important; }
body.tbh-cc-active{ overflow:hidden !important; }

/* ---- Responsive --------------------------------------------------------- */
@media (max-width:520px){
  .tbh-cc{ padding:0; align-items:flex-end; }
  .tbh-cc__panel{
    max-width:100%; width:100%;
    max-height:92vh;
    border-radius:20px 20px 0 0;
    transform:translateY(100%);
  }
  .tbh-cc.is-open .tbh-cc__panel{ transform:none; }
  .tbh-cc__scroll{ padding:26px 20px calc(22px + env(safe-area-inset-bottom)); }
  .tbh-cc__title{ font-size:1.35rem; }
  .tbh-cc__actions{ grid-template-columns:1fr; }
  .tbh-cc__actions .tbh-cc__btn--wide{ grid-column:auto; }
}

/* ---- Dark scheme (respect OS + site) ------------------------------------ */
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    --tbhcc-ink:#eef2f8; --tbhcc-muted:#a9b4c7; --tbhcc-line:#2a3550;
    --tbhcc-panel:#111a2e; --tbhcc-tint:#16233c; --tbhcc-tint-2:#1b2c4a;
    --tbhcc-navy-2:#dbe6ff;
  }
  @media (prefers-color-scheme:dark){
    .tbh-cc__btn--ghost{ background:#16233c; }
  }
}
html.hc-mode .tbh-cc__panel{ border-width:2px; }

/* ---- Reduced motion ----------------------------------------------------- */
@media (prefers-reduced-motion:reduce){
  .tbh-cc, .tbh-cc__panel, .tbh-cc__btn, .tbh-cc__track, .tbh-cc__track::after{
    transition:none !important;
  }
  .tbh-cc__panel{ transform:none !important; }
}
