/* =========================================================
   Calendar Module — Mode 1 (visual calendar) + Mode 2 (public booking)
   Added S07 (2026-05-30). Loads AFTER app.css; reuses its :root tokens
   (--pink, --cream, --border, --navy/--ink, --radius, --shadow, etc.).
   Light theme only, FPA brand.
   ========================================================= */

/* ---------- shared small helpers ---------- */
.mt-2 { margin-top: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row .form-control, .copy-row input { flex: 1; }

/* ===== Sessions multi-select (bulk delete) ===== */
.chk-col { width: 34px; text-align: center; }
.chk-col input { width: 16px; height: 16px; cursor: pointer; }
.bulk-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding: 10px 14px; background: var(--pink-mist, #FDEEF3); border: 1px solid var(--pink-line, var(--border)); border-radius: var(--radius); }
.bulk-bar .bulk-count { font-size: 13.5px; color: var(--ink); margin-right: auto; }

/* ===== Mode 1 — Visual calendar ===== */
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.cal-left { display: flex; align-items: center; gap: 14px; }
.cal-right { display: flex; align-items: center; gap: 10px; }
.cal-title { font-size: 1.5rem; margin: 0; white-space: nowrap; }
.cal-nav { display: flex; gap: 6px; }
.cal-views { display: inline-flex; background: var(--white); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.cal-viewbtn { padding: 7px 14px; font-size: 13px; font-weight: 600; color: var(--ink); border-right: 1px solid var(--border); }
.cal-viewbtn:last-child { border-right: none; }
.cal-viewbtn:hover { background: var(--cream, var(--surface-2)); text-decoration: none; }
.cal-viewbtn.active { background: var(--pink); color: var(--white); }

/* Month grid */
.cal-month { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
/* Header + grid use the SAME 1px-gap-over-border technique so columns line up exactly. */
.cal-weekhead { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--border); }
.cal-wh { background: var(--surface-2, var(--cream)); padding: 9px 8px; font-size: 12px; font-weight: 700; color: var(--ink); text-transform: uppercase; letter-spacing: 0.03em; min-width: 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--border); }
/* min-width:0 stops a long no-wrap session chip from forcing its column wider than the rest. */
.cal-day { background: var(--white); min-width: 0; min-height: 116px; padding: 6px; position: relative; display: flex; flex-direction: column; gap: 4px; }
.cal-day.dim { background: var(--bg); }
.cal-day.dim .cal-daynum { color: var(--muted); }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--pink); }
.cal-daynum { align-self: flex-end; font-size: 13px; font-weight: 700; color: var(--ink); width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 6px; }
.cal-daynum:hover { background: var(--surface-2, var(--cream)); text-decoration: none; }
.cal-day.today .cal-daynum { background: var(--pink); color: var(--white); }
.cal-chips { display: flex; flex-direction: column; gap: 3px; }
.cal-chip { display: flex; flex-direction: column; gap: 0; max-width: 100%; color: #fff; padding: 3px 6px; border-radius: 5px; overflow: hidden; }
.cal-chip:hover { text-decoration: none; opacity: 0.9; }
.cal-chip-main { font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.cal-chip-meta { font-size: 10px; font-weight: 500; opacity: 0.88; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.cal-more { font-size: 11px; font-weight: 600; color: var(--muted); padding: 0 4px; }
/* Multi-day spanning events */
.cal-chip-span { border-radius: 5px; }
.cal-chip-span:not(.cal-chip-cont) { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: -2px; }
.cal-chip-cont { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -2px; border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: -2px; opacity: 0.82; }
.cal-chip-cont.cal-chip-last { border-top-right-radius: 5px; border-bottom-right-radius: 5px; margin-right: 0; }

/* Week / Day time grid */
.cal-time { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.cal-time-head { display: flex; border-bottom: 1px solid var(--border); background: var(--surface-2, var(--cream)); }
.cal-axis-spacer { width: 56px; flex: none; border-right: 1px solid var(--border); }
.cal-colhead { flex: 1; padding: 8px; text-align: center; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.cal-colhead:last-child { border-right: none; }
.cal-colhead:hover { background: var(--white); text-decoration: none; }
.cal-colhead.today { background: var(--pink-mist, #FDEEF3); }
.cal-colname { font-size: 12px; font-weight: 700; color: var(--ink); text-transform: uppercase; }
.cal-colnum { font-size: 12px; color: var(--muted); }
.cal-time-body { display: flex; position: relative; }
.cal-axis { width: 56px; flex: none; border-right: 1px solid var(--border); }
.cal-axis-h { position: relative; }
.cal-axis-h span { position: absolute; top: -8px; right: 6px; font-size: 11px; color: var(--muted); }
.cal-cols { display: flex; flex: 1; }
.cal-col { flex: 1; position: relative; border-right: 1px solid var(--border); }
.cal-col:last-child { border-right: none; }
.cal-slot { border-bottom: 1px solid var(--border); }
.cal-block { position: absolute; left: 3px; right: 3px; color: #fff; border-radius: 6px; padding: 4px 6px; overflow: hidden; display: flex; flex-direction: column; gap: 1px; box-shadow: var(--shadow); }
.cal-block:hover { text-decoration: none; opacity: 0.92; }
.cal-block-time { font-size: 10.5px; font-weight: 600; opacity: 0.95; }
.cal-block-title { font-size: 12px; font-weight: 700; line-height: 1.2; }
.cal-block-venue { font-size: 10.5px; opacity: 0.9; }
.cal-block-meta { font-size: 10px; font-weight: 500; opacity: 0.85; margin-top: 1px; }

/* Legend */
.cal-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; padding: 10px 4px; }
.cal-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); }
.cal-legend-dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* Month grid collapses to a stacked day list on mobile */
@media (max-width: 640px) {
  .cal-grid { grid-template-columns: 1fr; }
  .cal-weekhead { display: none; }
  .cal-day { min-height: auto; flex-direction: row; align-items: flex-start; gap: 10px; }
  .cal-daynum { align-self: flex-start; }
  .cal-time-body { overflow-x: auto; }
  .cal-cols { min-width: 560px; }
  .form-row { grid-template-columns: 1fr; }
}

/* ===== Mode 2 — Public booking + trainer admin ===== */
.book-wrap { max-width: 920px; margin: 28px auto; padding: 0 18px; }
.book-head { margin-bottom: 18px; }
.public-brand { font-family: 'Outfit', sans-serif; font-weight: 700; color: var(--pink); letter-spacing: 0.02em; font-size: 20px; margin-bottom: 10px; }
.public-brand span { color: var(--ink); font-weight: 600; }
.book-bio { margin-top: 4px; }
.book-alert { background: var(--red-soft, #FEE2E2); color: var(--red, #B91C1C); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13.5px; font-weight: 500; }
.book-cols { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; align-items: start; }
.book-h2 { font-size: 1.15rem; margin: 0 0 10px; }
.book-slots { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.book-daylist { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.book-day { border-top: 1px solid var(--border); padding-top: 10px; }
.book-dayname { font-weight: 700; color: var(--ink); font-size: 13.5px; margin-bottom: 8px; }
.book-times { display: flex; flex-wrap: wrap; gap: 8px; }
.book-time { border: 1px solid var(--pink-line, var(--border)); background: var(--white); color: var(--pink-dark, var(--pink)); font-weight: 600; font-size: 13px; padding: 7px 12px; border-radius: 8px; cursor: pointer; transition: all .12s; }
.book-time:hover { background: var(--pink-mist, #FDEEF3); }
.book-time.sel { background: var(--pink); color: #fff; border-color: var(--pink); }
.book-form { /* uses .card */ }
.book-selected { padding: 9px 12px; border: 1px dashed var(--border); border-radius: 8px; background: var(--bg); font-weight: 600; color: var(--ink); }

/* Confirmation page */
.book-confirm { max-width: 560px; text-align: center; }
.book-check { width: 56px; height: 56px; margin: 8px auto 14px; border-radius: 50%; background: var(--green-soft, #F0FDF4); color: var(--green, #16A34A); font-size: 30px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.book-summary { text-align: left; margin: 18px 0; display: flex; flex-direction: column; gap: 10px; }
.book-summary > div { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.book-summary > div:last-child { border-bottom: none; }

/* Trainer admin: availability + inbox */
.book-saved { background: var(--green-soft, #F0FDF4); color: var(--green, #16A34A); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13.5px; font-weight: 500; }
.avail-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.avail-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--border); }
.avail-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.avail-table input[type=time] { max-width: 140px; }
.book-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.book-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--white); color: var(--ink); font-size: 13px; font-weight: 600; }
.book-chip:hover { background: var(--surface-2, var(--cream)); text-decoration: none; }
.book-chip.active { background: var(--pink); color: #fff; border-color: var(--pink); }
.book-chip-n { background: rgba(0,0,0,0.08); border-radius: 999px; padding: 0 7px; font-size: 11.5px; }
.book-chip.active .book-chip-n { background: rgba(255,255,255,0.25); }

@media (max-width: 760px) {
  .book-cols { grid-template-columns: 1fr; }
}
