/* ===================================================================
   The Golf Lounge — Daily Schedule (staff calendar) stylesheet
   Extends booking.css's dark theme (the default, [data-theme="dark"])
   with a second, deliberately different light theme — bright and
   colorful rather than just "dark theme with colors inverted", since
   this page may be visible on a screen customers can see too.
   =================================================================== */

:root {
  /* Bay accent colors — used consistently in both themes so each
     bay's bookings are visually distinct at a glance. Bay IDs get
     mapped to these in order via calendar.js. */
  --bay-1: #3b82f6; --bay-2: #f97316; --bay-3: #8b5cf6; --bay-4: #06b6d4;
  --bay-5: #ec4899; --bay-6: #eab308; --bay-7: #22c55e; --bay-8: #f43f5e;
}

/* ---------- Light theme overrides ---------- */
/* Deliberately brighter and more colorful than a simple inversion of
   the dark theme — meant to feel welcoming on a screen customers
   might glance at, not like a backend tool. */
[data-theme="light"] {
  --color-bg: #f5f7fb;
  --color-card: #ffffff;
  --color-accent: #16a34a;
  --color-text: #16213a;
  --color-text-soft: #6b7685;
  --color-line: #e3e8f0;
}
[data-theme="light"] body { color-scheme: light; }
[data-theme="light"] .custom-calendar { box-shadow: 0 12px 30px rgba(20,30,60,.15); }

/* ---------- Header ---------- */
.cal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px; border-bottom: 1px solid var(--color-line);
}
.cal-header-right { display: flex; align-items: center; gap: 12px; }
.cal-title { font-family: var(--font-display); font-size: 20px; font-weight: 600; margin: 0; }

/* ---------- Day navigation bar ---------- */
.cal-daybar {
  display: flex; align-items: center; gap: 12px; padding: 18px 28px;
  border-bottom: 1px solid var(--color-line); flex-wrap: wrap;
}
.cal-date-picker { margin-bottom: 0; }
.cal-date-btn { min-width: 180px; justify-content: center; font-weight: 600; }

/* ---------- The day-planner grid ---------- */
/* Rows: one per 15-minute slot, 10:00-24:00 = 56 rows, plus a header
   row for bay names. Columns: one for time labels, one per bay.
   Booking blocks span rows via grid-row, matching their actual time
   range — this is what makes them visually line up with the correct
   time without any manual pixel math. */
.cal-grid-wrap { padding: 20px 28px 60px; overflow-x: auto; }

/* The bay-name header is now a completely separate element from the
   time-slot grid below it — not row 1 of the same grid. Using the
   same grid-template-columns keeps them visually aligned, but
   structurally independent, which is what actually guarantees the
   header can never overlap the first time row: there's no shared
   grid/sticky-positioning interaction left to go wrong. */
.cal-header-row {
  display: grid;
  grid-template-columns: 64px repeat(var(--bay-count, 7), minmax(150px, 1fr));
  min-width: 900px;
  border: 1px solid var(--color-line); border-bottom: 2px solid var(--color-line);
  border-radius: 10px 10px 0 0; overflow: hidden;
  margin-bottom: 8px;
}
.cal-bay-header {
  background: var(--color-card); border-right: 1px solid var(--color-line);
  padding: 20px 10px; box-sizing: border-box;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px; text-align: center;
}
.cal-bay-header .bay-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 6px; flex-shrink: 0; }
.cal-bay-header.unavailable { opacity: .5; }
.cal-time-corner { background: var(--color-card); border-right: 1px solid var(--color-line); }

.cal-grid {
  display: grid;
  grid-template-columns: 64px repeat(var(--bay-count, 7), minmax(150px, 1fr));
  grid-auto-rows: 24px;
  min-width: 900px;
  border-top: 1px solid var(--color-line);
  border-left: 1px solid var(--color-line);
}

.cal-time-label {
  border-right: 1px solid var(--color-line); border-bottom: 1px solid var(--color-line);
  font-size: 11px; color: var(--color-text-soft); text-align: right; padding: 0 8px 0 0;
  display: flex; align-items: center; justify-content: flex-end;
}
.cal-hour-line { border-bottom: 1px solid var(--color-line); }
.cal-bay-column-bg {
  border-right: 1px solid var(--color-line); border-bottom: 1px solid var(--color-line);
  cursor: pointer; transition: box-shadow .1s ease;
}
.cal-bay-column-bg:hover {
  box-shadow: inset 0 0 0 1px var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 8%, transparent);
}

.cal-booking-block {
  border-radius: 6px; padding: 4px 8px; margin: 1px 3px; cursor: pointer;
  font-size: 12px; line-height: 1.3; overflow: hidden;
  border-left: 3px solid var(--bay-color, var(--color-accent));
  background: color-mix(in srgb, var(--bay-color, var(--color-accent)) 16%, var(--color-card));
  transition: transform .12s ease, box-shadow .12s ease;
}
.cal-booking-block:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.cal-booking-block.cancelled { opacity: .45; text-decoration: line-through; border-left-color: var(--color-text-soft); }
.cal-booking-block .cbb-name { font-weight: 700; color: var(--color-text); }
.cal-booking-block .cbb-time { color: var(--color-text-soft); }
.cal-booking-block .cbb-badge {
  display: inline-block; font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  padding: 1px 5px; border-radius: 4px; margin-inline-start: 4px;
}
.cal-booking-block .cbb-badge.unpaid { background: rgba(255,180,60,.2); color: #d98c00; }
[data-theme="dark"] .cal-booking-block .cbb-badge.unpaid { color: #ffb84d; }
.cal-empty-note { grid-column: 1 / -1; text-align: center; color: var(--color-text-soft); padding: 40px 0; }

/* ---------- Booking detail modal ---------- */
.cal-modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 200;
  align-items: center; justify-content: center; padding: 20px;
}
.cal-modal-overlay.open { display: flex; }
.cal-modal {
  background: var(--color-card); border: 1px solid var(--color-line); border-radius: 14px;
  padding: 28px; max-width: 440px; width: 100%; position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.cal-modal-wide { max-width: 560px; max-height: 85vh; overflow-y: auto; }
.cal-modal-close {
  position: absolute; top: 16px; right: 16px; background: none; border: none;
  color: var(--color-text-soft); font-size: 22px; cursor: pointer;
}
.cal-modal-close:hover { color: var(--color-text); }
.modal-row { display: flex; justify-content: space-between; padding: 7px 0; font-size: 14px; border-bottom: 1px solid var(--color-line); }
.modal-row:last-of-type { border-bottom: none; }
.modal-row .mr-label { color: var(--color-text-soft); }
.modal-row .mr-value { font-weight: 600; text-align: right; }
.modal-notes { background: var(--color-bg); border: 1px solid var(--color-line); border-radius: 8px; padding: 12px 14px; margin-top: 14px; font-size: 13.5px; white-space: pre-wrap; }
.modal-notes-label { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--color-text-soft); margin-top: 18px; margin-bottom: 6px; }

@media (max-width: 700px) {
  .cal-header, .cal-daybar, .cal-grid-wrap { padding-left: 16px; padding-right: 16px; }
  .cal-title { font-size: 17px; }
}
