/* Runtime-Widget-Canvas — 1:1-Port des Style-Blocks aus
 * CoreViewerRuntimeWidgetCanvas.vue (entscoped, SPEC-0032 §4) plus die
 * Overlay-Gruppen-Klassen aus CoreContentViewer.styles.css (§5) und die
 * Interim-Fallback-Hülle für Komponenten-Renderer. */

.runtime-widget-canvas {
  position: relative;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  border-radius: 8px;
  border: 1px dashed var(--border);
  background: var(--surface);
  overflow: hidden;
}

.runtime-widget-canvas--live {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  overflow: visible;
}

.runtime-widget-canvas--component {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  overflow: hidden;
}

.runtime-widget-canvas--live.runtime-widget-canvas--component {
  overflow: hidden;
}

.runtime-widget-component-shell {
  position: relative;
  flex: none;
}

/* Interim-Hülle (SPEC-0032 §4): sichtbarer Platzhalter statt der
 * Bestands-Vue-Komponente (HUD/Polygonal/Base) — eigene Welle. */
.runtime-widget-component-fallback {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px dashed var(--border-strong, var(--border));
  border-radius: 12px;
  background: var(--surface-elevated);
  color: var(--text);
}

.runtime-widget-component-fallback-name {
  font-weight: 800;
  letter-spacing: 0.03em;
}

.runtime-widget-component-fallback-note {
  font-size: 0.8em;
  color: var(--text-muted);
}

.runtime-widget-node {
  position: absolute;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-elevated);
  color: var(--text);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 4px;
  overflow: hidden;
}

.runtime-widget-canvas--live .runtime-widget-node { overflow: hidden; }

.runtime-widget-node.visual-card-shell {
  border-color: var(--border-strong);
  background: var(--surface-elevated);
  color: var(--text);
  box-shadow: var(--shadow-card);
}

.runtime-widget-node.visual-tile {
  border-color: var(--border-strong);
  background: var(--surface-elevated);
  color: var(--text);
  box-shadow: var(--shadow-card);
}

.runtime-widget-node.visual-headline {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.runtime-widget-node.visual-time-chip {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.runtime-widget-node.visual-metric-progress {
  border-color: color-mix(in srgb, var(--border-strong) 58%, transparent);
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.42), rgba(15, 23, 42, 0.12)),
    radial-gradient(circle at 18% 0%, rgba(56, 189, 248, 0.12), transparent 48%);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.05);
}

.runtime-widget-node.visual-sparkline {
  border-color: transparent;
  background: transparent;
  color: var(--text);
  box-shadow: none;
  display: flex;
  flex-direction: column;
}
.runtime-sparkline {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  gap: 6px;
}
.runtime-sparkline-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.runtime-sparkline-title {
  font-size: 1em;
  font-weight: 800;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.runtime-sparkline-current {
  font-size: 1.22em;
  font-weight: 900;
  line-height: 1;
}
.runtime-sparkline-current--empty {
  opacity: 0.4;
}
.runtime-sparkline-unit {
  font-size: 0.8em;
  font-weight: 600;
  margin-left: 2px;
  opacity: 0.7;
}
.runtime-sparkline-svg {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  display: block;
  filter: drop-shadow(0 0 4px rgba(56, 189, 248, 0.18));
}
.runtime-sparkline-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.625em;
  opacity: 0.55;
}

/* Status-Zone (RiZone-Parität) — Hintergrund kommt inline aus STATE_COLORS. */
.runtime-widget-node.visual-status-zone {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  padding: 0;
}
.runtime-status-zone {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}
.runtime-status-zone-label {
  padding: 0 0.5em;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--core-color-on-accent, #ffffff);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.runtime-card-shell {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.runtime-card-shell-accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 10px;
  border-radius: inherit;
  opacity: 0.95;
}

.runtime-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.runtime-tile-title {
  font-size: 0.82em;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
}

.runtime-tile-gear {
  font-size: 0.95em;
  color: var(--text-muted);
  line-height: 1;
}

.runtime-tile-value-row {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 0.5em;
}

.runtime-tile-value {
  font-size: 1.5em;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--text);
  font-family: Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
}

.runtime-tile-unit {
  font-size: 0.9em;
  font-weight: 700;
  color: var(--text);
}

.runtime-tile-left-accent {
  position: absolute;
  left: 0;
  top: 26px;
  bottom: 12px;
  width: 12px;
  border-radius: 0 8px 8px 0;
}

.runtime-headline {
  font-size: 1em;
  line-height: 1.05;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.runtime-headline-sub {
  margin-top: 6px;
  font-size: 0.55em;
  color: var(--text-muted);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-time-chip {
  width: 100%;
  text-align: right;
  font-size: 1em;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
}

.runtime-badge {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.runtime-metric-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 42%);
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.runtime-metric-head > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.runtime-metric-title {
  font-size: 1em;
  font-weight: 800;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-metric-subtitle {
  margin-top: 2px;
  font-size: 0.7em;
  color: var(--text-muted);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-metric-value-wrap {
  text-align: right;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.runtime-metric-value {
  font-size: 1.5em;
  line-height: 1;
  font-family: Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
  font-weight: 800;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.runtime-metric-unit {
  margin-top: 2px;
  font-size: 0.9em;
  font-weight: 800;
}

.runtime-node-title {
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-node-subtitle {
  margin-top: -2px;
  font-size: 0.88em;
  color: var(--text-muted);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-node-value-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.runtime-node-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  min-width: 0;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.runtime-node-unit {
  opacity: 0.92;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-node-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  overflow: hidden;
}

.runtime-node-bar-fill {
  height: 100%;
  background: var(--success);
}

.runtime-node-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.85em;
  color: var(--primary);
  font-weight: 600;
}

.runtime-plain-label {
  white-space: nowrap;
  line-height: 1.2;
  font-weight: inherit;
  color: inherit;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.runtime-plain-value-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.runtime-plain-value {
  font-weight: inherit;
  line-height: 1.1;
  color: inherit;
  min-width: 0;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.runtime-plain-unit {
  font-weight: 700;
  opacity: 0.95;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-table {
  width: 100%;
  height: 100%;
  min-width: 0;
  overflow: auto;
}

.runtime-table-title {
  margin-bottom: 0.35em;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-table-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75em;
  padding: 0.3em 0;
  border-bottom: 1px solid color-mix(in srgb, currentColor 16%, transparent);
}

.runtime-table-label,
.runtime-table-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-table-value {
  text-align: right;
  font-weight: 700;
}

.runtime-table-empty {
  color: var(--text-muted);
}

.runtime-plain-card-fill {
  position: absolute;
  inset: 0;
}

/* --- Overlay-Gruppen im Viewer (CoreContentViewer.styles.css) ------------ */

.runtime-widget-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.runtime-asset-widget-overlay {
  position: absolute;
  z-index: 110;
  transform: translateX(-50%);
  pointer-events: none;
}

.runtime-asset-widget-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  pointer-events: auto;
  will-change: transform;
}

.runtime-asset-widget-card {
  pointer-events: none;
}

/* Festes Panel für Usages ohne Asset-Bezug (overlayPosX/Y, SPEC-0032 §5).
 *
 * BEFUND (2026-08-17): `pointer-events: none` machte dieses Panel unerreichbar
 * — die Ebene darüber (.runtime-widget-layer) ist ebenfalls durchlässig, die
 * einzige Karte darin (.runtime-asset-widget-card) auch. Ein Zeigerdruck fiel
 * also durch bis auf den Canvas und drehte die Kamera, statt das Panel zu
 * greifen: `#onWidgetPointerDown` sah es nie. Der Zieh-Weg für feste Panels
 * (Bestand startRuntimeOverlayDrag) war damit vollständig tot, obwohl er im
 * Viewer ausprogrammiert ist. Die verankerte Gruppe nebenan macht es richtig
 * (.runtime-asset-widget-stack: pointer-events: auto), und die Vorlagen-Regel
 * in viewer-parts.css setzt für dasselbe Panel ebenfalls `auto` samt
 * `cursor: move`. */
.viewer-runtime-overlay {
  position: absolute;
  z-index: 110;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  pointer-events: auto;
  cursor: move;
  touch-action: none;
  user-select: none;
}

/* Platzhalter-Pille NUR auf der Designfläche (SPEC-0516 §2 E, Bestand
 * CoreViewerRuntimeWidgetCanvas.vue scoped style). Sie erscheint, wenn ein
 * Knoten an ein Feld gebunden ist, das in den Vorschaudaten zu nichts
 * aufloest: der Autor soll eine unaufgeloeste Bindung von statischem Text und
 * von einem echten Wert unterscheiden koennen. Im Live- und Vorschau-Pfad
 * kann sie nicht entstehen — die Registry liefert dort nur Zeichenketten. */
.runtime-designer-placeholder {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 0.08em 0.5em;
  border: 1px dashed color-mix(in srgb, var(--primary) 60%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
  color: var(--text);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.8em;
  font-weight: 600;
  font-style: normal;
  letter-spacing: 0.01em;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.96;
}
