/*
 * packages/@mach33/ui/static/computer-panel.css — the person's computer: its
 * header button and its panel (ADR 0075, REQ-user-vm-computer R13).
 *
 * The button is second to last on the right of a header; the IDE / Agents
 * toggle is last. The panel fills the right rail where a page has one (the
 * IQE) and is a right-side column of its own where it does not (the Agents
 * view). The
 * same monitor as the AI Workstation's, blue where that one is green.
 *
 * Its own sheet, linked beside the button, because the Agents views do not
 * all load shell.css. Colours are the shell's tokens (--m33-computer is
 * defined on :root in shell.css); each has the dark-theme value as a
 * fallback for a page without them. Behaviour is computer-panel.js.
 *
 * Contents: view
 * Team: J. Brant Arseneau & the Mach33 Agents.
 */
.m33-computer-btn {
  display: inline-flex; align-items: center; justify-content: center;
  flex: none; width: 32px; height: 32px; margin: 0 4px 0 6px; padding: 0;
  border-radius: 8px; cursor: pointer; background: transparent;
  color: var(--m33-computer, #4c9dff);
  border: 1px solid color-mix(in oklab, var(--m33-computer, #4c9dff) 35%, transparent);
  transition: background 120ms, box-shadow 120ms, border-color 120ms;
}
.m33-computer-btn[hidden] { display: none; }
.m33-computer-btn svg { width: 16px; height: 16px; }
.m33-computer-btn:hover,
.m33-computer-btn[aria-expanded="true"] {
  background: color-mix(in oklab, var(--m33-computer, #4c9dff) 12%, transparent);
  border-color: color-mix(in oklab, var(--m33-computer, #4c9dff) 65%, transparent);
  box-shadow: 0 0 10px color-mix(in oklab, var(--m33-computer, #4c9dff) 45%, transparent);
}
.m33-computer-btn:focus-visible { outline: 2px solid var(--m33-computer, #4c9dff); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .m33-computer-btn { transition: none; } }

.m33-computer-panel {
  display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 0;
  background: var(--m33-panel, #1a1d27); color: var(--m33-text, #e1e4ed); overflow: hidden;
}
.m33-computer-head {
  display: flex; align-items: center; gap: 8px; flex: none; padding: 10px 12px;
  border-bottom: 1px solid var(--m33-border, #2a2d3a); color: var(--m33-computer, #4c9dff);
  font: 600 11px/1.2 ui-monospace, monospace; letter-spacing: .06em; text-transform: uppercase;
}
.m33-computer-head span { flex: 1 1 auto; }
.m33-computer-head button {
  background: transparent; color: var(--m33-text, #e1e4ed); cursor: pointer;
  border: 1px solid var(--m33-border, #2a2d3a); border-radius: 6px;
  font: 500 12px/1 ui-monospace, monospace; padding: 4px 8px;
}
.m33-computer-head button:hover { border-color: var(--m33-text-muted, #8b8fa3); }
.m33-computer-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 14px; }
.m33-computer-status { color: var(--m33-text-muted, #8b8fa3); font-size: 13px; }
.m33-computer-card { border: 1px solid var(--m33-border, #2a2d3a); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--m33-card, #22253a); }
.m33-computer-name { font: 600 13px/1.35 ui-monospace, monospace; overflow-wrap: anywhere; }
.m33-computer-state { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; }
.m33-computer-state::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--m33-warn, #fbbf24); }
.m33-computer-state[data-state="running"]::before { background: var(--m33-good, #34d399); }
.m33-computer-state[data-state="stopped"]::before,
.m33-computer-state[data-state="paused"]::before { background: var(--m33-text-muted, #8b8fa3); }
.m33-computer-state[data-state="failed"]::before,
.m33-computer-state[data-state="absent"]::before { background: var(--m33-bad, #f87171); }
.m33-computer-state small { color: var(--m33-text-muted, #8b8fa3); font-size: 12px; }
.m33-computer-facts { display: grid; grid-template-columns: max-content 1fr; gap: 5px 12px; margin: 0; font-size: 12px; }
.m33-computer-facts dt { color: var(--m33-text-muted, #8b8fa3); }
.m33-computer-facts dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.m33-computer-note { color: var(--m33-text-muted, #8b8fa3); font-size: 12px; line-height: 1.45; border-top: 1px solid var(--m33-border, #2a2d3a); padding-top: 10px; }

/* Where a page has no right rail of its own (an Agents view): the panel is a
   right-side column the button opens and closes. The page gives up that
   width while it is open, so nothing sits underneath it. */
.m33-computer-side {
  position: fixed; z-index: 40; top: 0; right: 0; bottom: 0;
  width: 360px; height: auto; border-left: 1px solid var(--m33-border, #2a2d3a);
}
body.m33-computer-side-open { padding-right: 360px; box-sizing: border-box; }
@media (max-width: 760px) {
  .m33-computer-side { width: 100vw; border-left: 0; }
  body.m33-computer-side-open { padding-right: 0; }
}
.m33-computer-agent { display: flex; flex-direction: column; gap: 3px; border-top: 1px solid var(--m33-border, #2a2d3a); padding-top: 10px; font-size: 12px; }
.m33-computer-agent b { font-weight: 600; font-size: 12px; }
.m33-computer-agent span { color: var(--m33-text-muted, #8b8fa3); }

/* ── The screen: a thumbnail in the panel, and the same picture full size ── */
.m33-computer-screen { position: relative; border-radius: 6px; overflow: hidden; background: var(--m33-bg, #0f1117); border: 1px solid var(--m33-border, #2a2d3a); }
/* The picture's box. noVNC puts its own canvas in here and scales it to fit;
   the box must stay a plain block (a flex parent breaks its arithmetic). */
.m33-computer-screen-view { display: block; width: 100%; aspect-ratio: 16 / 10; background: var(--m33-bg, #0f1117); overflow: hidden; }
.m33-computer-screen-view canvas { pointer-events: none; }
/* The whole thumbnail is the button that opens it full size. */
.m33-computer-screen-open { position: absolute; inset: 0 0 26px 0; width: 100%; background: transparent; border: 0; padding: 0; cursor: zoom-in; }
.m33-computer-screen[data-state="connecting"] .m33-computer-screen-open,
.m33-computer-screen[data-state="off"] .m33-computer-screen-open { cursor: default; }
.m33-computer-screen-open:focus-visible { outline: 2px solid var(--m33-computer, #4c9dff); outline-offset: -2px; }
.m33-computer-screen-note { display: flex; align-items: center; gap: 7px; min-height: 26px; padding: 4px 8px; font-size: 11px; color: var(--m33-text-muted, #8b8fa3); background: var(--m33-panel, #1a1d27); }
.m33-computer-screen-note::before { content: ''; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--m33-warn, #fbbf24); }
.m33-computer-screen[data-state="live"] .m33-computer-screen-note::before { background: var(--m33-good, #34d399); }
.m33-computer-screen[data-state="off"] .m33-computer-screen-note::before { background: var(--m33-bad, #f87171); }
.m33-computer-screen-again { display: none; position: absolute; right: 6px; bottom: 3px; background: transparent; color: var(--m33-computer, #4c9dff); border: 0; font-size: 11px; cursor: pointer; padding: 2px 4px; }
.m33-computer-screen[data-state="off"] .m33-computer-screen-again { display: block; }

.m33-computer-full { position: fixed; inset: 0; z-index: 200; display: grid; grid-template-rows: auto minmax(0, 1fr); background: var(--m33-bg, #0f1117); }
.m33-computer-full-bar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: var(--m33-panel, #1a1d27); border-bottom: 1px solid var(--m33-border, #2a2d3a); color: var(--m33-text, #e1e4ed); font: 600 12px/1.2 ui-monospace, monospace; }
.m33-computer-full-bar span { color: var(--m33-computer, #4c9dff); }
.m33-computer-full-bar small { flex: 1 1 auto; color: var(--m33-text-muted, #8b8fa3); font-weight: 400; font-size: 11px; }
.m33-computer-full-bar button { background: transparent; color: var(--m33-text, #e1e4ed); border: 1px solid var(--m33-border, #2a2d3a); border-radius: 6px; padding: 6px 12px; font: 500 12px/1 system-ui, sans-serif; cursor: pointer; }
.m33-computer-full-bar button:hover, .m33-computer-full-bar button:focus-visible { border-color: var(--m33-computer, #4c9dff); outline: none; }
/* Full size: the same box, now filling the stage. */
.m33-computer-full-stage { min-height: 0; overflow: hidden; }
.m33-computer-full-stage .m33-computer-screen-view { width: 100%; height: 100%; aspect-ratio: auto; }

/* Taking control (the full-size view only): the picture takes the mouse, and
   the bar says so in the one colour that means "you are acting". */
.m33-computer-full[data-mode="control"] .m33-computer-screen-view canvas { pointer-events: auto; }
.m33-computer-full[data-mode="control"] .m33-computer-full-bar { border-bottom-color: var(--m33-warn, #fbbf24); }
.m33-computer-full[data-mode="control"] .m33-computer-full-bar small { color: var(--m33-warn, #fbbf24); }
.m33-computer-full-bar .m33-computer-full-swap { border-color: color-mix(in oklab, var(--m33-computer, #4c9dff) 55%, transparent); color: var(--m33-computer, #4c9dff); }
.m33-computer-full-bar .m33-computer-full-swap[aria-pressed="true"] { border-color: var(--m33-warn, #fbbf24); color: var(--m33-warn, #fbbf24); }
