/* Appointment SPA — same visual language as the other Quality Board apps,
   amber accent matching the appointment card on qualityboard.org */

:root {
  --brand: #b7791f;
  --brand-2: #9c6514;
  --brand-3: #c97b1f;
  --brand-soft: #fbeee0;
  --brand-line: #e8c48f;
  --ink: #20242b;
  --muted: #6b7280;
  --line: #e5e7eb;
  --holiday: #b3261e;
  --holiday-bg: #fdeceb;
  --weekend-bg: #f4f5f7;
}

* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #fdfaf5;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------- header (sticky, wraps to 2 lines on mobile like TenaLink) ---------- */
header {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(180deg, #c97b1f 0%, #a8640f 100%);
  color: #fff; padding: 1rem 1.5rem;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
header h1 { font-size: 1.4rem; display: flex; align-items: center; gap: .5rem; }
.logo-tile {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: #fff; border: 2px solid #a8640f; font-size: 17px;
}
.header-left { display: flex; align-items: center; gap: .6rem; }
.header-right { display: flex; gap: 1rem; align-items: center; }
#user-badge { display: flex; gap: .8rem; align-items: center; font-size: .9rem; }
#user-info { color: #f5e7d2; }

#guest-nav { display: flex; gap: .6rem; align-items: center; }
#guest-nav .small {
  background: none; border: none; color: #f5e7d2; font-size: .95rem;
  text-decoration: underline; text-underline-offset: 3px; padding: .3rem .4rem;
  border-radius: 4px; cursor: pointer;
}
#guest-nav .small:hover { color: #fff; background: rgba(255,255,255,.15); text-decoration: none; }
#logout-btn { color: #f5e7d2; border-color: rgba(255,255,255,.45); }
#logout-btn:hover { color: #fff; border-color: #fff; background: rgba(255,255,255,.12); }

.back-qb {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; margin-left: 1rem; border-radius: 999px;
  color: #f5e7d2; border: 1px solid rgba(255,255,255,.35);
  font-size: .72rem; text-decoration: none; white-space: nowrap;
  vertical-align: middle;
}
.back-qb:hover { color: #fff; border-color: #fff; text-decoration: none; }

main { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }

/* ---------- hero / landing ---------- */
.hero { text-align: center; padding: 3rem 1rem; }
.hero h2 { font-size: 2.2rem; line-height: 1.2; color: #6b4a10; }
.hero .accent { color: var(--brand-3); }
.tagline { margin: 1rem auto 1.5rem; max-width: 560px; color: #4a5568; }
.cta-row { display: flex; gap: .8rem; justify-content: center; align-items: center; flex-wrap: wrap; margin: 1rem 0; }

.demo-row { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; margin-top: 1.2rem; }
.demo-chip {
  font-size: .8rem; font-weight: 600; color: var(--brand);
  background: var(--brand-soft); border: 1px dashed var(--brand);
  border-radius: 999px; padding: 6px 16px;
}
.demo-chip:hover { background: #f5e2c8; }

/* ---------- buttons / tabs / cards ---------- */
button {
  background: var(--brand); color: #fff; border: none; border-radius: 8px;
  padding: .6rem 1.1rem; font-size: .95rem; cursor: pointer;
}
button:hover { background: var(--brand-2); }
button.ghost-btn { background: transparent; border: 1px solid var(--brand); color: var(--brand); }
button.ghost-btn:hover { background: var(--brand-soft); }
button.small { padding: .35rem .7rem; font-size: .82rem; border-radius: 6px; }
button.ghost { background: transparent; border: 1px solid var(--brand); color: var(--brand); }
button.ghost:hover { background: var(--brand-soft); }
button:disabled { opacity: .5; cursor: not-allowed; }

.tabs { display: flex; gap: .4rem; margin-bottom: 1rem; border-bottom: 2px solid #f0e3cf; }
.tab {
  background: none; color: #8a7a5c; border: none; border-bottom: 3px solid transparent;
  border-radius: 0; padding: .7rem 1.1rem; font-size: 1rem;
}
.tab.on { color: var(--brand-2); border-bottom-color: var(--brand); font-weight: 600; }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; margin-bottom: 16px;
}
.card h3 { margin-top: 0; margin-bottom: .8rem; color: #6b4a10; font-size: 1.05rem; }
.hint { color: var(--muted); font-size: 13px; }
.msg { min-height: 18px; font-size: 13px; color: var(--holiday); margin-top: 8px; }
.msg.ok { color: var(--brand); }

/* ---------- booking calendar ---------- */
.cal-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.cal-toggle { display: flex; gap: 6px; }
.cal-toggle label {
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px;
  font-size: 13px; cursor: pointer; color: var(--muted);
}
.cal-toggle label.on { border-color: var(--brand); color: var(--brand); font-weight: 600; }
.cal-toggle input { display: none; }
.cal-nav { display: flex; align-items: center; gap: 12px; }
.cal-nav b { min-width: 220px; text-align: center; }

.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; }
.dot.free { background: var(--brand); }
.dot.holiday { background: var(--holiday); }
.dot.weekend { background: #c7cbd1; }

.bc-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.bc-wd { text-align: center; font-size: 11px; color: var(--muted); padding: 4px 0; }
.bc-day {
  position: relative; min-height: 64px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; padding: 6px; text-align: left;
  color: var(--ink); font-size: 14px;
}
.bc-day:hover { border-color: var(--brand); }
.bc-day .g-sub { display: block; font-size: 10px; color: var(--muted); }
.bc-day.weekend { background: var(--weekend-bg); color: var(--muted); }
.bc-day.holiday { background: var(--holiday-bg); border-color: #f0b7b3; }
.bc-day.holiday .hol-name {
  display: block; font-size: 10px; color: var(--holiday); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bc-day.today { outline: 2px solid var(--brand); }
.bc-day.past { opacity: .45; }
.bc-free {
  position: absolute; right: 6px; bottom: 6px; font-size: 11px; font-weight: 700;
  color: var(--brand-2); background: var(--brand-soft); border-radius: 999px; padding: 2px 7px;
}
.bc-day.empty { border: 0; background: transparent; pointer-events: none; }

/* ---------- day panel / booking ---------- */
.dp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.dp-holiday {
  background: var(--holiday-bg); color: var(--holiday); border-radius: 8px;
  padding: 8px 12px; font-size: 13px; margin-bottom: 10px;
}
.dp-slots { display: flex; flex-wrap: wrap; gap: 8px; }
.slot-chip {
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px;
  background: #fff; color: var(--ink); font-size: 14px; min-width: 118px;
}
.slot-chip small { display: block; color: var(--muted); font-size: 11px; }
.slot-chip.free { border-color: var(--brand); }
.slot-chip.full { opacity: .5; }

/* ---------- lists ---------- */
.appt-list .appt {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px;
}
.appt .who { font-weight: 600; }
.appt .when { font-size: 12px; color: var(--muted); }
.appt .badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; }
.badge.SCHEDULED { background: var(--brand-soft); color: var(--brand-2); }
.badge.CANCELLED { background: #eee; color: var(--muted); }

/* ---------- forms / modals ---------- */
input {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; margin-bottom: 10px;
}
input:focus { outline: 2px solid var(--brand-line); border-color: var(--brand); }
.modal {
  position: fixed; inset: 0; background: rgba(30,22,10,.45);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}
.modal-card { width: min(430px, 92vw); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.form-grid label { font-size: 12px; color: var(--muted); display: block; position: relative; }
.form-grid input { margin-bottom: 0; }
label.chk { display: flex; align-items: center; gap: 8px; }
label.chk input { width: auto; margin: 0; }
.cal-btn {
  position: absolute; right: 4px; top: 4px; padding: 5px 8px; border-radius: 8px;
  background: transparent; color: var(--brand); font-size: 15px;
}
.dob-row { position: relative; display: block; }
.dob-row .cal-btn { top: 4px; }

/* ---------- dual-calendar picker popup ---------- */
.calpop {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0,0,0,.25); padding: 14px; z-index: 300;
  width: min(320px, 92vw);
}
.cp-toggle { display: flex; gap: 10px; margin-bottom: 8px; }
.cp-toggle label {
  flex: 1; text-align: center; border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 0; font-size: 13px; cursor: pointer;
}
.cp-toggle label.on { border-color: var(--brand); color: var(--brand); font-weight: 600; }
.cp-toggle input { display: none; }
.cp-nav { display: flex; gap: 6px; margin-bottom: 6px; }
select.cp-month { flex: 1; min-width: 0; }
select.cp-year { width: 64px; flex-shrink: 0; }
select.cp-month, select.cp-year { font: inherit; padding: 6px; border: 1px solid var(--line); border-radius: 8px; }
.cp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; text-align: center; }
.cp-wd { font-size: 10px; color: var(--muted); padding: 2px 0; }
.cp-day { background: transparent; border-radius: 8px; padding: 7px 0; font-size: 13px; color: var(--ink); }
.cp-day:hover { background: var(--brand-soft); }
.cp-day.today { outline: 1px solid var(--brand); }
.cp-day.sel { background: var(--brand); color: #fff; }
.cp-day.cp-disabled { opacity: .3; }

/* ---------- mobile ---------- */
@media (max-width: 640px) {
  header { flex-wrap: wrap; padding: .75rem 1rem; row-gap: .4rem; }
  header h1 { font-size: 1.15rem; }
  .header-right { flex-wrap: wrap; justify-content: flex-end; row-gap: .3rem; }
  #guest-nav { gap: .7rem; }
  #guest-nav .small { font-size: .85rem; padding: .2rem .3rem; }
  header button { white-space: nowrap; }
  .tabs { flex-wrap: wrap; }
  .bc-day { min-height: 52px; }
  .cal-nav b { min-width: 150px; }
}

/* ---------- profile menu ---------- */
.menu-wrap { position: relative; display: inline-block; }
#profile-btn { background: rgba(255,255,255,.14); color: #fff; display: inline-flex; align-items: center; gap: 7px; }
#profile-btn:hover { background: rgba(255,255,255,.24); }
.burger { font-size: 15px; line-height: 1; }
.drop-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 60;
  min-width: 240px; padding: 14px; text-align: left;
}
.pm-rows { display: grid; gap: 6px; margin-bottom: 10px; }
.pm-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); }
.pm-row b { color: var(--ink); font-weight: 600; text-align: right; }
.drop-menu a { color: var(--brand); font-size: 13px; text-decoration: none; }
.drop-menu a:hover { text-decoration: underline; }

/* ---------- public org picker ---------- */
.bf-title { margin: 0 0 14px; color: #6b4a10; }
.org-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.org-card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; text-align: left; color: var(--ink); display: grid; gap: 4px;
}
.org-card:hover { border-color: var(--brand); box-shadow: 0 4px 14px rgba(183,121,31,.15); }
.org-card b { color: var(--brand-2); font-size: 15px; }
.org-card span { font-size: 12px; color: var(--muted); }

/* ---------- honeypot (bot trap — never visible to humans) ---------- */
.hp { position: absolute !important; left: -9999px !important; height: 0; opacity: 0; }
