/* SAU — public Book page (Views/Book/Index.cshtml). Mobile-first.
   Colours come from the site's --sau-* tokens, so .sport-badminton turns it blue. */

.bk {
    --bk-line: #e3e8e5;
    --bk-text: #14231b;
    --bk-muted: #66756c;
    --bk-faint: #9aa59f;
    --bk-surface: #fff;
    --bk-tab: 0px;                 /* set by book.js = height of the site's mobile tab bar */
    background: #f4f7f5;
    overflow-x: clip;              /* the page never slides sideways on phones (clip keeps sticky working) */
    padding: .9rem 0 1.5rem;
    min-height: calc(100vh - 70px);
}
.bk-wrap { max-width: 1140px; }

/* ---------- heading + sport switch ---------- */
.bk-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.bk-title h1 { font-size: 1.25rem !important; font-weight: 800; color: var(--sau-dark); margin: 0; letter-spacing: -.01em; }
.bk-title p { margin: .1rem 0 0; font-size: .8rem; color: var(--bk-muted); }
.bk-sports { display: inline-flex; background: #fff; border: 1px solid var(--bk-line); border-radius: 10px; padding: 3px; gap: 2px; }
.bk-sport {
    display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .85rem; border-radius: 8px;
    font-size: .84rem; font-weight: 700; color: var(--bk-muted); text-decoration: none; white-space: nowrap;
    transition: background .15s, color .15s;
}
.bk-sport:hover { color: var(--sau-dark); }
.bk-sport.on { background: var(--sau-light); color: var(--sau-mid); }

/* ---------- layout ---------- */
.bk-layout { display: block; }
.bk-main { min-width: 0; }
.bk-side { display: none; }

/* ---------- date strip ---------- */
.bk-dates {
    display: flex; align-items: stretch; gap: .4rem;
    background: #fff; border: 1px solid var(--bk-line); border-radius: 12px; padding: .4rem;
}
.bk-strip {
    flex: 1; min-width: 0; display: flex; gap: .3rem; overflow-x: auto;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; overscroll-behavior-x: contain;
}
.bk-strip::-webkit-scrollbar { display: none; }
.bk-day {
    flex: 0 0 auto; width: 52px; scroll-snap-align: start;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    padding: .4rem 0 .35rem; border-radius: 9px; border: 1px solid transparent; background: none;
    color: var(--bk-text); cursor: pointer; position: relative; transition: background .15s, border-color .15s, color .15s;
}
.bk-day .dw { font-size: .66rem; font-weight: 700; color: var(--bk-muted); text-transform: uppercase; letter-spacing: .03em; }
.bk-day .dn { font-size: 1.05rem; font-weight: 800; line-height: 1.15; }
.bk-day .mo { font-size: .64rem; color: var(--bk-faint); font-weight: 600; }
.bk-day:hover { background: #f3f6f4; }
.bk-day.is-today .dw { color: var(--sau-mid); }
.bk-day.on { background: var(--sau-mid); border-color: var(--sau-mid); color: #fff; }
.bk-day.on .dw, .bk-day.on .mo { color: rgba(255,255,255,.85); }
.bk-dnav {
    flex: 0 0 auto; width: 30px; border: 0; background: none; border-radius: 8px; color: var(--bk-muted);
    display: none; align-items: center; justify-content: center; cursor: pointer;
}
.bk-dnav:hover:not(:disabled) { background: #f3f6f4; color: var(--sau-dark); }
.bk-dnav:disabled { opacity: .3; cursor: default; }
.bk-cal {
    flex: 0 0 auto; position: relative; display: flex; align-items: center; justify-content: center; gap: .35rem;
    min-width: 44px; padding: 0 .65rem; border-radius: 9px; border: 1px solid var(--bk-line);
    font-size: .8rem; font-weight: 700; color: var(--sau-dark); cursor: pointer; margin: 0; background: #fff;
}
.bk-cal:hover { background: #f3f6f4; }
.bk-cal i { font-size: 1rem; }
/* The real date input covers the button: tapping it opens the native picker everywhere,
   including Facebook's in-app browser. */
.bk-cal input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }

/* ---------- day heading ---------- */
.bk-dayhead { display: flex; align-items: flex-end; justify-content: space-between; gap: .75rem; margin: .85rem 0 .55rem; flex-wrap: wrap; }
.bk-daytitle { font-size: .98rem; font-weight: 800; color: var(--bk-text); }
.bk-daymeta { font-size: .76rem; color: var(--bk-muted); min-height: 1.1rem; }
.bk-daymeta b { color: var(--sau-mid); }
/* status key: Open / Booked */
.bk-key { display: flex; gap: .85rem; font-size: .74rem; font-weight: 600; color: var(--bk-muted); }
.bk-key span { display: inline-flex; align-items: center; gap: .35rem; }
.bk-key i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.bk-key .k-open i { background: #fff; border: 2px solid var(--open); }
.bk-key .k-booked i { background: var(--booked-bg); border: 2px solid var(--booked-line); }

/* ---------- slot blocks ---------- */
.bk {
    --open: #16a34a;               /* open slot = one bright colour */
    --open-line: #86efac;
    --open-bg: #f0fdf4;
    --booked-bg: #f1f2f4;
    --booked-line: #dcdfe4;
    --booked-ink: #e11d48;
}
.sport-badminton.bk, .sport-badminton .bk { --open: #2563eb; --open-line: #93c5fd; --open-bg: #eff6ff; }
.bk-grid { display: flex; flex-direction: column; gap: .8rem; min-height: 140px; }
.bk-block {
    background: #fff; border: 1px solid var(--bk-line); border-radius: 14px; padding: .7rem;
    box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.bk-bhead { display: flex; align-items: center; gap: .6rem; margin: 0 0 .6rem; }
.bk-bico {
    flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.05rem; color: var(--b); background: var(--b-bg);
}
.b-morning { --b: #d97706; --b-bg: #fef3c7; }
.b-offpeak { --b: #0284c7; --b-bg: #e0f2fe; }
.b-peak    { --b: #7c3aed; --b-bg: #ede9fe; }
.bk-bname { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.bk-bname b { font-size: .95rem; font-weight: 800; color: var(--bk-text); }
.bk-bname small { font-size: .72rem; color: var(--bk-muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-bfree {
    flex: 0 0 auto; font-size: .72rem; font-weight: 800; padding: .25rem .6rem; border-radius: 999px;
    color: var(--open); background: var(--open-bg); border: 1px solid var(--open-line); white-space: nowrap;
}
.bk-bfree.none { color: var(--bk-muted); background: var(--booked-bg); border-color: var(--booked-line); }

.bk-slots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.bk-slot {
    position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px;
    min-height: 66px; padding: .55rem .7rem; text-align: left;
    background: #fff; border: 1.5px solid var(--bk-line); border-radius: 12px;
    color: var(--bk-text); cursor: pointer; overflow: hidden;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease, transform .2s cubic-bezier(.2,.8,.2,1), color .2s ease;
    -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.bk-slot .t { font-size: .9rem; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; }
.bk-slot .t.long { font-size: .8rem; letter-spacing: -.02em; }
.bk-slot .lb { font-size: .68rem; font-weight: 600; color: var(--bk-muted); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bk-slot .pr { font-size: .84rem; display: flex; align-items: baseline; gap: .3rem; margin-top: 1px; }
.bk-slot .pr b { font-weight: 800; }
.bk-slot .pr s { color: var(--bk-faint); font-size: .72rem; }
.bk-slot .ck { position: absolute; top: .5rem; right: .55rem; font-size: 1.05rem; }

/* open: bright, the thing your eye lands on */
.bk-slot.is-open { background: linear-gradient(180deg, #fff 0%, var(--open-bg) 100%); border-color: var(--open-line); }
.bk-slot.is-open .pr b { color: var(--open); }
.bk-slot.is-open::after { /* "free" dot */
    content: ''; position: absolute; top: .6rem; right: .6rem; width: 8px; height: 8px; border-radius: 50%;
    background: var(--open); box-shadow: 0 0 0 3px color-mix(in srgb, var(--open) 18%, transparent);
}
@media (hover: hover) {
    .bk-slot.is-open:hover { border-color: var(--open); transform: translateY(-2px); box-shadow: 0 6px 16px color-mix(in srgb, var(--open) 18%, transparent); }
}
.bk-slot.is-open:active { transform: scale(.97); }
.bk-slot:focus-visible { outline: 2px solid var(--open); outline-offset: 2px; }

/* selected: solid fill, white text */
.bk-slot.is-sel, .bk-slot.is-sel:hover {
    background: var(--open); border-color: var(--open); color: #fff;
    box-shadow: 0 6px 18px color-mix(in srgb, var(--open) 35%, transparent);
}
.bk-slot.is-sel::after { display: none; }
.bk-slot.is-sel .pr b, .bk-slot.is-sel .lb, .bk-slot.is-sel .pr s, .bk-slot.is-sel .ck { color: #fff; }
.bk-slot.is-sel .lb, .bk-slot.is-sel .pr s { opacity: .85; }

/* booked / not open: clearly readable, clearly taken */
.bk-slot.is-off { background: var(--booked-bg); border-color: var(--booked-line); cursor: not-allowed; }
.bk-slot.is-off .t { color: #6b7280; }
.bk-slot.is-off .lb { color: #9ca3af; }
.bk-slot .tag {
    display: inline-flex; align-items: center; gap: .25rem; font-size: .68rem; font-weight: 800; letter-spacing: .02em;
    text-transform: uppercase; padding: .12rem .45rem; border-radius: 6px;
}
.bk-slot.is-booked .tag { color: var(--booked-ink); background: #ffe4e8; }
.bk-slot.is-closed .tag { color: #6b7280; background: #e5e7eb; }
.bk-slot .tag i { font-size: .62rem; }

/* smooth entrance when a date is opened */
.bk-grid.is-anim .bk-block { animation: bkIn .35s cubic-bezier(.2,.8,.2,1) both; }
.bk-grid.is-anim .bk-block:nth-child(2) { animation-delay: .06s; }
.bk-grid.is-anim .bk-block:nth-child(3) { animation-delay: .12s; }
@keyframes bkIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* skeleton + messages */
.bk-slot.is-skel { cursor: default; gap: .4rem; }
.skel { display: block; height: 10px; border-radius: 5px; background: linear-gradient(90deg, #edf0ee 25%, #f6f8f7 37%, #edf0ee 63%); background-size: 400% 100%; animation: bkSkel 1.2s ease infinite; }
.skel.w60 { width: 60%; height: 12px; } .skel.w40 { width: 40%; } .skel.w30 { width: 90px; }
.skel.inline { display: inline-block; vertical-align: middle; }
@keyframes bkSkel { 0% { background-position: 100% 50% } 100% { background-position: 0 50% } }
.bk-msg {
    grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: .35rem;
    padding: 2rem 1rem; background: #fff; border: 1px dashed var(--bk-line); border-radius: 12px; color: var(--bk-muted); font-size: .88rem; text-align: center;
}
.bk-msg > i { font-size: 1.5rem; color: var(--bk-faint); }
.bk-retry { margin-top: .35rem; border: 1px solid var(--sau-mid); color: var(--sau-mid); background: #fff; border-radius: 8px; padding: .35rem .9rem; font-weight: 700; font-size: .82rem; cursor: pointer; }
.bk-retry:hover { background: var(--sau-light); }
.bk-foot { margin: .9rem 0 0; font-size: .76rem; color: var(--bk-muted); text-align: center; }

/* ---------- summary (shared by desktop panel + mobile sheet) ---------- */
.bk-sum { font-size: .86rem; color: var(--bk-text); }
.bk-sum-empty { display: flex; gap: .75rem; align-items: center; color: var(--bk-muted); padding: .25rem 0; }
.bk-sum-empty > i { font-size: 1.4rem; color: var(--sau-mid); background: var(--sau-light); width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.bk-sum-empty b { display: block; color: var(--bk-text); font-size: .9rem; }
.bk-sum-empty span { font-size: .8rem; }
.bk-sum-head { display: flex; align-items: center; justify-content: space-between; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--bk-faint); margin-bottom: .5rem; }
.bk-x { border: 0; background: none; color: var(--bk-faint); width: 28px; height: 28px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.bk-x:hover { background: #f1f4f2; color: var(--bk-text); }
.bk-sum-slot { padding-bottom: .7rem; border-bottom: 1px solid var(--bk-line); }
.bk-sum-time { font-size: 1.2rem; font-weight: 800; letter-spacing: -.01em; }
.bk-sum-meta { font-size: .8rem; color: var(--bk-muted); margin-top: .1rem; }
.bk-sum-lb { display: inline-block; margin-top: .35rem; background: #faf5ff; color: #7c3aed; border: 1px solid #e9d5ff; font-weight: 700; font-size: .7rem; border-radius: 6px; padding: .05rem .45rem; }
.bk-sum-rows { margin: .6rem 0 .8rem; }
.bk-sum-rows > div { display: flex; justify-content: space-between; gap: .75rem; padding: .22rem 0; }
.bk-sum-rows dt { font-weight: 500; color: var(--bk-muted); }
.bk-sum-rows dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.bk-sum-rows .ok dt, .bk-sum-rows .ok dd { color: #15803d; }
.bk-sum-rows .hl { margin-top: .2rem; padding: .45rem .6rem; background: var(--sau-light); border-radius: 8px; }
.bk-sum-rows .hl dt { color: var(--sau-dark); font-weight: 700; }
.bk-sum-rows .hl dd { color: var(--sau-mid); font-size: 1rem; }
.bk-sum-rows .due dt, .bk-sum-rows .due dd { font-size: .8rem; }
.bk-pay {
    width: 100%; display: flex; align-items: center; justify-content: center; gap: .45rem;
    border: 0; border-radius: 10px; padding: .75rem; font-weight: 800; font-size: .95rem; color: #fff;
    background: var(--sau-mid); cursor: pointer; transition: filter .15s, transform .1s; position: relative;
}
.bk-pay.is-online { background: #0A0A0A; color: #2DE024; }
.bk-pay-methods { display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem; margin-top: .5rem; font-size: .72rem; color: var(--bk-muted, #6b7280); }
.bk-pay:hover { filter: brightness(.95); }
.bk-pay:active { transform: scale(.99); }
.bk-pay:disabled { opacity: .7; cursor: wait; }
.bk-pay.is-loading { color: transparent; }
.bk-pay.is-loading::after { content: ''; position: absolute; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: bkSpin .6s linear infinite; }
@keyframes bkSpin { to { transform: rotate(360deg) } }
.bk-sum-note { margin-top: .55rem; font-size: .74rem; color: var(--bk-muted); text-align: center; }

/* ---------- mobile bar + sheet ---------- */
.bk-bar {
    position: fixed; left: .6rem; right: .6rem; z-index: 1001;
    bottom: calc(var(--bk-tab, 0px) + .5rem);   /* --bk-tab: tab bar height, or the safe-area inset when there's no tab bar */
    display: flex; align-items: center; gap: .5rem; padding: .45rem .45rem .45rem .85rem;
    background: #0f2a1d; color: #fff; border-radius: 14px; box-shadow: 0 10px 28px rgba(0,0,0,.22);
    transform: translateY(calc(100% + 120px)); transition: transform .2s cubic-bezier(.4,0,.2,1);
}
.sport-badminton.bk-bar { background: #172554; }
.bk-bar.show { transform: none; }
.bk-bar-info { flex: 1; min-width: 0; border: 0; background: none; color: inherit; text-align: left; padding: 0; display: flex; flex-direction: column; cursor: pointer; }
.bk-bar-time { font-weight: 800; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-bar-sub { font-size: .74rem; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-bar-go {
    flex: 0 0 auto; border: 0; border-radius: 10px; padding: .6rem 1rem; font-weight: 800; font-size: .88rem;
    background: var(--sau-gold, #2DE024); color: #2b2100; display: inline-flex; align-items: center; gap: .35rem; cursor: pointer;
}
body.bk-has-bar .sau-wa-btn { display: none; }
body.bk-has-bar .bk { padding-bottom: 6rem; }

.bk-sheet.offcanvas-bottom { height: auto; max-height: 85vh; border-radius: 18px 18px 0 0; border-top: 0; }
.bk-sheet .offcanvas-body { padding: .4rem 1.1rem calc(1.1rem + env(safe-area-inset-bottom)); }
.bk-sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: #d6ddd9; margin: .55rem auto .35rem; }

.bk-toast {
    position: fixed; left: 50%; top: 84px; transform: translate(-50%, -12px); z-index: 1100;
    background: #1f2937; color: #fff; padding: .55rem .9rem; border-radius: 10px; font-size: .84rem; font-weight: 500;
    box-shadow: 0 10px 28px rgba(0,0,0,.2); opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; max-width: calc(100% - 2rem); text-align: center;
}
.bk-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- ≥ 576: 3 columns ---------- */
@media (min-width: 576px) {
    .bk-slots { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .bk-day { width: 58px; }
}
/* ---------- ≥ 768 ---------- */
@media (min-width: 768px) {
    .bk { padding-top: 1.25rem; }
    .bk-title h1 { font-size: 1.4rem !important; }
    .bk-dnav { display: flex; }
    .bk-strip { justify-content: space-between; }
    .bk-day { flex: 1 1 0; width: auto; min-width: 50px; }
    .bk-slots { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .bk-bar { left: 50%; right: auto; width: min(520px, calc(100% - 2rem)); transform: translate(-50%, calc(100% + 120px)); }
    .bk-bar.show { transform: translate(-50%, 0); }
}
/* ---------- ≥ 992: two columns + sticky summary, no bar ---------- */
@media (min-width: 992px) {
    .bk-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
    .bk-side { display: block; position: sticky; top: 96px; }
    .bk-side .bk-sum { background: #fff; border: 1px solid var(--bk-line); border-radius: 14px; padding: 1rem 1.1rem; box-shadow: 0 1px 3px rgba(16,24,40,.05); }
    .bk-slots { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .bk-bar, .bk-sheet { display: none !important; }
    body.bk-has-bar .sau-wa-btn { display: flex; }
    body.bk-has-bar .bk { padding-bottom: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) {
    .bk *, .bk-bar, .bk-toast { transition: none !important; animation: none !important; }
}
/* neutral slot-label chip in the summary */
.bk-sum-lb { background: #f1f4f2; color: #4b5852; border-color: #e1e7e3; font-weight: 600; }

/* today = small dot under the date */
.bk-day.is-today .dw { color: var(--bk-muted); }
.bk-day.is-today::after { content: ''; position: absolute; bottom: 3px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--sau-mid); }
.bk-day.on.is-today::after { background: #fff; }
.bk-day.on.is-today .dw { color: rgba(255,255,255,.85); }
.bk-day.is-today::after { bottom: auto; top: 5px; left: auto; right: 6px; margin: 0; width: 5px; height: 5px; }

