/*
 * Villa Scheme Studio — delivery and log surfaces
 * Visual layer only; component markup, controls and drawing content stay intact.
 */

/* Keep the drawing workspace calm, with an unobtrusive architectural grid. */
#tab-artifacts > .card,
#artifact-view-component-root .card {
  border-color: var(--border-subtle);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

#tab-artifacts > .card {
  margin-bottom: 24px !important;
}

#tab-artifacts .card-header {
  gap: 16px;
  padding: 18px 20px;
}

#tab-artifacts .card-title {
  font-size: var(--fs-xl);
  line-height: 1.45;
  letter-spacing: 0;
}

#tab-artifacts .card-subtitle {
  margin-top: 5px;
  line-height: 1.65;
}

#tab-artifacts .artifact-layout-grid {
  grid-template-columns: minmax(0, 1.85fr) minmax(300px, 0.95fr);
  align-items: start;
  gap: 24px;
}

#tab-artifacts .artifact-col-main,
#tab-artifacts .artifact-col-sidebar {
  min-width: 0;
}

#tab-artifacts .artifact-col-main > .card + .card {
  margin-top: 24px;
}

#tab-artifacts .artifact-col-main > .card,
#tab-artifacts .artifact-col-sidebar > .card {
  border-radius: 10px;
}

#tab-artifacts .artifact-col-sidebar > .card {
  min-height: 100%;
}

#tab-artifacts .board-viewer-card {
  margin: 0 20px 20px;
  width: calc(100% - 40px);
  border-radius: 8px;
  border-color: var(--border-subtle);
  box-shadow: inset 0 0 0 1px rgba(106, 178, 191, 0.035);
}

#tab-artifacts .board-viewer-card:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 3px;
}

#tab-artifacts .board-overlay-badge {
  max-width: calc(100% - 24px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(11, 18, 24, 0.88);
  color: #8ccdc5;
  border-color: rgba(140, 205, 197, 0.22);
  letter-spacing: 0.035em;
}

#tab-artifacts #dxf-cards-list {
  padding: 0 20px 12px;
}

#tab-artifacts .dxf-card {
  gap: 16px;
  margin-bottom: 10px;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--bg-tertiary);
  border-color: var(--border-subtle);
  transition: border-color var(--transition-fast), background-color var(--transition-fast), transform var(--transition-fast);
}

#tab-artifacts .dxf-card:hover {
  border-color: var(--accent-cyan);
  background: var(--bg-elevated);
  transform: translateY(-1px);
}

#tab-artifacts .dxf-meta {
  min-width: 0;
  gap: 5px;
}

#tab-artifacts .dxf-filename {
  flex-wrap: wrap;
  gap: 7px;
  font-size: var(--fs-lg);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

#tab-artifacts .dxf-filename .badge {
  flex: 0 0 auto;
}

#tab-artifacts .dxf-hash {
  width: fit-content;
  max-width: 100%;
  overflow-wrap: anywhere;
  cursor: copy;
  transition: color var(--transition-fast);
}

#tab-artifacts .dxf-hash:hover {
  color: var(--accent-cyan);
}

#tab-artifacts .dxf-card > div:last-child {
  flex: 0 0 auto;
}

#tab-artifacts #json-file-select {
  min-width: 0;
  border-radius: 7px;
}

#tab-artifacts #json-tree-wrapper {
  max-height: min(62vh, 640px);
  min-height: 220px;
  padding: 14px 16px;
  border-radius: 8px;
  font-family: var(--wt-font-mono);
  font-size: var(--fs-sm);
  line-height: 1.75;
  scrollbar-gutter: stable;
}

#tab-artifacts .json-node {
  margin-left: 12px;
  padding-left: 8px;
  border-left: 1px solid color-mix(in srgb, var(--border-subtle) 60%, transparent);
}

#tab-artifacts .json-node:first-child {
  margin-left: 0;
  padding-left: 0;
  border-left: 0;
}

#tab-artifacts .json-node > summary {
  width: fit-content;
  max-width: 100%;
  border-radius: 4px;
  padding: 1px 4px;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

#tab-artifacts .json-node > summary:hover {
  background: var(--accent-glow);
}

#tab-artifacts .json-key {
  color: var(--accent-cyan);
}

#tab-artifacts .json-string { color: #70c99a; }
#tab-artifacts .json-number { color: #78b9d0; }
#tab-artifacts .json-boolean { color: #e8a36e; }
#tab-artifacts .json-null { color: var(--text-muted); }

[data-theme="light"] #tab-artifacts .json-string { color: #267547; }
[data-theme="light"] #tab-artifacts .json-number { color: #176482; }
[data-theme="light"] #tab-artifacts .json-boolean { color: #a0521a; }

/* Modal is scoped to the presentation board so other project dialogs are untouched. */
#tab-artifacts #board-zoom-modal {
  padding: clamp(12px, 3vw, 32px);
  background: rgba(7, 13, 16, 0.84);
}

#tab-artifacts #board-zoom-modal .modal-content {
  width: min(1440px, 95vw) !important;
  height: min(90vh, 960px) !important;
  max-width: 95vw;
  max-height: 90vh;
  border-radius: 10px;
  border-color: var(--border-strong);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

#tab-artifacts #board-zoom-modal .modal-header {
  min-height: 60px;
  gap: 12px;
  padding: 12px 18px;
  background: var(--bg-secondary);
}

#tab-artifacts #board-zoom-modal .modal-header .card-title {
  min-width: 0;
  font-size: var(--fs-xl);
}

#tab-artifacts #board-zoom-modal .modal-body {
  min-height: 0;
  background: var(--bg-input) !important;
}

#tab-artifacts #modal-board-canvas {
  min-height: 0;
}

#tab-artifacts #modal-board-canvas svg,
#tab-artifacts #modal-board-canvas img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Pipeline terminal: retain the familiar log palette while matching studio surfaces. */
#tab-terminal {
  min-width: 0;
}

#tab-terminal .terminal-wrapper {
  height: calc(100vh - var(--header-height) - var(--tabbar-height) - 64px);
  min-height: 460px;
  border-radius: 10px;
  border-color: var(--border-subtle);
  background: var(--bg-input);
  box-shadow: var(--shadow-md);
}

#tab-terminal .terminal-header {
  min-height: 58px;
  height: auto;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border-bottom-color: var(--border-subtle);
}

#tab-terminal .terminal-title-area {
  min-width: 0;
  gap: 10px;
}

#tab-terminal .terminal-title {
  color: var(--text-secondary);
  font-family: var(--wt-font-sans);
  font-size: var(--fs-sm);
}

#tab-terminal .terminal-controls {
  gap: 8px;
}

#tab-terminal .terminal-controls .form-input,
#tab-terminal .terminal-controls .form-select {
  min-height: 34px;
  border-radius: 6px;
}

#tab-terminal .terminal-controls .switch-label {
  color: var(--text-secondary);
  white-space: nowrap;
}

#tab-terminal .terminal-screen {
  min-height: 0;
  padding: 16px 18px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--wt-font-mono);
  font-size: var(--fs-sm);
  line-height: 1.7;
  scrollbar-gutter: stable;
}

#tab-terminal .terminal-line {
  min-width: max-content;
  gap: 14px;
  padding: 2px 0;
}

#tab-terminal .terminal-time {
  min-width: 72px;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

#tab-terminal .terminal-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#tab-terminal .terminal-footer {
  min-height: 34px;
  height: auto;
  gap: 12px;
  padding: 7px 16px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-top-color: var(--border-subtle);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

/* Theme-aware ANSI text colors; log content and severity classes are untouched. */
[data-theme="light"] #tab-terminal .ansi-black { color: #66716e; }
[data-theme="light"] #tab-terminal .ansi-red { color: #b43e3e; }
[data-theme="light"] #tab-terminal .ansi-green { color: #247344; }
[data-theme="light"] #tab-terminal .ansi-yellow { color: #886313; }
[data-theme="light"] #tab-terminal .ansi-blue { color: #226a9f; }
[data-theme="light"] #tab-terminal .ansi-magenta { color: #82539c; }
[data-theme="light"] #tab-terminal .ansi-cyan { color: #1c7280; }
[data-theme="light"] #tab-terminal .ansi-white { color: #394340; }

@media (max-width: 1100px) {
  #tab-artifacts .artifact-layout-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  #tab-artifacts .artifact-col-sidebar > .card {
    min-height: 0;
  }

  #tab-artifacts #json-tree-wrapper {
    max-height: 440px;
  }
}

@media (max-width: 768px) {
  #tab-artifacts > .card {
    margin-bottom: 18px !important;
  }

  #tab-artifacts .card-header {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 16px;
  }

  #tab-artifacts .artifact-col-main > .card + .card {
    margin-top: 18px;
  }

  #tab-artifacts .board-viewer-card {
    margin: 0 16px 16px;
    width: calc(100% - 32px);
  }

  #tab-artifacts #dxf-cards-list {
    padding: 0 16px 10px;
  }

  #tab-artifacts .dxf-card {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  #tab-artifacts .dxf-card > div:last-child,
  #tab-artifacts .dxf-dl-btn {
    width: 100%;
  }

  #tab-artifacts #board-zoom-modal .modal-content {
    width: 96vw !important;
    height: 88vh !important;
    max-width: 96vw;
    max-height: 88vh;
  }

  #tab-artifacts #board-zoom-modal .modal-header {
    padding: 10px 12px;
  }

  #tab-terminal .terminal-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px;
  }

  #tab-terminal .terminal-controls {
    width: 100%;
    flex-wrap: wrap;
  }

  #tab-terminal .terminal-controls #term-search-input {
    flex: 1 1 170px;
  }

  #tab-terminal .terminal-screen {
    padding: 12px;
  }
}

@media (max-width: 480px) {
  #tab-artifacts .card-header > div:last-child {
    width: 100%;
    flex-wrap: wrap;
  }

  #tab-artifacts .card-header > div:last-child .btn {
    flex: 1 1 auto;
  }

  #tab-artifacts #json-tree-wrapper {
    padding: 12px 10px;
    font-size: var(--fs-sm);
  }

  #tab-artifacts #json-file-select {
    font-size: var(--fs-md);
  }

  #tab-terminal .window-dots {
    display: none;
  }

  #tab-terminal .terminal-controls {
    gap: 7px;
  }

  #tab-terminal .terminal-controls #term-search-input {
    flex-basis: 100%;
    width: 100% !important;
  }

  #tab-terminal .terminal-controls #term-level-select {
    flex: 1;
    width: auto !important;
  }

  #tab-terminal .terminal-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
}
