/* HMS-339 — Booking management page (.booking-mgmt) */

.booking-mgmt {
  display: flex;
  flex-direction: column;
  gap: var(--wa-space-m);
}

.booking-mgmt__title {
  margin: 0;
  font-size: var(--wa-font-size-xl);
  font-weight: var(--wa-font-weight-bold);
}

.booking-mgmt__event {
  color: var(--wa-color-text-quiet);
  font-size: var(--wa-font-size-s);
}

.booking-mgmt__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: var(--wa-space-s) var(--wa-space-m);
}

/* HMS-1198 — search + hotel-ack filter share their own row above the table. */
.booking-mgmt__search {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: var(--wa-space-m);
}

.booking-mgmt__search wa-input {
  flex: 0 1 20rem;
}

/* Wide enough that "Needs attention" / "Acknowledged" read in full, label on one line. */
.booking-mgmt__ack {
  flex: 0 0 15rem;
}

.booking-mgmt__ack::part(label) {
  white-space: nowrap;
}

.booking-mgmt__ack::part(listbox) {
  min-width: 15rem;
}

/* WA native.css gives every <button> display:inline-flex, which beats the UA
   [hidden] rule. The button only exists so Enter submits the search form. */
.booking-mgmt__search button[hidden] {
  display: none;
}

/* Figma shows an icon-only search box — keep the label for the accessible name
   but hide it visually (same clip recipe as .visually-hidden). */
.booking-mgmt__search wa-input::part(label) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.booking-mgmt__table-wrap {
  overflow-x: auto;
  border: 1px solid var(--wa-color-surface-border);
  border-radius: var(--wa-border-radius-m);
  background: var(--wa-color-surface-raised);
}

.booking-mgmt__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--wa-font-size-s);
}

.booking-mgmt__table th {
  text-align: left;
  color: var(--wa-color-text-quiet);
  font-weight: 600;
  padding: var(--wa-space-xs) var(--wa-space-s);
  border-bottom: 1px solid var(--wa-color-surface-border);
  white-space: nowrap;
}

.booking-mgmt__table th i:first-child {
  margin-inline-end: var(--wa-space-2xs);
}

.booking-mgmt__table td {
  padding: var(--wa-space-xs) var(--wa-space-s);
  border-bottom: 1px solid var(--wa-color-surface-border);
  white-space: nowrap;
}

.booking-mgmt__table tbody tr:last-child td {
  border-bottom: none;
}

.booking-mgmt__table tbody tr:hover {
  background: var(--wa-color-surface-default);
}

/* When the table overflows its wrap at narrow widths the Actions column pins
   to the right edge instead of scrolling out of view — same convention as
   block_list.css. */
.booking-mgmt__table th:last-child,
.booking-mgmt__table td:last-child {
  position: sticky;
  right: 0;
  background: var(--wa-color-surface-raised);
  box-shadow: -1px 0 0 var(--wa-color-surface-border);
}

.booking-mgmt__sort {
  display: inline-flex;
  align-items: center;
  gap: var(--wa-space-2xs);
  color: inherit;
  text-decoration: none;
}

.booking-mgmt__footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--wa-space-s);
}

.booking-mgmt__footer form {
  display: flex;
  align-items: center;
  gap: var(--wa-space-2xs);
}

.booking-mgmt__count {
  color: var(--wa-color-text-quiet);
  margin-inline-start: auto;
}

.booking-mgmt__pages {
  margin-inline-start: auto;
}

.booking-mgmt__pages,
.booking-mgmt__pages .series-nav {
  display: flex;
  gap: var(--wa-space-2xs);
  align-items: center;
}

.booking-mgmt__pages .series-nav a {
  min-width: 2rem;
  text-align: center;
  padding: var(--wa-space-2xs) var(--wa-space-xs);
  border-radius: var(--wa-border-radius-m);
  color: var(--wa-color-text-normal);
  text-decoration: none;
  font-size: var(--wa-font-size-s);
}

.booking-mgmt__pages .series-nav a[href]:hover {
  background: var(--wa-color-surface-lowered);
}

.booking-mgmt__pages .series-nav a[aria-current="page"] {
  background: var(--wa-color-brand-fill-loud);
  color: var(--wa-color-brand-on-loud);
}

.booking-mgmt__pages .series-nav a[aria-disabled]:not([aria-current="page"]) {
  opacity: 0.4;
  cursor: default;
}

.booking-mgmt__empty {
  padding: var(--wa-space-l);
  border-radius: var(--wa-border-radius-m);
  background: var(--wa-color-surface-default);
  color: var(--wa-color-text-quiet);
  text-align: center;
}

/* Header action links need real separation for the same reason
   .booking-mgmt__tools exists — whitespace alone renders them run-on. */
.booking-mgmt__header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wa-space-s) var(--wa-space-l);
}

/* Guest email under the attendee name — let it wrap so a long address can't
   widen the column past the table wrap (tds are white-space: nowrap). */
.booking-mgmt__muted {
  white-space: normal;
  overflow-wrap: anywhere;
  color: var(--wa-color-neutral-on-quiet);
  font-size: var(--wa-font-size-s);
}

/* Ref cell lines (Room Ref / Master Ref) may wrap so grouped refs can't
   push the table past its wrap — same reason .booking-mgmt__muted wraps.
   Needs td in the selector to out-specify `.booking-mgmt__table td`'s nowrap. */
.booking-mgmt__table td.booking-mgmt__ref {
  white-space: normal;
  overflow-wrap: break-word;
}

/* Footer tool links need real separation — whitespace alone collapsed them
   into a run-on line that wrapped mid-phrase on phones. */
.booking-mgmt__tools {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wa-space-s) var(--wa-space-l);
}

.booking-mgmt__manual-form {
  display: flex;
  flex-direction: column;
  gap: var(--wa-space-m);
  max-width: 36rem;
  padding: var(--wa-space-l);
  border: 1px solid var(--wa-color-surface-border);
  border-radius: var(--wa-border-radius-m);
  background: var(--wa-color-surface-raised);
}

.booking-mgmt__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--wa-space-s);
}

@media (max-width: 40rem) {
  .booking-mgmt__footer {
    flex-direction: column;
    align-items: stretch;
  }

  .booking-mgmt__header {
    flex-direction: column;
    align-items: stretch;
  }

  .booking-mgmt__search wa-input,
  .booking-mgmt__ack {
    flex: 1 1 100%;
  }
}

.booking-mgmt__filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

/* HMS-1199 — admin Modify Booking section headings sit below the page title. */
.booking-mgmt .modify-booking__dates h2,
.booking-mgmt .modify-booking__rooms h2 {
  margin: var(--wa-space-m) 0 var(--wa-space-s);
  font-size: 1.125rem;
  font-weight: 600;
}

/* HMS-1487 — the Hotel ack cell is the table's pressure-relief column: its
   badges wrap to a second line instead of pushing the whole table past the
   wrap into horizontal scroll. wa-badge's shadow host pins
   white-space:nowrap, so the override needs both the host element AND the
   exposed base part (a flex item there can't shrink below content width
   without min-width:0). */
.booking-mgmt__table td.booking-mgmt__hotel-ack {
  white-space: normal;
}

.booking-mgmt__hotel-ack wa-badge {
  white-space: normal;
}

.booking-mgmt__hotel-ack wa-badge::part(base) {
  white-space: normal;
  min-width: 0;
}
