/* Kitchen planner page. Sized for a 1366 x 768 laptop screen. */

:root {
  --bg: #f4f4f2;
  --panel: #fbfbfa;
  --line: #d4d4d0;
  --text: #22252a;
  --muted: #6b6f76;
  --accent: #2766d9;          /* the guide-mark blue, (0.15, 0.45, 1.0) shown in sRGB */
  --select: #ff9a1f;
  font-family: system-ui, "Ubuntu", "Segoe UI", sans-serif;
  font-size: 13px;
  color: var(--text);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); }

#app {
  display: grid;
  grid-template-columns: 1fr 268px;
  grid-template-rows: 38px 1fr;
  height: 100vh;
}

/* -- top bar ------------------------------------------------------------------------- */
#bar {
  grid-column: 1 / 3;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
#bar .title { font-weight: 600; white-space: nowrap; }
#bar .title small { font-weight: 400; color: var(--muted); }
#bar .help { color: var(--muted); margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.views { display: flex; }
button {
  font: inherit;
  padding: 4px 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  cursor: pointer;
}
button:hover { background: #f0f3f8; }
button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.views button + button, .tabs button + button { border-left: 0; }

/* -- 3D view ------------------------------------------------------------------------- */
#view {
  position: relative;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}
#view canvas { display: block; }
.label-layer { position: absolute; top: 0; left: 0; pointer-events: none; }
.label-layer * { pointer-events: none !important; }
.mm-label {
  font: 600 12px/1 system-ui, sans-serif;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 2px 4px;
  white-space: nowrap;
}
.wall-name {
  font: 600 11px/1 system-ui, sans-serif;
  color: #555;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 2px;
  padding: 1px 3px;
}
#status {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 6px 12px;
  background: rgba(34, 37, 42, 0.86);
  color: #fff;
  font-family: ui-monospace, "Ubuntu Mono", monospace;
  font-size: 13px;
  white-space: pre;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
body.moving, body.moving * { cursor: grabbing !important; }

/* -- catalog ------------------------------------------------------------------------- */
#catalog {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--panel);
  min-height: 0;
  user-select: none;
}
#catalog .tabs { display: flex; padding: 8px 8px 0; }
#catalog .tabs button { flex: 1; }
#catalog input[type=search] {
  margin: 8px;
  padding: 5px 8px;
  font: inherit;
  border: 1px solid var(--line);
}
#catalog .grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-content: start;
  gap: 6px;
  padding: 0 8px 8px;
  touch-action: none;
}
.tile {
  background: #fff;
  border: 1px solid var(--line);
  padding: 6px 4px 4px;
  text-align: center;
  cursor: grab;
  touch-action: none;
  -webkit-user-drag: none;
}
.tile:hover { border-color: var(--accent); background: #f3f7ff; }
.tile img { display: block; width: 100%; height: 82px; object-fit: contain; pointer-events: none; }
.tile .cap { margin-top: 4px; line-height: 1.2; }
#catalog .none { color: var(--muted); grid-column: 1 / 3; }
#catalog .how { margin: 0; padding: 8px 10px 10px; color: var(--muted); border-top: 1px solid var(--line); line-height: 1.45; }

#catalog .gpu { margin: 0; padding: 0 10px 8px; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#catalog .gpu.slow { color: #b3261e; white-space: normal; }

.fatal { position: fixed; inset: 40px; background: #fff; color: #a00; padding: 16px; border: 2px solid #a00; overflow: auto; z-index: 9; }

/* -- the engine-backed kitchen page (kitchen.html) ------------------------------------- */
#bar .actions { display: flex; gap: 6px; }
#bar .actions button { padding: 4px 10px; }
#problems {
  position: absolute;
  left: 10px; bottom: 38px;
  max-width: min(560px, calc(100% - 20px));
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  font-size: 12px;
  z-index: 2;
}
#problems .head { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 6px 10px; font-weight: 600; }
#problems.none .head { color: #2e7d32; }
#problems.has-red .head { color: #b3261e; }
#problems.has-amber:not(.has-red) .head { color: #a15c00; }
#problems ul { list-style: none; margin: 0; padding: 0 10px 8px; max-height: 180px; overflow-y: auto; }
#problems.collapsed ul, #problems.none ul { display: none; }
#problems li { padding: 3px 0 3px 16px; position: relative; cursor: pointer; line-height: 1.35; }
#problems li::before { content: ""; position: absolute; left: 2px; top: 8px; width: 8px; height: 8px; border-radius: 50%; }
#problems li.red::before { background: #d93025; }
#problems li.amber::before { background: #f29900; }
#problems li:hover { background: #f3f7ff; }
.tile .code { font-weight: 700; }
.tile img.missing { display: none; }
#no-engine { position: fixed; inset: 60px 20%; background: #fff; border: 2px solid var(--line); padding: 24px 28px; z-index: 10; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2); }
#no-engine .detail { color: var(--muted); font-size: 12px; }
