/* ==========================================================================
   TeeBook — Golf Haven Group booking engine
   Themeable via CSS custom properties set on the .teebook root element.
   See README.md for the full variable list and config schema.
   ========================================================================== */

.teebook {
  /* ---- default theme (overridden per-course via inline custom props) ---- */
  --tb-primary: #143222;       /* deep course green — header, headings */
  --tb-primary-soft: #1D4530;  /* secondary green */
  --tb-field: #2F7A4F;         /* fairway green — availability accents */
  --tb-accent: #C9A24B;        /* gold/rust call-to-action */
  --tb-accent-ink: #143222;    /* text color on top of accent */
  --tb-cream: #FAF7EE;         /* page background */
  --tb-paper: #FFFFFF;         /* card background */
  --tb-line: #E5DFCC;          /* borders */
  --tb-ink: #1C2620;           /* body text */
  --tb-gray: #5A655C;          /* muted text */
  --tb-warn: #B0563C;          /* full / blocked */
  --tb-radius: 8px;
  --tb-serif: 'Lora', Georgia, serif;
  --tb-sans: 'Inter', -apple-system, sans-serif;

  font-family: var(--tb-sans);
  color: var(--tb-ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.teebook *, .teebook *::before, .teebook *::after {
  box-sizing: border-box;
}

.teebook button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}
.teebook button:disabled { cursor: not-allowed; }
.teebook a { color: inherit; }
.teebook a:focus-visible,
.teebook button:focus-visible,
.teebook input:focus-visible,
.teebook select:focus-visible {
  outline: 2px solid var(--tb-field);
  outline-offset: 2px;
}

/* ---- shell ---- */
.teebook.tb-standalone { background: var(--tb-cream); }
.tb-wrap { max-width: 1080px; margin: 0 auto; padding: 0 22px; }

/* ---- header (standalone mode only) ---- */
.tb-header { background: var(--tb-primary); color: #fff; padding: 16px 0; }
.tb-header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.tb-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.tb-brand-seal {
  width: 40px; height: 40px; border: 1.4px solid var(--tb-accent); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--tb-serif); font-size: 1.15rem; color: var(--tb-accent); flex-shrink: 0;
}
.tb-brand-name { font-family: var(--tb-serif); font-size: 1.08rem; line-height: 1.1; }
.tb-brand-name small {
  display: block; font-size: 0.54rem; font-weight: 600; letter-spacing: 0.3em;
  text-transform: uppercase; color: rgba(255,255,255,0.6); margin-top: 2px;
}
.tb-back-link { font-size: 0.82rem; color: rgba(255,255,255,0.75); text-decoration: none; }
.tb-back-link:hover { color: var(--tb-accent); }

/* ---- tabs (golfer / pro shop) ---- */
.tb-tabs { display: flex; gap: 6px; background: var(--tb-paper); border-bottom: 1px solid var(--tb-line); }
.tb-tabs .tb-wrap { display: flex; gap: 6px; width: 100%; }
.tb-tab {
  padding: 15px 20px 13px; font-size: 0.88rem; font-weight: 600; color: var(--tb-gray);
  border-bottom: 2.5px solid transparent; min-height: 48px;
}
.tb-tab.on { color: var(--tb-primary); border-bottom-color: var(--tb-accent); }

/* ---- main panes ---- */
.tb-main { padding: 28px 0 40px; }
.teebook.tb-standalone .tb-main { padding: 34px 0 70px; }
.tb-pane { display: none; }
.tb-pane.on { display: block; }
.tb-h1 { font-family: var(--tb-serif); font-weight: 500; font-size: clamp(1.4rem, 3.2vw, 2rem); margin: 0 0 4px; }
.tb-sub { color: var(--tb-gray); font-size: 0.92rem; margin: 0 0 22px; }

/* ---- date chips ---- */
.tb-chips { display: flex; gap: 9px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 16px; -webkit-overflow-scrolling: touch; }
.tb-chip {
  flex-shrink: 0; border: 1px solid var(--tb-line); background: var(--tb-paper); border-radius: var(--tb-radius);
  padding: 9px 15px; text-align: center; min-height: 48px; transition: border-color .2s, background .2s;
}
.tb-chip b { display: block; font-size: 0.86rem; font-weight: 600; color: var(--tb-ink); }
.tb-chip span { font-size: 0.68rem; color: var(--tb-gray); letter-spacing: 0.06em; text-transform: uppercase; }
.tb-chip.on { background: var(--tb-primary); border-color: var(--tb-primary); }
.tb-chip.on b, .tb-chip.on span { color: #fff; }

/* ---- filters ---- */
.tb-filters { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.tb-filt {
  border: 1px solid var(--tb-line); background: var(--tb-paper); border-radius: 99px;
  padding: 8px 16px; font-size: 0.8rem; font-weight: 500; color: var(--tb-gray); min-height: 40px;
}
.tb-filt.on { background: var(--tb-accent); border-color: var(--tb-accent); color: var(--tb-accent-ink); font-weight: 600; }

/* ---- legend ---- */
.tb-legend { display: flex; gap: 18px; margin-bottom: 14px; font-size: 0.74rem; color: var(--tb-gray); flex-wrap: wrap; }
.tb-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---- slot grid ---- */
.tb-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.tb-slot {
  border: 1px solid var(--tb-line); background: var(--tb-paper); border-radius: var(--tb-radius);
  padding: 11px 8px 9px; text-align: center; transition: transform .15s, border-color .2s, box-shadow .2s; min-height: 68px;
}
.tb-slot:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--tb-field); box-shadow: 0 10px 24px -14px rgba(20,50,34,0.4); }
.tb-slot b { display: block; font-size: 0.96rem; font-weight: 600; color: var(--tb-primary); font-variant-numeric: tabular-nums; }
.tb-slot .tb-price { font-size: 0.72rem; color: var(--tb-field); font-weight: 600; }
.tb-slot .tb-spots { font-size: 0.68rem; color: var(--tb-gray); }
.tb-slot.low .tb-spots { color: var(--tb-accent); }
.tb-slot.full, .tb-slot.blocked { background: var(--tb-cream); opacity: 0.62; }
.tb-slot.full .tb-spots { color: var(--tb-gray); }
.tb-slot.blocked .tb-spots { color: var(--tb-warn); }
.tb-no-slots { padding: 36px 0; text-align: center; color: var(--tb-gray); font-size: 0.95rem; display: none; }

/* ---- live backend states ---- */
.tb-loading {
  grid-column: 1 / -1; padding: 30px 0; text-align: center; color: var(--tb-gray); font-size: 0.92rem;
}
.tb-api-error {
  grid-column: 1 / -1; padding: 14px 16px; text-align: center; color: var(--tb-warn);
  background: #FBF3EC; border: 1px solid var(--tb-line); border-radius: var(--tb-radius); font-size: 0.88rem;
}

/* ---- booking modal ---- */
.tb-veil {
  position: fixed; inset: 0; background: rgba(12,28,19,0.55); z-index: 9999;
  display: none; align-items: center; justify-content: center; padding: 18px;
}
.tb-veil.on { display: flex; }
.tb-modal {
  background: var(--tb-paper); border-radius: 12px; max-width: 430px; width: 100%; padding: 30px 28px;
  box-shadow: 0 40px 90px -20px rgba(0,0,0,0.5); max-height: 92vh; overflow-y: auto;
}
.tb-modal h2 { font-family: var(--tb-serif); font-weight: 500; font-size: 1.3rem; margin: 0 0 2px; }
.tb-modal .tb-when { color: var(--tb-field); font-weight: 600; font-size: 0.9rem; margin: 0 0 20px; }
.tb-modal label {
  display: block; font-size: 0.64rem; font-weight: 700; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--tb-gray); margin: 0 0 6px;
}
.tb-field-row { margin-bottom: 16px; }
.tb-modal input, .tb-modal select {
  width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid var(--tb-line); border-radius: 6px;
  background: var(--tb-cream); font-family: var(--tb-sans); font-size: 0.95rem; color: var(--tb-ink);
}
.tb-modal input:focus, .tb-modal select:focus { border-color: var(--tb-field); outline: none; background: #fff; }
.tb-seg { display: flex; gap: 8px; }
.tb-seg button {
  flex: 1; border: 1px solid var(--tb-line); border-radius: 6px; padding: 10px; font-size: 0.9rem;
  font-weight: 600; color: var(--tb-gray); background: var(--tb-cream); min-height: 46px;
}
.tb-seg button.on { background: var(--tb-primary); border-color: var(--tb-primary); color: #fff; }
.tb-modal-actions { display: flex; gap: 10px; margin-top: 22px; }
.tb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px;
  padding: 12px 22px; font-size: 0.9rem; font-weight: 600; border-radius: 6px;
  transition: background .2s, color .2s; text-decoration: none;
}
.tb-btn-go { background: var(--tb-accent); color: var(--tb-accent-ink); flex: 1; }
.tb-btn-go:hover { filter: brightness(1.08); }
.tb-btn-quiet { border: 1px solid var(--tb-line); color: var(--tb-gray); }
.tb-btn-quiet:hover { border-color: var(--tb-gray); color: var(--tb-ink); }
.tb-err { color: var(--tb-warn); font-size: 0.82rem; margin-top: 10px; display: none; }
.tb-err.on { display: block; }
.tb-total { font-size: 0.88rem; color: var(--tb-ink); margin: -4px 0 16px; }
.tb-total b { color: var(--tb-primary); font-family: var(--tb-serif); font-size: 1.1rem; }

/* ---- confirmation ---- */
.tb-confirm { text-align: center; padding: 8px 0 2px; }
.tb-confirm .tb-ok {
  width: 54px; height: 54px; border-radius: 50%; background: #E8F2E6; color: var(--tb-field);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;
}
.tb-confirm .tb-ok svg { width: 26px; height: 26px; }
.tb-confirm h2 { margin-bottom: 8px; }
.tb-confirm p { color: var(--tb-gray); font-size: 0.92rem; margin: 0 0 6px; }
.tb-confirm .tb-demo-note {
  font-size: 0.78rem; color: #8A6F2C; background: #F6EFD8; border-radius: 6px; padding: 10px 14px; margin-top: 16px;
}

/* ---- pro shop / day sheet ---- */
.tb-pin-gate {
  max-width: 380px; margin: 30px auto; background: var(--tb-paper); border: 1px solid var(--tb-line);
  border-radius: 12px; padding: 36px 32px; text-align: center;
}
.tb-pin-gate h2 { font-family: var(--tb-serif); font-weight: 500; font-size: 1.3rem; margin: 0 0 6px; }
.tb-pin-gate p { color: var(--tb-gray); font-size: 0.86rem; margin: 0 0 20px; }
.tb-pin-gate input {
  width: 100%; min-height: 50px; text-align: center; font-size: 1.4rem; letter-spacing: 0.5em;
  border: 1px solid var(--tb-line); border-radius: 8px; background: var(--tb-cream); font-family: var(--tb-sans);
}
.tb-pin-gate .tb-btn { width: 100%; margin-top: 14px; }

.tb-sheet-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.tb-sstat { background: var(--tb-paper); border: 1px solid var(--tb-line); border-radius: var(--tb-radius); padding: 14px 16px; }
.tb-sstat b { display: block; font-family: var(--tb-serif); font-size: 1.4rem; color: var(--tb-primary); }
.tb-sstat span { font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--tb-gray); }

.tb-sheet-tools { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.tb-sheet-wrap { background: var(--tb-paper); border: 1px solid var(--tb-line); border-radius: 10px; overflow: hidden; }
.tb-sheet { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.tb-sheet th {
  background: var(--tb-primary); color: #fff; text-align: left; padding: 10px 14px;
  font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase;
}
.tb-sheet td { padding: 9px 14px; border-bottom: 1px solid var(--tb-line); vertical-align: middle; }
.tb-sheet tr:last-child td { border-bottom: none; }
.tb-sheet .tb-t { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--tb-primary); white-space: nowrap; width: 86px; }
.tb-sheet tr.is-blocked { background: #FBF3EC; }
.tb-sheet tr.is-open td { color: #9AA095; }
.tb-pl {
  display: inline-flex; align-items: center; gap: 6px; background: var(--tb-cream); border: 1px solid var(--tb-line);
  border-radius: 99px; padding: 3px 11px; margin: 2px 4px 2px 0; font-size: 0.78rem; font-weight: 500;
}
.tb-pl b { color: var(--tb-field); font-weight: 700; }
.tb-pl button { color: var(--tb-warn); font-size: 0.95rem; line-height: 1; padding: 2px 2px 2px 4px; }
.tb-blk { color: var(--tb-warn); font-weight: 600; font-size: 0.8rem; letter-spacing: 0.04em; }
.tb-row-act { white-space: nowrap; text-align: right; width: 150px; }
.tb-mini-btn {
  border: 1px solid var(--tb-line); border-radius: 6px; padding: 6px 12px; font-size: 0.74rem;
  font-weight: 600; color: var(--tb-gray); margin-left: 6px; min-height: 34px; background: #fff;
}
.tb-mini-btn:hover { border-color: var(--tb-field); color: var(--tb-field); }
.tb-mini-btn.warn:hover { border-color: var(--tb-warn); color: var(--tb-warn); }
.tb-spots-cell { font-weight: 600; font-variant-numeric: tabular-nums; width: 70px; }

/* ---- footer (standalone) ---- */
.tb-footer { padding: 36px 0 50px; text-align: center; font-size: 0.8rem; color: var(--tb-gray); }
.tb-footer a { color: var(--tb-accent); font-weight: 600; text-decoration: none; }

/* ---- widget mode (embedded, no header/tabs) ---- */
.teebook.tb-widget { background: var(--tb-paper); border: 1px solid var(--tb-line); border-radius: 12px; padding: 22px; }
.teebook.tb-widget .tb-wrap { padding: 0; max-width: none; }
.teebook.tb-widget .tb-main { padding: 0; }
.tb-widget-badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.68rem; color: var(--tb-gray);
  letter-spacing: 0.08em; text-transform: uppercase; margin-top: 16px;
}
.tb-widget-badge a { color: var(--tb-gray); text-decoration: underline; }

@media (max-width: 700px) {
  .tb-sheet-stats { grid-template-columns: 1fr 1fr; }
  .tb-sheet th:nth-child(3), .tb-sheet td:nth-child(3) { display: none; }
  .tb-row-act { width: auto; }
}
@media print {
  .tb-header, .tb-tabs, .tb-chips, .tb-filters, .tb-sheet-tools, .tb-footer, .tb-row-act, .tb-sheet th:last-child { display: none !important; }
  .teebook.tb-standalone { background: #fff; }
  .tb-main { padding: 0; }
  .tb-sheet-wrap { border: none; }
  .tb-print-head { display: block !important; font-family: var(--tb-serif); font-size: 1.2rem; margin-bottom: 12px; }
}
.tb-print-head { display: none; }
