/* ---------- Seating Floorplan ---------- */
/* Breaks out of the admin layout's max-w-6xl wrapper so the canvas
   uses the full viewport width. */
.seating-floorplan {
  position: relative;
  width: 100vw;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  background: var(--color-bg-secondary);
  border-top: var(--border-thin);
  border-bottom: var(--border-thin);
  padding: var(--space-6) var(--space-8);
  overflow-x: auto;
}

.seating-floorplan__inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  max-width: 1800px;
  margin: 0 auto;
}

.seating-floorplan__canvas {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: var(--color-bg-input);
  border: 1px dashed var(--color-border-light);
  border-radius: 6px;
}

/* Tools row sits below the rail. Groups of related controls are separated
   by hairline dividers; the trailing group is pushed to the right edge. */
.seating-tools {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: var(--space-2) 0;
}

.seating-tools__group {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.seating-tools__group--end {
  margin-left: auto;
}

.seating-tools__divider {
  align-self: stretch;
  width: 1px;
  background: var(--color-border-light);
  margin: 0 var(--space-1);
}

.seating-tools__label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.seating-tool--toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  cursor: pointer;
  user-select: none;
}

.seating-tool--toggle input {
  margin: 0;
  cursor: pointer;
}

.seating-tool__hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-style: italic;
}

/* ---------- Unseated rail ---------- */
/* Horizontal band below the canvas. Groups flow left-to-right as small cards
   and wrap to new lines as needed. */
.seating-rail {
  width: 100%;
  background: var(--color-bg-input);
  border: 1px solid var(--color-border-light);
  border-radius: 6px;
  padding: var(--space-3) var(--space-4);
  max-height: 340px;
  overflow-y: auto;
}

.seating-rail__header {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border-light);
}

.seating-rail__title {
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin: 0;
}

.seating-rail__count {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  background: var(--color-bg-tertiary);
  border-radius: 999px;
  padding: 0 8px;
  min-width: 24px;
  text-align: center;
}

.seating-rail__empty {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-style: italic;
  margin: 0;
  padding: var(--space-2) 0;
}

.seating-rail__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}

.seating-rail__group {
  background: transparent;
  border: 1px dashed var(--color-border-light);
  border-radius: 4px;
  padding: 4px;
  display: flex;
  flex-direction: column;
}

.seating-rail__group--solo {
  border-color: transparent;
}

.seating-rail__chips {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 4px;
}

.seating-rail__chip {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-light);
  border-radius: 3px;
  padding: 3px 8px;
  font-size: var(--text-xs);
  color: var(--color-text-primary);
  cursor: grab;
  user-select: none;
  white-space: nowrap;
}

.seating-rail__chip:hover {
  border-color: var(--color-border);
  background: var(--color-bg-tertiary);
}

/* ---------- Drag-and-drop ---------- */
/* While a drag is in flight, every draggable element shows grabbing cursor. */
.seating-floorplan__inner.is-dragging .seat[draggable="true"],
.seating-floorplan__inner.is-dragging .seating-rail__chip {
  cursor: grabbing;
}

.seat[draggable="true"] {
  cursor: grab;
}

/* Group hint — outline seats holding members of the same linked-invite group
   as the currently dragged guest. Soft gold, lighter than the locked amber. */
.seat.is-group-hint {
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.55);
}

.seating-rail__chip.is-group-hint {
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.55);
  background: rgba(212, 175, 55, 0.10);
}

/* Drop target highlights. */
.seat.is-drop-target--valid {
  background: rgba(34, 139, 34, 0.18);
  border-color: rgba(34, 139, 34, 0.7);
  box-shadow: 0 0 0 2px rgba(34, 139, 34, 0.35);
}

.seat.is-drop-target--invalid {
  background: rgba(178, 34, 34, 0.14);
  border-color: rgba(178, 34, 34, 0.55);
  cursor: not-allowed;
}

.seating-rail.is-drop-target--valid {
  border-color: rgba(34, 139, 34, 0.7);
  box-shadow: 0 0 0 2px rgba(34, 139, 34, 0.35);
}

.seating-rail.is-drop-target--invalid {
  border-color: rgba(178, 34, 34, 0.55);
}

.seating-table__top.is-drop-target--valid,
.curved-table__label.is-drop-target--valid {
  background: rgba(34, 139, 34, 0.18);
  box-shadow: 0 0 0 2px rgba(34, 139, 34, 0.4);
}

.seating-table__top.is-drop-target--invalid,
.curved-table__label.is-drop-target--invalid {
  background: rgba(178, 34, 34, 0.10);
  cursor: not-allowed;
}

/* Multi-select highlight — distinct from group-hint (gold) and locked (amber).
   Blue ring marks "I'm in the selection bundle". */
.seat.is-selected,
.seating-rail__chip.is-selected {
  box-shadow: 0 0 0 2px rgba(45, 110, 200, 0.75);
}

/* Custom drag-image element — built fresh per drag, lives offscreen just long
   enough for the browser to snapshot it, then removed. */
.seating-drag-ghost {
  position: absolute;
  top: -1000px;
  left: -1000px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-primary);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
  pointer-events: none;
}

.seating-table {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.seating-table__label {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.seating-table__name {
  font-weight: 600;
  color: var(--color-text-primary);
  font-size: var(--text-base);
  letter-spacing: 0.02em;
}

.seating-table__body {
  display: flex;
  align-items: center;
  gap: 0;
}

/* Top/bottom rows + the table-top rectangle stack vertically. Using grid
   with a max-content column makes the rectangle stretch to the width of the
   seat rows automatically, without us needing to compute pixel widths. */
.seating-table__stack {
  display: grid;
  grid-template-columns: max-content;
  row-gap: 0;
  justify-items: center;
}

/* The table top itself — the wooden surface that seats sit around. */
.seating-table__top {
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  padding: 10px 16px;
  display: flex;
  gap: 8px;
  align-items: baseline;
  justify-content: center;
  justify-self: stretch;
  position: relative;
  z-index: 1;
}

.seating-table__row {
  display: flex;
  gap: 3px;
  position: relative;
  z-index: 2;
}

/* Tuck the seat rows into the table-top edges so they read as attached. */
.seating-table__row--top    { margin-bottom: 4px; }
.seating-table__row--bottom { margin-top: 4px; }

.seating-table__end--left   { margin-right: 4px; position: relative; z-index: 2; }
.seating-table__end--right  { margin-left: 4px;  position: relative; z-index: 2; }

/* Two-semicircle layout for curved tables (reception T1) */
.curved-table {
  position: relative;
}

.curved-table__disc {
  position: absolute;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
}

.curved-table__disc--top {
  /* Half-disc curving upward: rounded top corners with radius = height */
  border-radius: 999px 999px 0 0;
}

.curved-table__disc--bottom {
  border-radius: 0 0 999px 999px;
}

/* Inner half-disc that "punches a hole" through the outer disc,
   producing an arch / half-ring shape. */
.curved-table__hole {
  position: absolute;
  background: var(--color-bg-input);
  border: 1px solid var(--color-border);
}

.curved-table__hole--top {
  border-radius: 999px 999px 0 0;
  border-bottom: 0;
}

.curved-table__hole--bottom {
  border-radius: 0 0 999px 999px;
  border-top: 0;
}

.curved-table__label {
  position: absolute;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.seating-table__end {
  display: flex;
  align-items: center;
}

.seat {
  position: relative;
  width: 28px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-input);
  border: 1px solid var(--color-border-light);
  border-radius: 3px;
  font-size: 10px;
  color: var(--color-text-muted);
  user-select: none;
  overflow: visible;
}

/* End seats sit on the short sides of the rect table, so flip the long axis. */
.seat--row-left,
.seat--row-right {
  width: 14px;
  height: 28px;
}

.seat--filled {
  background: var(--color-bg-secondary);
  border-color: var(--color-border);
}

.seat--locked {
  background: rgba(184, 134, 11, 0.18);
  border-color: rgba(184, 134, 11, 0.65);
}

.seat__num {
  pointer-events: none;
  display: inline-block;
}

/* Lock button — overlays the seat box, transparent except on hover or when locked. */
.seat__lock-form {
  display: contents;
}

.seat__lock {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease;
  color: var(--color-text-muted);
  z-index: 3;
}

.seat:hover .seat__lock {
  opacity: 0.55;
}

.seat--locked .seat__lock {
  opacity: 1;
  color: rgb(184, 134, 11);
}

.seat__lock-icon {
  display: inline-flex;
  width: 10px;
  height: 10px;
  pointer-events: none;
}

.seat__lock-icon svg {
  width: 100%;
  height: 100%;
}

.seating-table__shuffle-form {
  display: contents;
}

.seating-table__shuffle {
  background: transparent;
  border: 0;
  padding: 2px;
  margin: 0;
  cursor: pointer;
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.55;
  transition: opacity 0.15s ease;
}

.seating-table__shuffle:hover {
  opacity: 1;
  color: var(--color-text-primary);
}

.seating-table__shuffle svg {
  width: 14px;
  height: 14px;
  display: block;
}

/* Must come AFTER the base .seat rule (same specificity, source order wins). */
.seat--row-arc {
  position: absolute;
}

.seat__name {
  position: absolute;
  pointer-events: none;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 500;
  color: var(--color-text-primary);
  letter-spacing: 0.01em;
}

/* Top row of a rect table: name extends UP-RIGHT from the top edge of the seat. */
.seat--row-top .seat__name {
  bottom: calc(100% + 4px);
  left: calc(50% + 4px);
  transform-origin: 0 100%;
  transform: rotate(-45deg);
}

/* Bottom row: name extends DOWN-RIGHT from the bottom edge of the seat. */
.seat--row-bottom .seat__name {
  top: calc(100% + 4px);
  left: calc(50% + 4px);
  transform-origin: 0 0;
  transform: rotate(45deg);
}

/* Left-end seat: name extends LEFT (off the left side of the seat). */
.seat--row-left .seat__name {
  right: 200%;
  top: 50%;
  transform-origin: 100% 0;
  transform: translateY(-50%) rotate(-45deg);
}

/* Right-end seat: name extends RIGHT (off the right side of the seat). */
.seat--row-right .seat__name {
  left: calc(100%);
  top: 60%;
  transform-origin: 0 0;
  transform: translateY(-50%) rotate(-45deg);
}

/* Arc seats: rotate the name 90° relative to the seat so it reads radially
   outward (perpendicular to the chair, like spokes on a wheel). Anchor sits
   slightly inside the seat top edge so the rotated name nestles against the
   chair instead of floating off it. */
.seat--row-arc .seat__name {
  bottom: calc(100% + 5px);
  left: calc(50% + 8px);
  transform-origin: 0 100%;
  transform: rotate(-90deg);
}

/* Seats on the left half of the table would read upside down at -90° —
   pivot at the top-right and rotate +90° instead, which keeps the name
   extending in the same outward direction but flips the characters
   right-side-up. */
.seat--row-arc.seat--flipped .seat__name {
  left: auto;
  bottom: calc(100% - 8px);
  right: calc(50% - 8px);
  transform-origin: 100% 0;
  transform: rotate(90deg);
}
