/* ── Shared calendar + court/time picker ─────────────────────────────────────
   Used by: user online booking, user reschedule, (future) guest/user walk-in.
   Layout: date panel (left) + court/time grid panel (right), side by side.
   ──────────────────────────────────────────────────────────────────────── */

.rp-layout { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.rp-col-date { flex: 0 0 320px; max-width: 100%; }
.rp-col-grid { flex: 1 1 480px; min-width: 0; }
.rp-layout.rp-no-date .rp-col-grid { flex: 1 1 100%; }

@media (max-width: 860px) {
    .rp-col-date { flex: 1 1 100%; }
}

.rw-sub { 
    color: #666; 
    margin-bottom: 16px; 
    font-size: 14px; 
    text-align: center;
}

/* ── Calendar ──────────────────────────────────────────────────────────────── */
.cal-wrap {
    background: #fff; border: 1px solid #e5e7eb;
    border-radius: 14px; padding: 22px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
[data-theme="dark"] .cal-wrap { background: #1e293b; border-color: #334155; }

.cal-hd {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
}
.cal-nav {
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    background: #f1f5f9; border: 1px solid #e2e8f0;
    border-radius: 8px; cursor: pointer; font-size: 15px;
    color: #475569; transition: background .15s;
    flex-shrink: 0;
}
.cal-nav:hover:not(:disabled) { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.cal-nav:disabled { opacity: .3; cursor: default; }
[data-theme="dark"] .cal-nav { background: #334155; border-color: #475569; color: #94a3b8; }

.cal-title {
    font-weight: 700; font-size: 17px; color: #1e293b;
    text-align: center; letter-spacing: .2px;
}
[data-theme="dark"] .cal-title { color: #e2e8f0; }

.cal-dow-row {
    display: grid; grid-template-columns: repeat(7,1fr);
    gap: 2px; margin-bottom: 6px;
}
.cal-dow { text-align: center; font-size: 11px; color: #94a3b8; font-weight: 600; padding: 3px 0; }

.cal-days { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; }
.cal-day {
    aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
    border-radius: 8px; font-size: 13px; cursor: pointer;
    border: 2px solid transparent; transition: background .12s, border-color .12s;
    user-select: none; font-weight: 500;
}
.cal-day.bookable:hover { background: #dbeafe; }
.cal-day.today { border-color: #3b82f6; font-weight: 700; color: #2563eb; }
.cal-day.selected { background: #2563eb !important; color: #fff !important; border-color: #2563eb; font-weight: 700; }
.cal-day.past, .cal-day.empty { color: #d1d5db; cursor: default; font-weight: 400; }
[data-theme="dark"] .cal-day.past { color: #475569; }

.cal-day.day-red    { background: #fee2e2; border-color: #fca5a5; }
.cal-day.day-yellow { background: #fef3c7; border-color: #fcd34d; }
.cal-day.bookable.day-red:hover    { background: #fecaca; }
.cal-day.bookable.day-yellow:hover { background: #fde68a; }
[data-theme="dark"] .cal-day.day-red    { background: rgba(220,38,38,.22); border-color: #dc2626; }
[data-theme="dark"] .cal-day.day-yellow { background: rgba(217,119,6,.22); border-color: #d97706; }

.cal-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; font-size: 11.5px; color: #6b7280; }
[data-theme="dark"] .cal-legend { color: #94a3b8; }
.cal-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend-swatch { width: 12px; height: 12px; border-radius: 4px; display: inline-block; border: 1px solid rgba(0,0,0,.1); }
.cal-legend-swatch.swatch-red    { background: #fee2e2; border-color: #fca5a5; }
.cal-legend-swatch.swatch-yellow { background: #fef3c7; border-color: #fcd34d; }
.cal-legend-swatch.swatch-none   { background: #fff; border-color: #e5e7eb; }
[data-theme="dark"] .cal-legend-swatch.swatch-red    { background: rgba(220,38,38,.22); border-color: #dc2626; }
[data-theme="dark"] .cal-legend-swatch.swatch-yellow { background: rgba(217,119,6,.22); border-color: #d97706; }
[data-theme="dark"] .cal-legend-swatch.swatch-none   { background: #1e293b; border-color: #334155; }

/* ── Grid panel ────────────────────────────────────────────────────────────── */
.grid-date-hd {
    display: flex; align-items: center; gap: 14px;
    margin-bottom: 16px; flex-wrap: wrap;
}
.grid-date-block {
    background: #fff; border: 1px solid #e5e7eb;
    border-radius: 12px; padding: 10px 20px;
    box-shadow: 0 1px 6px rgba(0,0,0,.05);
    line-height: 1.3;
}
[data-theme="dark"] .grid-date-block { background: #1e293b; border-color: #334155; }
.grid-month-lbl { font-size: 11px; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: .8px; }
.grid-day-lbl   { font-size: 17px; font-weight: 700; color: #1e3a8a; }
[data-theme="dark"] .grid-day-lbl { color: #93c5fd; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; font-size: 12px; }
.leg { display: flex; align-items: center; gap: 5px; }
.leg-dot { width: 14px; height: 14px; border-radius: 3px; flex-shrink: 0; }

.grid-wrap { width: 100%; overflow-x: auto; border-radius: 8px; border: 1px solid #e5e7eb; }
.res-tbl { border-collapse: collapse; min-width: 880px; width: 100%; }
.res-tbl th {
    background: #1e3a8a; color: #fff; padding: 8px 5px;
    font-size: 11px; text-align: center; white-space: nowrap; font-weight: 600;
}
.res-tbl th.corner { background: #13286e; min-width: 100px; }
.res-tbl td.court-lbl {
    background: #f8fafc; text-align: center; font-weight: 700; font-size: 12px;
    padding: 8px 14px; white-space: nowrap;
    border-right: 2px solid #e5e7eb; color: #1e3a8a;
}
.res-tbl td.slot {
    width: 6%; height: 44px; border: 1px solid #f3f4f6;
    position: relative;
}
/* Outline just the hovered cell — same treatment as the clicked/selected cell
   (.s-sel below) — instead of greying out its whole row/column. */
.res-tbl td.slot:hover { outline: 3px solid #2563eb; outline-offset: -3px; z-index: 1; position: relative; }
.res-tbl td.s-reserved_blocked:hover,
.res-tbl td.s-academy:hover,
.res-tbl td.s-blocked:hover,
.res-tbl td.s-locked:hover,
.res-tbl td.s-past:hover { outline: none; cursor: default; }
.s-available        { background: #bbf7d0; cursor: pointer; }
.s-reserved_waitlist{ background: #bfdbfe; cursor: pointer; }
.s-reserved_blocked { background: #fca5a5; }
.s-academy          { background: #e5e7eb; }
.s-blocked          { background: #e5e7eb; }
.s-locked           { background: #fef08a; }
.s-past             { background: #f3f4f6; }
.s-sel              { outline: 3px solid #2563eb; outline-offset: -3px; z-index: 1; position: relative; }

/* Admin edit page: marks the reservation's own current court/time slot, which
   is rendered as plain "available" (see RP_CONFIG.excludeReservationId) so it
   stays clickable — without this border it'd look identical to any other
   never-booked slot instead of "this is what you're editing". */
.s-current-slot     { box-shadow: inset 0 0 0 3px #d8790f; }

/* ── Selection panel (rendered per-page, styled shared) ───────────────────── */
.sel-panel {
    margin-top: 20px; border: 2px solid #e5e7eb;
    border-radius: 12px; padding: 20px; background: #fafafa;
}
[data-theme="dark"] .sel-panel { background: #0f172a; border-color: #334155; }
.sel-panel.wl { border-color: #93c5fd; background: #eff6ff; }
[data-theme="dark"] .sel-panel.wl { background: rgba(59,130,246,.12); }
.sel-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.sel-grp { flex: 1; min-width: 160px; }
.sel-grp label { display: block; font-size: 12px; color: #555; margin-bottom: 4px; font-weight: 600; }
[data-theme="dark"] .sel-grp label { color: #94a3b8; }
.sel-grp select, .sel-grp input { width: 100%; padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; box-sizing: border-box; }
.btn-proceed { width: 100%; padding: 11px; margin-top: 4px; font-size: 15px; font-weight: 700; }
.btn-ghost { background: #e5e7eb; color: #333; border: none; padding: 10px 16px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.btn-ghost:hover { background: #d1d5db; }

/* ── Confirmation modal (shared shell, per-page content) ──────────────────── */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-bg.hidden { display: none; }
.modal-box { background: #fff; border-radius: 16px; padding: 28px; max-width: 460px; width: 100%; box-shadow: 0 25px 60px rgba(0,0,0,.25); }
[data-theme="dark"] .modal-box { background: #1e293b; color: #e2e8f0; }
.modal-box h3 { margin: 0 0 20px; font-size: 20px; color: #1e3a8a; }
[data-theme="dark"] .modal-box h3 { color: #93c5fd; }
.conf-row { display: flex; justify-content: space-between; align-items: baseline; padding: 9px 0; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
[data-theme="dark"] .conf-row { border-color: #334155; }
.conf-row:last-of-type { border: none; }
.conf-lbl { color: #666; font-weight: 600; }
[data-theme="dark"] .conf-lbl { color: #94a3b8; }
.conf-val { font-weight: 600; }
.modal-btns { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; }
.btn-confirm { background: #16a34a; color: #fff; border: none; padding: 11px 24px; border-radius: 8px; cursor: pointer; font-size: 15px; font-weight: 700; }
.btn-confirm:hover { background: #15803d; }
.rules-note { font-size: 12px; color: #888; margin-top: 14px; }
.rules-note a { color: #2563eb; }

/* ── Before/after comparison (reschedule) ─────────────────────────────────── */
.rp-before-card {
    background: #fff7ed; border: 1px solid #fdba74; border-radius: 12px;
    padding: 14px 18px; margin-bottom: 18px;
}
[data-theme="dark"] .rp-before-card { background: rgba(217,119,6,.12); border-color: #b45309; }
.rp-before-card .rp-before-lbl { font-size: 11px; font-weight: 700; color: #b45309; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 6px; }
[data-theme="dark"] .rp-before-card .rp-before-lbl { color: #fbbf24; }
