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

/* .v1-card's own overflow:auto (cards.css) would add a second, outer
   scrollbar around the canvas shell - kill it specifically for ShellCraft's
   CS view, mirroring the existing #v1MainCard.is-versions-view pattern. */
#v1MainCard.is-shellcraft-view {
  overflow: hidden;
}

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

/* Same fix, mirrored for a detached/floating ShellCraft window - it has its
   own overflow:auto card body (.v1-detached-tool-body) and .tool-detail
   wrapper, separate from #v1MainCard/#v1ToolDetail. */
.v1-detached-tool-card.is-shellcraft-view .v1-detached-tool-body {
  overflow: hidden;
}

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

.v1-shellcraft-view-switcher {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  background: var(--bg-elev);
  border-bottom: 1px solid #2a2b30;
}

.v1-shellcraft-view-btn {
  border: 1px solid #3f3f46;
  border-radius: 6px;
  background: #2a2d31;
  color: var(--txt);
  font-size: 11px;
  padding: 5px 12px;
  cursor: pointer;
}

.v1-shellcraft-view-btn:hover:not(:disabled) {
  border-color: #555b66;
  background: #333845;
}

.v1-shellcraft-view-btn.is-active {
  border-color: var(--brand);
  color: #ffffff;
  background: color-mix(in oklab, var(--brand) 20%, #2a2d31);
}

.v1-shellcraft-view-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

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

.v1-lib-block-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: grab;
  user-select: none;
}

.v1-lib-block-row:hover {
  background: #222326;
  border-color: #3f3f46;
}

.v1-lib-block-row:active {
  cursor: grabbing;
}

/* Functional blocks (if / repeat-until / powershell / time-trigger) have no
   interpreter yet - dim them and swap the cursor until "Show unfinished
   tools" is on. The actual drag is blocked live in the dragstart handler
   (panel-interactions-runtime.js), this is just the visual match; see
   body.v1-unfinished-tools-on toggled by menu-runtime.js/bootstrap-runtime.js. */
body:not(.v1-unfinished-tools-on) .v1-lib-block-row[data-block-category="functional"] {
  opacity: 0.5;
  cursor: not-allowed;
}

body:not(.v1-unfinished-tools-on) .v1-lib-block-row[data-block-category="functional"]:active {
  cursor: not-allowed;
}

.v1-lib-block-icon {
  font-size: 13px;
  color: var(--txt-dim);
}

.v1-lib-block-name {
  font-size: 12px;
  color: var(--txt);
}

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

.v1-shellcraft-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-shellcraft-canvas.is-panning {
  cursor: grabbing;
}

.v1-canvas-block {
  position: absolute;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  background: #1f2024;
  border: 1px solid #3f3f46;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  cursor: grab;
}

.v1-canvas-block:active {
  cursor: grabbing;
}

.v1-canvas-block.is-selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand);
}

.v1-canvas-block-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--txt);
}

.v1-canvas-block-icon {
  font-size: 13px;
}

.v1-canvas-block-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v1-canvas-block-remove {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: var(--txt-dim);
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}

.v1-canvas-block-remove:hover {
  color: #ff6b6b;
}

.v1-canvas-block[data-block-not-runnable] {
  opacity: 0.75;
}

.v1-canvas-block-run-btn {
  align-self: flex-start;
  border: 1px solid #3f3f46;
  border-radius: 6px;
  background: #2a2d31;
  color: var(--txt);
  font-size: 11px;
  padding: 3px 9px;
  cursor: pointer;
}

.v1-canvas-block-run-btn:hover {
  border-color: #555b66;
  background: #333845;
}

.v1-canvas-block-not-runnable-note {
  font-size: 10px;
  color: var(--txt-dim);
  font-style: italic;
}

.v1-shellcraft-inspector {
  /* .v1-right-content lost its top padding (see comment in assistant.css)
     so RS content can start flush at the top like LS - bump this pane's
     own top padding to compensate, keeping its prior spacing. */
  padding: 10px 4px 4px;
}

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

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

.v1-shellcraft-inspector-field textarea,
.v1-shellcraft-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%;
}
