/* Bookings admin page — builds on style.css + tracker.css tokens */

.bk-toolbar { align-items: center; }
.bk-viewtabs {
  display: inline-flex;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: .25rem;
  gap: .15rem;
}
.bk-tab {
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: var(--text-sm);
  padding: .5rem 1rem;
  border-radius: var(--radius-full);
  cursor: pointer;
}
.bk-tab.is-active { background: var(--color-primary); color: #fff; }

/* Calendar nav bar */
.bk-calnav {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1.25rem 0 1rem;
}
.bk-calnav h2 {
  font-family: "Newsreader", Georgia, serif;
  font-size: var(--text-lg);
  margin: 0;
  min-width: 12rem;
}
.bk-calnav .btn { padding: .6rem .9rem; }
.bk-calnav #calToday { margin-left: auto; }

.bk-section { margin-top: .5rem; }

/* ---------- list view ---------- */
.bk-daygroup { margin-bottom: 1.75rem; }
.bk-dayhead {
  display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: .5rem; margin-bottom: .75rem;
}
.bk-dayhead h3 {
  font-family: "Newsreader", Georgia, serif;
  font-size: var(--text-base); margin: 0;
}
.bk-dayhead span { color: var(--color-text-faint); font-size: var(--text-xs); }
.bk-rows { display: grid; gap: .6rem; }

.bk-row {
  display: grid;
  grid-template-columns: 6.5rem 1fr auto auto;
  align-items: center;
  gap: 1rem;
  width: 100%;
  text-align: left;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: .85rem 1.1rem;
  cursor: pointer;
  transition: box-shadow .15s ease, transform .15s ease;
  color: var(--color-text);
}
.bk-row:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.bk-row-time { font-weight: 700; }
.bk-row-main { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.bk-row-main strong { font-size: var(--text-sm); }
.bk-row-main small { color: var(--color-text-muted); font-size: var(--text-xs); }
.bk-row-biz { font-weight: 500; color: var(--color-text-muted); }
.bk-row-contact { color: var(--color-text-muted); font-size: var(--text-sm); white-space: nowrap; }

/* status accent on the left border */
.bk-row.bk-st-confirmed { border-left-color: var(--color-success); }
.bk-row.bk-st-completed { border-left-color: var(--color-text-faint); }
.bk-row.bk-st-noshow    { border-left-color: var(--color-warning); }
.bk-row.bk-st-cancelled { border-left-color: var(--color-error); opacity: .6; }

/* status pill */
.bk-status-pill {
  font-size: var(--text-xs); font-weight: 600;
  padding: .25rem .6rem; border-radius: var(--radius-full); white-space: nowrap;
}
.bk-st-requested.bk-status-pill { background: color-mix(in srgb, var(--color-warning) 16%, var(--color-surface)); color: var(--color-warning); }
.bk-st-confirmed.bk-status-pill { background: color-mix(in srgb, var(--color-primary) 14%, var(--color-surface)); color: var(--color-primary); }
.bk-st-completed.bk-status-pill { background: color-mix(in srgb, var(--color-success) 14%, var(--color-surface)); color: var(--color-success); }
.bk-st-noshow.bk-status-pill    { background: var(--color-surface-2); color: var(--color-text-muted); }
.bk-st-cancelled.bk-status-pill { background: color-mix(in srgb, var(--color-error) 12%, var(--color-surface)); color: var(--color-error); }

/* ---------- chips (week + month) ---------- */
.bk-chip {
  display: flex; flex-direction: column; gap: .1rem;
  width: 100%; text-align: left;
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-primary);
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  padding: .35rem .5rem;
  cursor: pointer;
  color: var(--color-text);
}
.bk-chip:hover { background: var(--color-surface-2); }
.bk-chip-time { font-weight: 700; font-size: var(--text-xs); }
.bk-chip-name { font-size: var(--text-xs); color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-chip.bk-st-confirmed { border-left-color: var(--color-success); }
.bk-chip.bk-st-completed { border-left-color: var(--color-text-faint); }
.bk-chip.bk-st-noshow    { border-left-color: var(--color-warning); }
.bk-chip.bk-st-cancelled { border-left-color: var(--color-error); opacity: .6; }

/* ---------- week grid ---------- */
.bk-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: .5rem;
}
.bk-weekcol {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  min-height: 9rem;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.bk-weekcol.is-today { border-color: var(--color-primary); box-shadow: 0 0 0 1px var(--color-primary) inset; }
.bk-weekcol-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: .5rem .6rem; border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-2);
}
.bk-weekcol-head .dow { font-size: var(--text-xs); color: var(--color-text-muted); font-weight: 600; }
.bk-weekcol-head .num { font-weight: 700; }
.bk-weekcol-body { padding: .45rem; display: grid; gap: .4rem; align-content: start; }
.bk-empty-mini { color: var(--color-text-faint); font-size: var(--text-xs); padding: .25rem; }

/* ---------- month grid ---------- */
.bk-month-dow {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: .5rem; margin-bottom: .4rem;
}
.bk-month-dow span {
  text-align: center; font-size: var(--text-xs);
  font-weight: 600; color: var(--color-text-muted);
}
.bk-month {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: .5rem;
}
.bk-mcell {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  min-height: 7.5rem;
  padding: .35rem;
  display: flex; flex-direction: column; gap: .3rem;
}
.bk-mcell.is-out { background: var(--color-surface-2); opacity: .55; }
.bk-mcell.is-today { border-color: var(--color-primary); box-shadow: 0 0 0 1px var(--color-primary) inset; }
.bk-mcell-num { font-size: var(--text-xs); font-weight: 700; color: var(--color-text-muted); }
.bk-mcell-body { display: grid; gap: .25rem; }
.bk-more { font-size: var(--text-xs); color: var(--color-primary); font-weight: 600; }

/* ---------- detail modal ---------- */
.bk-detail { display: grid; gap: .55rem; padding: .25rem 0 1rem; }
.bk-detail-row {
  display: grid; grid-template-columns: 9rem 1fr; gap: 1rem;
  padding-bottom: .55rem; border-bottom: 1px solid var(--color-border);
}
.bk-detail-row:last-child { border-bottom: 0; }
.bk-detail-row .k { color: var(--color-text-muted); font-size: var(--text-sm); font-weight: 600; }
.bk-detail-row .v { font-size: var(--text-sm); word-break: break-word; }

.bk-actions { align-items: center; flex-wrap: wrap; gap: .6rem; }
.bk-statuslabel { font-weight: 600; font-size: var(--text-sm); color: var(--color-text-muted); }
.bk-actions select {
  padding: .7rem .9rem; border-radius: var(--radius-sm);
  border: 1px solid var(--color-border); background: var(--color-surface);
  color: var(--color-text); font: inherit;
}
.bk-actions #bkDeleteBtn { margin-left: auto; }

/* ---------- responsive ---------- */
@media (max-width: 880px) {
  .bk-week, .bk-month, .bk-month-dow { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .3rem; }
  .bk-chip-name { display: none; }
  .bk-mcell { min-height: 5.5rem; }
}
@media (max-width: 680px) {
  .bk-row { grid-template-columns: 5rem 1fr; grid-template-areas: "time main" "contact status"; row-gap: .4rem; }
  .bk-row-time { grid-area: time; }
  .bk-row-main { grid-area: main; }
  .bk-row-contact { grid-area: contact; }
  .bk-status-pill { grid-area: status; justify-self: end; }
  /* On phones the week/month grids get cramped — let them scroll horizontally */
  .bk-week, .bk-month, .bk-month-dow { min-width: 640px; }
  #weekView, #monthView { overflow-x: auto; }
  .bk-actions #bkDeleteBtn { margin-left: 0; }
}
