/*
  Shared design tokens, copied from the pershorecoworking.com marketing site
  (Astro). Every layout in this app (public booking, member dashboard, and
  staff admin) loads this file alongside its own stylesheet, so the whole
  app reads as one brand rather than a public site with a bolted-on admin
  tool. If a future location trades under a different name, this is the one
  file to swap: everything downstream reads these variables, nothing else
  hardcodes a color or typeface.
*/
:root {
  --ink: #1D221C;
  --cream: #F6F2EA;
  --sage: #7C9A80;
  --moss: #536A56;
  --moss-hover: #435847;
  --moss-rgb: 83, 106, 86;
  /* RGB triplets, for the translucent tints used all over (badges, hover
     washes, hairlines): rgba(var(--ink-rgb), 0.08). */
  --ink-rgb: 29, 34, 28;
  --sage-rgb: 124, 154, 128;
  --copper-rgb: 168, 109, 71;
  --danger-rgb: 163, 67, 63;
  --line: rgba(var(--ink-rgb), 0.1);
  --line-strong: rgba(var(--ink-rgb), 0.2);
  --surface: #fff;
  --copper: #A86D47;
  --danger: #A3433F;
  --danger-bg: #F3E2E0;
  --warning: #C28A32;
  --warning-bg: #F5E8D3;
  /* Text-safe variants for small text on a light tint, each checked at
     4.5:1 or better: --ink-muted on cream 5.7:1, --warning-ink on
     --warning-bg 4.65:1, --copper-ink on the pending badge 4.58:1. The base
     colours above stay for borders, fills and large type. */
  --ink-muted: rgba(var(--ink-rgb), 0.7);
  --warning-ink: #8A5F1C;
  --copper-ink: #8A5634;
  --font-serif: "Cormorant Garamond", Georgia, serif;
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --radius-sm: 6px;
  --radius-lg: 10px;
}

/* Shared status-pill vocabulary, used by both admin.css and
   public_booking.css, kept here (rather than duplicated in each) so a new
   enum value only needs one edit, not two kept manually in sync. */
.status-badge { display: inline-block; padding: 0.125rem 0.5rem; border-radius: 3px; font-size: 0.8125rem; background: rgba(var(--ink-rgb), 0.08); }
.status-requested, .status-pending, .status-waiting, .status-invited, .status-unconfirmed, .status-sent, .status-viewed, .status-member_signed, .status-queued { background: rgba(var(--copper-rgb), 0.15); color: var(--copper-ink); }
.status-confirmed, .status-active, .status-scheduled, .status-offered, .status-subscribed { background: rgba(var(--sage-rgb), 0.2); color: var(--moss-hover); }
.status-completed, .status-paid, .status-converted, .status-delivered, .status-concluded, .status-accepted { background: rgba(var(--sage-rgb), 0.35); color: var(--moss-hover); }
.status-cancelled, .status-overdue, .status-expired, .status-locked, .status-unsubscribed, .status-bounced, .status-complained, .status-declined, .status-withdrawn, .status-failed { background: rgba(var(--danger-rgb), 0.1); color: var(--danger); }
.status-no_show, .status-notice_given, .status-no_invite_sent { background: var(--line); }
.status-ended, .status-void, .status-anonymized { background: rgba(var(--ink-rgb), 0.08); }

/* Flash messages (notice/alert), shared with admin.css and
   public_booking.css, kept here for the same reason as .status-badge above.
   Dismissible via flash_controller.js, which toggles .is-dismissing. */
.notice, .alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  margin-bottom: 1rem;
  transition: opacity 0.2s ease;
}
.notice { background: rgba(var(--sage-rgb), 0.15); color: var(--moss); }
.alert { background: rgba(var(--danger-rgb), 0.08); color: var(--danger); }
.notice.is-dismissing, .alert.is-dismissing { opacity: 0; }

.flash-dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
}
.flash-dismiss:hover { opacity: 1; }

/* Selectable option grid (booking time/day-part slots, live-availability
   pickers), shared with admin.css and public_booking.css, kept here for the
   same reason as .status-badge above. */
.time-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

/* For longer labels (e.g. full dates) that the default short-label grid
   squashes into narrow columns — one option per row instead. */
.time-slots-stacked {
  grid-template-columns: 1fr;
}

.time-slots-stacked .time-slot {
  justify-content: flex-start;
}

.time-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.9375rem;
  cursor: pointer;
}

.time-slot:has(input:checked) {
  border-color: var(--sage);
  background: rgba(var(--sage-rgb), 0.12);
}

.time-slot-unavailable {
  position: relative;
  color: rgba(var(--ink-rgb), 0.4);
  border-color: rgba(var(--ink-rgb), 0.08);
  background: rgba(var(--ink-rgb), 0.03);
  cursor: not-allowed;
}

.time-slot-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translate(-50%, -6px);
  background: var(--ink);
  color: #fff;
  font-size: 0.75rem;
  padding: 0.35rem 0.6rem;
  border-radius: 4px;
  /* display: none (not opacity: 0) while hidden: an invisible box still
     counts towards the page's scrollable width, and a long nowrap reason
     ("isn't available for this member") near the right edge made a phone
     screen scroll sideways. aria-describedby still reads a display: none
     target, so screen readers lose nothing. Capped and wrapping when shown,
     for the same reason. */
  display: none;
  width: max-content;
  max-width: min(16rem, calc(100vw - 2rem));
  pointer-events: none;
  z-index: 10;
}

.time-slot-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--ink);
}

.time-slot-unavailable:hover .time-slot-tooltip,
.time-slot-tooltip.is-visible {
  display: block;
}

/* Read by screen readers, invisible on screen (e.g. a label for a control
   whose purpose is already clear from what's around it). */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Hidden until a keyboard user tabs onto it as the page's first stop. */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 200;
  padding: 0.5rem 1rem;
  background: var(--cream);
  color: var(--ink);
  border-radius: var(--radius-sm);
}
.skip-link:focus { top: 1rem; }

/* One clearly visible focus ring for every interactive element, shown for
   keyboard focus only (:focus-visible), so mouse clicks don't flash it.
   Moss on cream is 5.3:1. The browser's default 1px blue ring was 2.7:1
   against the dark admin nav, under the 3:1 a focus indicator needs. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--moss);
  outline-offset: 2px;
}

/* An invalid field's own messages, rendered beside it by FieldErrorMarkup
   (every form in the app, not just admin). display: contents lets the
   control and its message sit in the surrounding row's layout as if the
   wrapper weren't there. */
.field_with_errors { display: contents; }
.field_with_errors :is(input, select, textarea) { border-color: var(--danger); }
.field-error { display: block; font-size: 0.8125rem; color: var(--danger); }

/* Inline availability feedback (e.g. the admin meeting-room form's live
   conflict check), same shared-location reasoning as .status-badge above. */
.field-hint-success { color: var(--moss); }
.field-hint-error { color: var(--danger); }

/* The installed app's "you're offline" notice (offline_snapshot_controller.js),
   shared by the member dashboard and admin layouts. Stays at the top of the
   screen while scrolling, since anything below it is a saved copy. */
.offline-banner {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.625rem 1rem;
  background: var(--warning-bg);
  color: var(--ink);
  border-bottom: 1px solid var(--warning);
  font-size: 0.875rem;
  text-align: center;
}

/* Disabled controls in forms that change something, while offline. */
body.is-offline [data-offline-disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}
