/* Room editor stylesheet.
 *
 * The source design computed every color inline, parameterized by an
 * "accent" the design tool let you swap live. This app ships one fixed
 * accent, so those computed values become plain CSS here — Go only ever
 * emits per-instance geometry (position/size/rotation) and boolean state
 * classes (is-selected, is-active, …), never colors. :hover and every
 * class below are real CSS; the design's own `style-hover="…"` attribute
 * was a Design-Canvas preview-only convention with no meaning in HTML.
 */

:root {
  --ink: oklch(0.24 0.01 60);
  --ink-2: oklch(0.32 0.012 60);
  --mut: oklch(0.52 0.012 60);
  --mut-2: oklch(0.62 0.012 60);
  --mut-3: oklch(0.42 0.012 60);
  --line: oklch(0.89 0.008 60);
  --accent: oklch(0.62 0.16 200);
  --danger: oklch(0.5 0.16 25);
  --bg: oklch(0.955 0.006 60);
  --surface: oklch(0.99 0.004 60);
  --surface-2: oklch(0.98 0.004 60);
  --surface-3: oklch(0.975 0.005 60);
  --surface-hover: oklch(0.96 0.006 60);
  --mono: 'Roboto Mono', monospace;
}

@keyframes om-pulse {
  0%, 100% { opacity: 1 }
  50% { opacity: 0.35 }
}

/* ---- header ---------------------------------------------------------- */

.status-pill {
  padding: 3px 8px; border-radius: 999px; font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.status-pill--draft { background: oklch(0.94 0.03 85); color: oklch(0.45 0.09 75); }
.status-pill--published { background: color-mix(in oklab, var(--accent) 16%, white); color: color-mix(in oklab, var(--accent) 80%, black); }

.save-dot { width: 7px; height: 7px; border-radius: 50%; background: oklch(0.62 0.14 150); }

.btn-ghost {
  height: 30px; padding: 0 12px; border: 1px solid var(--line); border-radius: 7px;
  background: white; color: var(--ink-2); font-size: 12px; cursor: pointer;
}
.btn-ghost:hover { background: var(--surface-hover); }
.btn-dark:hover { background: oklch(0.34 0.012 60); }
.btn-ghost.is-on { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 10%, white); color: var(--accent); }

/* ---- toolbar ----------------------------------------------------------*/

.tool-tile {
  position: relative; width: 100%; height: 56px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px; border-radius: 8px; cursor: pointer; border: 1px solid transparent;
  background: transparent; color: var(--mut);
}
.tool-tile:hover { background: oklch(0.94 0.006 60 / 0.6); }
.tool-tile.is-active,
.tool-tile.is-active:hover { color: var(--accent); border-color: var(--accent); background: color-mix(in oklab, var(--accent) 12%, white); }

.btn-danger {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  width: 100%; height: 52px; flex: 0 0 auto; border-radius: 8px; cursor: pointer;
  border: 1px solid oklch(0.87 0.03 25); background: oklch(0.99 0.012 25); color: var(--danger);
}
.btn-danger:hover { background: oklch(0.96 0.03 25); }
.btn-danger:disabled {
  cursor: not-allowed; border-color: var(--line); background: var(--surface-2); color: oklch(0.72 0.012 60);
}
.btn-danger-inline {
  width: 100%; height: 32px; border: 1px solid oklch(0.86 0.03 25); border-radius: 7px;
  background: oklch(0.99 0.01 25); color: var(--danger); font-size: 12px; cursor: pointer;
}
.btn-danger-inline:hover { background: oklch(0.96 0.03 25); }

/* ---- canvas / board -----------------------------------------------------*/

/* Every drag gesture (marquee, move, rotate, draw, pan) runs by tracking
 * raw mousemove over the canvas; without this, the browser's own
 * click-and-drag text selection kicks in over the seat/tag labels
 * underneath the cursor, highlighting text in whatever groups the drag
 * passes over instead of just updating the app's own selection state. */
#canvas-host, .tool-tile, .zoom-btn, .ctx-menu, .list-row {
  user-select: none;
  -webkit-user-select: none;
}

#board { cursor: default; }
#board[data-tool="lasso"], #board[data-tool="rect"], #board[data-tool="row"] { cursor: crosshair; }
#board[data-tool="seat"] { cursor: copy; }
#board[data-tool="pan"] { cursor: grab; }
#board[data-tool="pan"].is-panning { cursor: grabbing; }
#board[data-tool="select"] .seat { cursor: move; }
#board.is-zoomed-out .seat-label { visibility: hidden; }

.group-frame {
  position: absolute; inset: 0; border-radius: 8px; pointer-events: none; border: 1px solid transparent;
}
.group-frame.is-selected { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 7%, transparent); }

.group-tag {
  position: absolute; left: 0; right: 0; top: -20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--mono); font-size: 10px; pointer-events: none; padding: 2px 6px; border-radius: 4px;
  color: var(--mut); background: transparent; opacity: 0.75;
}
.group-tag.is-selected { color: white; background: var(--accent); opacity: 1; }

.seat {
  position: absolute; width: 26px; height: 26px; border-radius: 6px; display: flex; align-items: center;
  justify-content: center; font-family: var(--mono); font-size: 7.5px; letter-spacing: -0.02em;
  color: var(--mut); background: var(--surface); border: 1px solid oklch(0.82 0.01 60);
  box-shadow: inset 0 -3px 0 0 oklch(0.93 0.006 60);
}
.seat.is-selected {
  color: color-mix(in oklab, var(--accent) 70%, black);
  background: color-mix(in oklab, var(--accent) 22%, white);
  border-color: var(--accent);
  box-shadow: inset 0 -3px 0 0 color-mix(in oklab, var(--accent) 30%, white);
}

.rotate-handle {
  position: absolute; left: 50%; top: -34px; width: 13px; height: 13px; margin-left: -6.5px;
  border-radius: 50%; background: white; border: 2px solid var(--accent); cursor: grab;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 14%, transparent);
}

.draft-frame {
  position: absolute; border-radius: 8px; pointer-events: none; border: 1px dashed var(--accent);
  background: color-mix(in oklab, var(--accent) 7%, transparent);
}
.draft-frame .group-tag { color: white; background: var(--accent); opacity: 1; }

.lasso-box {
  position: absolute; pointer-events: none; border: 1px dashed var(--accent); border-radius: 4px;
  background: color-mix(in oklab, var(--accent) 8%, transparent);
}

/* ---- zoom / status bar ------------------------------------------------- */

.zoom-btn:hover { background: oklch(0.94 0.006 60); }
.subdiv-btn.is-active { background: color-mix(in oklab, var(--accent) 12%, white); color: var(--accent); }

/* ---- context menu (built by editor.js) --------------------------------- */

.ctx-menu {
  position: absolute; min-width: 196px; padding: 4px; background: oklch(0.995 0.002 60); border: 1px solid var(--line);
  border-radius: 9px; box-shadow: 0 8px 24px oklch(0.24 0.01 60 / 0.12), 0 1px 2px oklch(0.24 0.01 60 / 0.08);
  display: flex; flex-direction: column; gap: 1px; z-index: 10;
}
.ctx-item {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; width: 100%; padding: 6px 10px;
  border: 0; border-radius: 5px; background: transparent; text-align: left; font-family: 'Public Sans', sans-serif;
  font-size: 12px; cursor: pointer; color: var(--ink);
}
.ctx-item:hover:not(:disabled) { background: var(--surface-hover); }
.ctx-item:disabled { color: oklch(0.72 0.012 60); cursor: default; }
.ctx-item.is-danger { color: var(--danger); }
.ctx-key { font-family: var(--mono); font-size: 10px; color: var(--mut); }
.ctx-item:disabled .ctx-key { color: oklch(0.78 0.01 60); }
.ctx-sep { display: block; width: 100%; height: 1px; margin: 4px 0; background: var(--line); }

/* ---- inspector panel ---------------------------------------------------*/

.field-label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--mut); }

.rotate-box { border: 1px solid var(--line); border-radius: 8px; background: var(--surface-3); }

.tick { width: 1px; height: 4px; background: oklch(0.87 0.008 60); }
.tick.tick--major { height: 7px; background: oklch(0.78 0.01 60); }
.tick.tick--active { background: var(--accent); }

.list-row-info { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }

.list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  padding: 8px 10px; border-radius: 7px; cursor: pointer; text-align: left; border: 1px solid var(--line);
  background: white; color: var(--ink);
}
.list-row:hover { border-color: var(--accent); }
.list-row.is-active { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 8%, white); }

.icon-btn:hover { border-color: oklch(0.6 0.14 25); color: oklch(0.55 0.16 25); }
.step-btn:hover { background: var(--surface-hover); }
.panel-reopen:hover { background: var(--surface-hover); color: var(--ink); }

input[type="range"] { accent-color: var(--accent); }

/* Text/number fields had no focus style of their own, so focusing one
 * fell back to the browser's default outline — thick, blue, drawn outside
 * the input's own border-radius — which reads as a layout glitch next to
 * the app's own thin --line borders and accent-teal highlights. Replace
 * it with the same ring treatment already used for the rotate handle. */
#inspector-panel input[type="number"],
#inspector-panel input[type="text"] {
  outline: none;
}
#inspector-panel input[type="number"]:focus,
#inspector-panel input[type="text"]:focus {
  /* border-color here would lose to each input's own inline
   * "border:1px solid var(--line)" regardless of selector, so the halo
   * carries the focus state instead — same treatment as .rotate-handle. */
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 14%, transparent);
}

/* ---- panel open/close (pure client view state) ------------------------ */

.app[data-panel="closed"] #inspector-panel { display: none; }
.app[data-panel="closed"] #panel-reopen { display: flex; }
.app[data-panel="open"] #panel-reopen { display: none; }
