/* =========================================================
   THE DINKIN PROJECT — MULTI-COURT BOOKING GRID
   "Reservation board": a dark, concrete-and-court-navy panel
   with individual slot tiles rather than a plain spreadsheet
   table — dashed kitchen-line under each court header, and the
   ball's yellow as the only accent color.
   Depends on tokens.css. Used by book.php, customer/book_court.php
   and admin/walkin.php.
   ========================================================= */

.booking-grid-wrap{
  position:relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0) 120px),
    radial-gradient(var(--teal) 1px, transparent 1px) 0 0 / 26px 26px,
    var(--ink);
  border:1px solid #202429;
  border-radius:var(--radius);
  padding:22px;
  color:#fff;
  overflow:hidden;
}

.booking-grid-wrap::before{
  /* faint diagonal court-line, echoing the stripe on the venue wall */
  content:'';
  position:absolute;
  top:-40%;
  right:-10%;
  width:220px;
  height:220%;
  background:rgba(255,255,255,.035);
  transform:rotate(24deg);
  pointer-events:none;
}

.grid-window-note{
  font-size:13px;
  color:#9096A0;
  margin-bottom:14px;
  position:relative;
}

.grid-legend{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-bottom:18px;
  position:relative;
}

.grid-legend .chip{
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.12);
  font-family:var(--font-body);
  text-transform:none;
  letter-spacing:0;
  font-weight:600;
  font-size:12.5px;
  padding:6px 14px 6px 10px;
  color:#C8CCD2;
}

.grid-legend .chip::before{
  content:'';
  width:9px;
  height:9px;
  border-radius:3px;
  display:inline-block;
  margin-right:2px;
}

.chip-available::before{ background:#4ADE80; }
.chip-peak::before{ background:var(--gold); }
.chip-selected::before{ background:var(--gold); box-shadow:0 0 0 3px rgba(46,85,144,.25); }
.chip-booked::before{ background:#4A5158; }
.chip-walkin-booked::before{ background:#B23B3B; }
.chip-online-booked::before{ background:#F0C239; }
.chip-blocked::before{
  background:repeating-linear-gradient(45deg,#4A5158,#4A5158 2px,#2A2E33 2px,#2A2E33 4px);
}

.grid-scroll{
  overflow-x:auto;
  position:relative;
  padding-bottom:4px;
}

.booking-grid-table{
  width:100%;
  border-collapse:separate;
  border-spacing:6px 7px;
  font-family:var(--font-body);
  min-width:640px;
}

.booking-grid-table thead th{
  padding:0;
  text-align:center;
}

.booking-grid-table thead th > *{ display:block; }

/* Court header rendered as a little scoreboard plate above its column */
.booking-grid-table thead th:not(.grid-time-col){
  font-size:13px;
  font-weight:700;
  letter-spacing:.04em;
  color:#EAF1FF;
  background:linear-gradient(135deg, var(--primary), var(--primary-dk));
  border-radius:10px 10px 0 0;
  white-space:nowrap;
  position:relative;
  padding:12px 14px 14px;
}

.booking-grid-table thead th:not(.grid-time-col)::after{
  /* the dashed "kitchen line" beneath every court name */
  content:'';
  position:absolute;
  left:10px;
  right:10px;
  bottom:0;
  border-bottom:2px dashed rgba(46,85,144,.55);
}

.booking-grid-table thead th.grid-time-col{
  color:#7C828B;
  font-size:11.5px;
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;
  text-align:left;
  vertical-align:bottom;
  padding-bottom:14px;
}

.booking-grid-table thead th .grid-sport-tag{
  font-size:10px;
  font-weight:500;
  color:rgba(255,255,255,.55);
  text-transform:uppercase;
  letter-spacing:.06em;
  margin-top:3px;
}

/* Per-court availability badge — makes it immediately obvious whether
   a column has open slots at all, instead of leaving the user to scan
   a wall of grey "Booked" tiles and wonder if something's broken. */
.grid-avail-badge{
  display:inline-block;
  margin-top:8px;
  padding:3px 10px;
  border-radius:20px;
  font-size:10.5px;
  font-weight:700;
  letter-spacing:.03em;
  text-transform:none;
  font-family:var(--font-body);
}
.grid-avail-badge.is-open{
  background:rgba(74,222,128,.16);
  color:#4ADE80;
}
.grid-avail-badge.is-full{
  background:rgba(255,255,255,.08);
  color:#9096A0;
}

/* Clear divider + alternating tint between court columns so adjacent
   courts never read as one merged block. */
.grid-court-col{
  border-left:2px solid rgba(255,255,255,.06);
}
.grid-time-col + .grid-court-col{ border-left:none; }
.booking-grid-table tbody td.grid-court-col:nth-of-type(odd){
  background:rgba(255,255,255,.015);
}
.court-count-1 .grid-court-col{ border-left:none; }

.grid-time-col{
  color:#9096A0;
  font-weight:600;
  font-family:var(--font-mono);
  font-size:12.5px;
  white-space:nowrap;
}

.booking-grid-table tbody td{
  padding:0;
  text-align:center;
}

/* Every open/peak/booked/blocked cell is its own rounded tile, not a bare
   table cell — this is the part that used to look like a copied
   spreadsheet and now reads as a set of physical court slots. */
.grid-cell{
  display:block;
  cursor:pointer;
  width:100%;
  border-radius:9px;
  padding:10px 6px;
  font-size:13px;
  font-weight:700;
  font-family:var(--font-mono);
  border:1px solid transparent;
  transition:transform .12s ease, background .15s ease, border-color .15s ease;
}

.grid-cell.is-available{
  color:#4ADE80;
  background:rgba(74,222,128,.07);
  border-color:rgba(74,222,128,.18);
}
.grid-cell.is-available:hover{
  background:rgba(74,222,128,.16);
  transform:translateY(-2px);
}

.grid-cell.is-peak{
  color:var(--gold);
  background:rgba(46,85,144,.1);
  border-color:rgba(46,85,144,.28);
}
.grid-cell.is-peak:hover{
  background:rgba(46,85,144,.2);
  transform:translateY(-2px);
}

.grid-cell.is-current{
  color:#7DB0F2;
  background:rgba(125,176,242,.12);
  border-color:rgba(125,176,242,.45);
  border-style:dashed;
}
.grid-cell.is-current:hover{
  background:rgba(125,176,242,.22);
  transform:translateY(-2px);
}

.grid-cell.is-booked,
.grid-cell.is-blocked{
  cursor:not-allowed;
  font-weight:600;
}

.grid-cell.is-booked{
  color:#FFC2C2;
  background:rgba(178,59,59,.18);
  border-color:rgba(178,59,59,.38);
}

.grid-booking-button{
  appearance:none;
  font-family:inherit;
  text-align:center;
}
.grid-booking-button:hover{
  background:rgba(178,59,59,.28);
  transform:translateY(-2px);
}

.grid-cell.is-online-booked{
  color:#FFE9A6;
  background:rgba(240,194,57,.22);
  border-color:rgba(240,194,57,.52);
}
.grid-booking-button.is-online-booked:hover{
  background:rgba(240,194,57,.32);
}

.grid-cell.is-walkin-booked{
  color:#FFC2C2;
  background:rgba(178,59,59,.18);
  border-color:rgba(178,59,59,.38);
}

.grid-cell.is-blocked{
  color:#8D949D;
  background:rgba(255,255,255,.04);
  border-color:rgba(255,255,255,.08);
}

.grid-cell.is-blocked{
  background-image:repeating-linear-gradient(135deg, rgba(255,255,255,.025) 0 6px, transparent 6px 12px);
}

.grid-cell.is-past{
  color:#3A3F45;
  background:transparent;
  font-weight:400;
  font-size:12px;
}

.grid-cell.is-selected{
  background:var(--pub-navy, var(--gold)) !important;
  border-color:#7DB0F2 !important;
  color:#fff !important;
  transform:translateY(-2px);
  box-shadow:0 6px 16px rgba(46,85,144,.35);
}

.grid-cell.is-dimmed{
  opacity:.72;
}

/* Slightly stronger row divider at the top of every hour, so the
   half-hour grid doesn't read as one undifferentiated wall of tiles. */
tr.hour-start .grid-time-col{
  padding-top:10px;
  position:relative;
}
tr.hour-start td{
  border-top:1px solid rgba(255,255,255,.08);
  padding-top:4px;
}

.court-lock-bar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  background:rgba(46,85,144,.08);
  border:1px solid rgba(46,85,144,.35);
  border-radius:var(--radius-sm);
  padding:10px 16px;
  margin-bottom:14px;
  font-size:13px;
  color:#EAF1FF;
  position:relative;
}
.court-lock-bar strong{ color:var(--gold); }

.grid-selection-bar{
  margin-top:18px;
  padding:14px 18px;
  background:rgba(255,255,255,.04);
  border:1px dashed rgba(46,85,144,.4);
  border-radius:var(--radius-sm);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  font-size:13.5px;
  position:relative;
}

.grid-selection-bar .grid-total{
  font-family:var(--font-mono);
  font-weight:700;
  color:var(--gold);
  font-size:16px;
}

.bs-court-group{
  margin-bottom:10px;
  padding-bottom:10px;
  border-bottom:1px dashed rgba(255,255,255,.1);
}
.bs-court-group:last-child{ border-bottom:0; margin-bottom:0; padding-bottom:0; }
.bs-court-name{
  display:block;
  margin-bottom:6px;
  color:var(--pub-text-dim, #9FA7B2);
  font-size:12px;
  font-weight:800;
  text-transform:uppercase;
}

/* Short time label (e.g. "8:00 AM") is desktop-hidden by default;
   the full range ("8:00 AM - 9:00 AM") is what mobile hides instead. */
.grid-time-short{ display:none; }

@media(max-width:767px){
  /* No more side-scrolling table: the grid becomes a vertical list of
     time rows, each holding its court buttons side by side. Courts wrap
     to a new line automatically if there are ever more than fit. */
  .grid-scroll{ overflow-x:visible; padding-bottom:0; }

  .booking-grid-table{
    display:block;
    width:100%;
    min-width:0;
    border-spacing:0;
  }

  /* Sticky compact header: just the court names, pinned to the top of
     the list instead of scrolling away with a wide table. */
  .booking-grid-table thead{
    display:block;
    position:sticky;
    top:0;
    z-index:2;
    background:var(--ink);
    padding:0 0 8px;
  }
  .booking-grid-table thead tr{
    display:flex;
    gap:6px;
  }
  .booking-grid-table thead th.grid-time-col{
    flex:0 0 54px;
  }
  .booking-grid-table thead th:not(.grid-time-col){
    flex:1 1 0;
    min-width:0;
    padding:8px 4px 9px;
    font-size:10.5px;
    white-space:normal;
  }
  .booking-grid-table thead th .grid-sport-tag{ display:none; }
  .grid-avail-badge{ font-size:9px; padding:2px 7px; margin-top:5px; }

  .booking-grid-table tbody{ display:block; }
  .booking-grid-table tr{
    display:flex;
    align-items:center;
    gap:6px;
    padding:5px 0;
    border-bottom:1px solid rgba(255,255,255,.06);
  }
  .booking-grid-table tbody tr:last-child{ border-bottom:none; }
  .booking-grid-table td{ padding:0; }

  .grid-time-col{
    flex:0 0 54px;
    font-size:11.5px;
    white-space:normal;
    line-height:1.2;
  }
  .grid-time-full{ display:none; }
  .grid-time-short{ display:block; }

  .grid-court-col{
    flex:1 1 0;
    min-width:0;
    border-left:none !important;
    background:none !important;
  }

  .grid-cell{ width:100%; padding:9px 3px; font-size:12px; }
}
