/* booking.css - Phase 6 booking drawer.
   Stage 1: drawer scaffolding + hover-revealed plus handle in empty slots.
   Form fields, conflict warnings, and submit land in later stages. */

/* ── Drawer ──────────────────────────────────────────────────────────────── */

.booking-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 360px;
  max-width: 100vw;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: -4px 0 16px var(--color-shadow);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform var(--transition);
}

/* Override the .hidden { display: none !important } utility — we want the
   drawer to slide off-screen, not vanish, so the transition is visible. */
.booking-panel.hidden {
  display: flex !important;
  transform: translateX(100%);
  pointer-events: none;
}

.booking-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.booking-panel-header h3 {
  flex: 1;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
}

.booking-panel-close {
  font-size: 20px;
  width: 28px;
  height: 28px;
}

.booking-panel-body {
  flex: 1;
  overflow: auto;
  padding: 16px 18px;
}

.booking-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  min-width: 0;
}

.booking-field-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.booking-field-control {
  font-family: inherit;
  font-size: 12px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  min-width: 0;
  width: 100%;
}
.booking-field-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-light);
}
.booking-field-control[disabled],
.booking-field-control[readonly] {
  background: var(--color-bg);
  color: var(--color-text-muted);
}

/* Side-by-side groups (date+time+duration, type+incentive). */
.booking-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.booking-row .booking-field {
  flex: 1;
  margin-bottom: 0;
}
.booking-field-narrow { flex: 0 0 84px; }

.booking-field-checkbox {
  flex-direction: row;
  align-items: center;
  margin-bottom: 8px;
}
.booking-field-checkbox label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--color-text);
  cursor: pointer;
  user-select: none;
}
.booking-field-checkbox input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--color-primary);
}

.booking-field-recurrence {
  padding: 10px 12px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

/* Recurring-event scope (this occurrence / entire series). Sits above the
   teacher field in edit mode; hidden when the event is not part of a series. */
.booking-field-scope {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  margin: 0 0 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}
.booking-field-scope[hidden] { display: none; }
.booking-field-scope legend {
  padding: 0 4px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.booking-scope-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--color-text);
  cursor: pointer;
  user-select: none;
}
.booking-scope-option input[type="radio"] {
  width: 14px;
  height: 14px;
  accent-color: var(--color-primary);
  cursor: pointer;
}
.booking-scope-option input[type="radio"]:disabled {
  cursor: not-allowed;
}

.booking-field-hint {
  font-size: 10px;
  color: var(--color-text-muted);
  font-style: italic;
}

/* ── Conflict banner ─────────────────────────────────────────────────────── */

.booking-conflict-banner {
  margin: 4px 0 14px;
  padding: 10px 12px;
  background: #fff7d6;
  border: 1px solid #e6c200;
  border-left: 3px solid #c79100;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: #5a4500;
}
.booking-conflict-banner[hidden] { display: none; }

.booking-conflict-summary {
  font-weight: 600;
  margin-bottom: 6px;
}

.booking-conflict-list {
  margin: 0 0 8px;
  padding-left: 18px;
  list-style: disc;
}
.booking-conflict-list li {
  margin: 2px 0;
  line-height: 1.35;
}
.booking-conflict-list .bk-clash-time {
  color: #5a4500;
  font-variant-numeric: tabular-nums;
  margin-right: 6px;
}
.booking-conflict-list .bk-clash-title {
  color: var(--color-text);
}
.booking-conflict-list .bk-clash-wh {
  color: #8a3a00;
  font-style: italic;
}

.booking-conflict-override {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--color-text);
  cursor: pointer;
  user-select: none;
}
.booking-conflict-override input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: #c79100;
}

.booking-panel-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
  margin-top: 4px;
}
.booking-panel-footer .btn-primary[disabled] {
  background: var(--color-border);
  cursor: not-allowed;
}
.booking-panel-footer-spacer { flex: 1; }

/* Destructive footer action — red text + red border, secondary chrome. */
.bk-delete-btn {
  color: #DC2626;
  border-color: #f4b4b4;
}
.bk-delete-btn:hover {
  color: #991B1B;
  background: #fdecec;
  border-color: #DC2626;
}

/* Read-only schedulers see the panel populated but can't act on it. The CSS
   gate is the canonical hook (matches phase 5 + booking-handle pattern). */
body.is-read-only #bk-submit,
body.is-read-only #bk-delete,
body.is-read-only #bk-unlock,
body.is-read-only #bk-onsite,
body.is-read-only .booking-onsite-toggle,
body.is-read-only #bk-loc-add,
body.is-read-only #bk-loc-add-form {
  display: none;
}

/* ── Location field: Onsite filter + add-new affordance ──────────────────── */

.booking-field-labelrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.booking-onsite-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  cursor: pointer;
  user-select: none;
}
.booking-onsite-toggle input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

.booking-location-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.booking-location-row .booking-field-control { flex: 1; }
.btn-add-loc {
  width: 28px;
  flex-shrink: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
}
.btn-add-loc:hover { background: var(--color-bg); }
.btn-add-loc[disabled] { opacity: 0.5; cursor: default; }

.booking-add-loc {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.booking-add-loc[hidden] { display: none; }
.booking-add-loc .booking-field-control { flex: 1; }

/* ── Empty-slot plus handle ──────────────────────────────────────────────── */

/* A single floating "+" marker, repositioned by booking.js as the cursor
   moves over a column. Snapped to 15-min increments so users see exactly
   where the new event would start. */
.day-col-plus-handle {
  position: absolute;
  left: 50%;
  width: 22px;
  height: 22px;
  margin-left: -11px;
  margin-top: -11px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  pointer-events: none;
  box-shadow: 0 1px 4px var(--color-shadow);
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 2;
}

.day-col-plus-handle.is-visible {
  opacity: 0.85;
}

/* Hide booking affordances entirely for non-schedulers. The click handler
   in booking.js also no-ops on read-only — CSS handles the visual, JS
   handles the behaviour. */
body.is-read-only .day-col-plus-handle {
  display: none;
}
