/* css/buggy.css
   Buggy + radio booking UI — daily timeline + request drawer.
   Variables reuse css/style.css palette. */

.buggy-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0 16px;
}
.buggy-controls input[type="date"] {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
}
.buggy-controls .btn--primary { margin-left: auto; }

.buggy-state {
  padding: 24px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  text-align: center;
  color: var(--color-text-muted);
}
.buggy-state-error {
  background: #fbeae7;
  color: var(--color-danger);
  border-color: #f0c2b9;
}

/* Timeline — buggies as rows, hours as columns. Sticky first column for the
   buggy name, horizontal scroll on narrow screens. */
.buggy-timeline {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow-x: auto;
}
.buggy-grid {
  display: grid;
  grid-template-columns: 120px repeat(var(--buggy-hours, 14), minmax(60px, 1fr));
  min-width: 100%;
}
.buggy-grid__header {
  font-weight: 600;
  font-size: 13px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--color-border);
  background: #f8f8f6;
  color: var(--color-text-muted);
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 1;
}
.buggy-grid__header.is-name {
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 2;
  background: #f8f8f6;
}
.buggy-grid__name {
  font-weight: 600;
  padding: 10px 8px;
  border-bottom: 1px solid var(--color-border);
  background: #fff;
  position: sticky;
  left: 0;
  z-index: 1;
}
.buggy-grid__cell {
  border-bottom: 1px solid var(--color-border);
  border-left: 1px solid #eeeeec;
  min-height: 56px;
  position: relative;
}

/* Booking pill. Yellow = ad-hoc buggy_bookings; blue = guide tour shift
   (staff_schedule_slots.assigned_buggy_id). */
.buggy-pill {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 11px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
}
.buggy-pill--booking { background: #fff8d9; border-color: #efe2a0; color: #6a5530; }
.buggy-pill--guide   { background: #e5edf6; border-color: #b8cce0; color: #2b5a8a; }
.buggy-pill--cancelled { background: #f0f0ee; color: #999; text-decoration: line-through; }

/* Drawer (mobile-first bottom-sheet, desktop centered modal). */
.buggy-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 100;
}
.buggy-drawer-backdrop[hidden] { display: none; }

.buggy-drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 16px 16px 0 0;
  z-index: 101;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
}
.buggy-drawer[hidden] { display: none; }

.buggy-drawer__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--color-border);
}
.buggy-drawer__header h2 { font-size: 16px; margin: 0; color: var(--color-primary); }
.buggy-drawer__close {
  background: none; border: 0; font-size: 24px; cursor: pointer;
  width: 44px; height: 44px; color: var(--color-text-muted);
}

.buggy-drawer-form {
  padding: 16px;
  display: grid;
  gap: 12px;
}
.buggy-drawer-form label {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--color-text-muted);
}
.buggy-drawer-form input,
.buggy-drawer-form select,
.buggy-drawer-form textarea {
  font: inherit;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: #fff;
  color: #222;
}

.buggy-drawer__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid var(--color-border);
}

/* Inline conflict block — surfaced after a 409 response. */
.buggy-conflict {
  background: #fff4d9;
  border: 1px solid #efd17a;
  border-radius: 6px;
  padding: 12px;
  margin-top: 8px;
  font-size: 13px;
  color: #6a5530;
}
.buggy-conflict h4 { margin: 0 0 6px; font-size: 13px; }
.buggy-conflict-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.buggy-conflict-suggestions button {
  font: inherit;
  font-size: 12px;
  background: #fff;
  border: 1px solid #efd17a;
  color: var(--color-primary);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
}
.buggy-conflict-suggestions button:hover { background: #f8e9b8; }

/* Standard btn rules (kept local to avoid touching style.css). */
.btn {
  padding: 8px 14px;
  border-radius: 6px;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  min-height: 36px;
}
.btn--primary {
  background: var(--color-primary);
  color: #fff;
}
.btn--primary:hover:not([disabled]) { background: #244012; }
.btn--secondary {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}
.btn--secondary:hover:not([disabled]) {
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn[disabled] { opacity: 0.5; cursor: wait; }

@media (min-width: 768px) {
  .buggy-drawer {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    transform: translate(-50%, -50%);
    max-width: 480px;
    width: 90%;
    border-radius: 12px;
    max-height: 80vh;
  }
}
