/* shell: Pulpit - Library (LS), canvas (CS), Inspector (RS) */

/* Same .v1-card overflow:auto fix ShellCraft needs (cards.css would
   otherwise add a second, outer scrollbar around the canvas shell). */
#v1MainCard.is-pulpit-view {
  overflow: hidden;
}

#v1MainCard.is-pulpit-view #v1ToolDetail {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
}

/* Same fix, mirrored for a detached/floating Pulpit window. */
.v1-detached-tool-card.is-pulpit-view .v1-detached-tool-body {
  overflow: hidden;
}

.v1-detached-tool-card.is-pulpit-view .tool-detail {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.v1-pulpit-library {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.v1-pulpit-add-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--txt);
  text-align: left;
  cursor: pointer;
}

.v1-pulpit-add-btn:hover {
  background: #222326;
  border-color: #3f3f46;
}

.v1-pulpit-add-icon {
  font-size: 14px;
}

.v1-pulpit-add-name {
  font-size: 12px;
}

/* "Build from last scan" - same button look as .v1-pulpit-add-btn (no icon
   column). */
.v1-pulpit-connect-btn {
  display: block;
  width: 100%;
  padding: 6px 8px;
  margin-bottom: 4px;
  border: 1px solid #3f3f46;
  border-radius: 6px;
  background: transparent;
  color: var(--txt);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.v1-pulpit-connect-btn:hover {
  background: #222326;
}

.v1-pulpit-canvas-shell {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-elev);
}

.v1-pulpit-canvas {
  position: relative;
  width: 3000px;
  height: 2000px;
  cursor: grab;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 24px 24px;
}

.v1-pulpit-canvas.is-panning {
  cursor: grabbing;
}

.v1-pulpit-canvas.is-connect-dragging {
  cursor: crosshair;
}

/* Connection lines - an SVG sibling painted behind the node divs (DOM order
   alone handles the stacking, since neither has an explicit z-index; the
   SVG comes first in the rendered markup). pointer-events:none on the SVG
   itself so it never blocks clicks/drags on the canvas background or nodes
   above it - only the wider "hit" line re-enables pointer-events, giving a
   generous click target for removing a connection without the thin visible
   line itself needing to be pixel-precise to click. */
.v1-pulpit-links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.v1-pulpit-link {
  stroke: var(--txt-dim);
  stroke-width: 1.5;
  opacity: 0.55;
}

.v1-pulpit-link-hit {
  stroke: transparent;
  stroke-width: 14;
  pointer-events: auto;
  cursor: pointer;
}

.v1-pulpit-link-hit:hover + .v1-pulpit-link {
  stroke: var(--brand);
  opacity: 0.9;
}

/* Scanner/sniffer "tap" lines - a monitoring/script link, not a documented
   physical connection, so it gets its own color per tool type rather than
   the dim default .v1-pulpit-link uses. Colors reused verbatim from the
   user's reference mockup. */
.v1-pulpit-tap-link {
  stroke-width: 1.5;
  opacity: 0.75;
  stroke-dasharray: 4 3;
}

.v1-pulpit-tap-link--scanner {
  stroke: #6fe7dd;
}

.v1-pulpit-tap-link--sniffer {
  stroke: #c084fc;
}

.v1-pulpit-link-hit:hover + .v1-pulpit-tap-link {
  opacity: 1;
}

/* Live line following the cursor mid-drag, from a connector handle to
   wherever the pointer currently is. */
.v1-pulpit-temp-link {
  stroke: var(--brand);
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
  opacity: 0.8;
  pointer-events: none;
}

/* Real-desktop-icon look: big glyph on top, name centered underneath - a
   deliberate departure from ShellCraft's card-with-header-row blocks, since
   pulpit nodes represent computers on a desktop, not executable steps. */
.v1-pulpit-node {
  position: absolute;
  width: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: grab;
  text-align: center;
}

.v1-pulpit-node:hover {
  background: rgba(255, 255, 255, 0.04);
}

.v1-pulpit-node:active {
  cursor: grabbing;
}

.v1-pulpit-node.is-selected {
  border-color: var(--brand);
  background: color-mix(in oklab, var(--brand) 14%, transparent);
}

/* Draggable connector dot at the node's edge - pointerdown+drag from here
   (wired in panel-interactions-runtime.js) starts a live connection line;
   draggable="false" on the element itself plus stopPropagation on its own
   pointerdown keep the parent node's separate move-drag from also firing. */
.v1-pulpit-connector {
  position: absolute;
  right: -7px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--brand);
  background: var(--bg-elev);
  cursor: crosshair;
  opacity: 0;
}

.v1-pulpit-node:hover .v1-pulpit-connector,
.v1-pulpit-node.is-selected .v1-pulpit-connector {
  opacity: 1;
}

.v1-pulpit-node-icon {
  font-size: 30px;
  line-height: 1;
}

.v1-pulpit-node-label {
  font-size: 11px;
  color: var(--txt);
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v1-pulpit-node-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  border: 0;
  background: transparent;
  color: var(--txt-dim);
  font-size: 13px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
  opacity: 0;
}

.v1-pulpit-node:hover .v1-pulpit-node-remove,
.v1-pulpit-node.is-selected .v1-pulpit-node-remove {
  opacity: 1;
}

.v1-pulpit-node-remove:hover {
  color: #ff6b6b;
}

.v1-pulpit-inspector {
  /* Same RS top-padding compensation as ShellCraft's inspector - see
     assistant.css's comment on .v1-right-content losing its top padding. */
  padding: 10px 4px 4px;
}

.v1-pulpit-inspector-field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.v1-pulpit-inspector-field label {
  color: var(--txt-dim);
  font-size: 12px;
}

.v1-pulpit-inspector-field textarea,
.v1-pulpit-inspector-field input {
  border: 1px solid #31333a;
  background: #1f2024;
  color: var(--txt);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 8px;
  box-sizing: border-box;
  width: 100%;
}

/* Right-click "Uruchom" menu - a single static element (rendered as a
   sibling of the canvas, see renderPulpitCanvasTool) toggled via [hidden],
   position:fixed + JS viewport coords like the columns/filter menus
   elsewhere in this app (an absolute popover here could get painted over by
   later sibling canvas content despite z-index - see project memory on that
   gotcha). */
.v1-pulpit-context-menu {
  position: fixed;
  z-index: 40;
  min-width: 120px;
  border: 1px solid #3f3f46;
  border-radius: 6px;
  background: #1b1c1f;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  padding: 4px;
}

.v1-pulpit-context-menu[hidden] {
  display: none;
}

.v1-pulpit-context-menu button {
  display: block;
  width: 100%;
  padding: 6px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--txt);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.v1-pulpit-context-menu button:hover {
  background: #2a2b2f;
}

.v1-pulpit-remote-run {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #2a2b2f;
}

.v1-pulpit-remote-hint {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--txt-dim);
}

.v1-pulpit-remote-quickpicks {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.v1-pulpit-remote-quickpicks button {
  flex: 1 1 auto;
}

.v1-pulpit-remote-run-submit {
  display: block;
  width: 100%;
  padding: 7px 8px;
  margin-top: 4px;
  border: 1px solid var(--brand);
  border-radius: 6px;
  background: color-mix(in oklab, var(--brand) 16%, transparent);
  color: var(--txt);
  font-size: 12px;
  cursor: pointer;
}

.v1-pulpit-remote-run-submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.v1-pulpit-remote-run-result {
  margin-top: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #1f2024;
  color: var(--txt-dim);
  font-size: 11px;
  font-family: var(--font-mono);
  white-space: pre-wrap;
  word-break: break-word;
}

.v1-pulpit-remote-run-result.is-error {
  color: #ff6b6b;
}

.v1-pulpit-remote-run-result[hidden] {
  display: none;
}

/* RDP/VNC + QEMU/VB checkbox row in the Inspector. */
.v1-pulpit-checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.v1-pulpit-checkbox-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--txt);
}

.v1-pulpit-checkbox-item input[type="checkbox"] {
  margin: 0;
}

.v1-pulpit-checkbox-item label {
  cursor: pointer;
}

.v1-pulpit-checkbox-divider {
  width: 1px;
  align-self: stretch;
  background: #31333a;
}

/* Re-added for the "Podgląd"/preview toggle button in the Inspector -
   .v1-pulpit-connect-btn's own .is-active rule was removed when the old
   click-a-toggle connect mode was replaced by drag-to-connect; this is an
   unrelated, new use of the same base button look. */
.v1-pulpit-connect-btn.is-active {
  border-color: var(--brand);
  background: color-mix(in oklab, var(--brand) 14%, transparent);
}

/* CS: live desktop preview - same overflow:hidden/height:100% fix Globe
   and the Topology diagram canvas both already need (cards.css would
   otherwise add a second, outer scrollbar around the video area). */
#v1MainCard.is-pulpit-preview-view {
  overflow: hidden;
}

#v1MainCard.is-pulpit-preview-view #v1ToolDetail {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.v1-detached-tool-card.is-pulpit-preview-view .v1-detached-tool-body {
  overflow: hidden;
}

.v1-detached-tool-card.is-pulpit-preview-view .tool-detail {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.v1-pulpit-preview-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  background: var(--bg-elev);
}

.v1-pulpit-preview-shell .v1-import-manager-note {
  margin: auto;
}

.v1-pulpit-preview-big {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  position: relative;
}

/* The live surface a session's RFB canvas actually lives in - created once
   in JS (pulpit-preview-runtime.js) and re-parented between here and a
   thumbnail slot, never recreated from HTML. Must fill whatever wrapper it
   is currently mounted into. */
.v1-pulpit-preview-surface {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}

.v1-pulpit-preview-surface canvas {
  width: 100% !important;
  height: 100% !important;
}

/* RS: the "camera wall" - a grid of small live thumbnails, one per
   currently-watched node. */
.v1-pulpit-preview-list-mount {
  padding: 8px 4px;
}

.v1-pulpit-preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.v1-pulpit-preview-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  border: 1px solid #31333a;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
  cursor: pointer;
}

.v1-pulpit-preview-thumb.is-focused {
  border-color: var(--brand);
}

.v1-pulpit-preview-thumb-mount {
  position: absolute;
  inset: 0;
}

.v1-pulpit-preview-thumb-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2px 6px;
  font-size: 10px;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.v1-pulpit-preview-thumb-stop {
  position: absolute;
  top: 2px;
  right: 2px;
  border: 0;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  padding: 2px 5px;
  cursor: pointer;
  opacity: 0;
}

.v1-pulpit-preview-thumb:hover .v1-pulpit-preview-thumb-stop {
  opacity: 1;
}

.v1-pulpit-preview-thumb-stop:hover {
  color: #ff6b6b;
}

/* Overlay on top of (not replacing) the RFB canvas already attached to the
   surface - see pulpit-preview-runtime.js's showCredentialsOverlay. */
.v1-pulpit-preview-credentials {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.7);
  padding: 8px;
}

.v1-pulpit-preview-credentials input {
  border: 1px solid #31333a;
  background: #1f2024;
  color: var(--txt);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 8px;
  max-width: 160px;
}

.v1-pulpit-preview-credentials button {
  border: 1px solid var(--brand);
  border-radius: 4px;
  background: color-mix(in oklab, var(--brand) 16%, transparent);
  color: var(--txt);
  font-size: 12px;
  padding: 6px 10px;
  cursor: pointer;
}
