/*
 * plugin-injections.css — shared layout primitives for plugin-injected
 * header.command drawers, device.panel.tab bodies, and device.context.action
 * popovers.
 *
 * Background: the shell CSP sets `style-src-attr 'none'`, so any inline
 * style="..." attribute injected by a plugin is silently dropped by the
 * browser. Plugins therefore cannot embed layout-critical inline styles.
 * This file holds the layout/utility classes those plugins reference.
 *
 * The shell loads this stylesheet alongside the rest of the sanctum
 * CSS (see app.js / index.html).
 */

/* ── Drawer layout primitives ─────────────────────────────────────────── */

.am-pi-stack {
  display: flex;
  flex-direction: column;
}

.am-pi-row {
  display: flex;
  flex-direction: row;
  gap: 8px;
}

.am-pi-row-grow > input,
.am-pi-row-grow > textarea {
  flex: 1 1 auto;
}

.am-pi-search-form {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.am-pi-search-form > input { flex: 1 1 auto; }

/* Two-column results / detail layout for header drawers (vault, circuit, ...). */
.am-pi-split {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 12px;
  min-height: 280px;
}
.am-pi-split-list,
.am-pi-split-detail {
  max-height: 60vh;
  overflow: auto;
}
.am-pi-split-detail {
  padding: 12px;
}
@media (max-width: 768px) {
  .am-pi-split {
    grid-template-columns: 1fr;
  }
}

/* ── Cards ────────────────────────────────────────────────────────────── */

.am-pi-result-card {
  margin-bottom: 8px;
  cursor: pointer;
}

.am-pi-result-card-active {
  border-color: var(--color-primary, #7c6af7);
}

.am-pi-detail-header {
  margin: 0 0 12px 0;
}
.am-pi-detail-header h3,
.am-pi-detail-header h4 {
  margin: 0;
}
.am-pi-detail-meta {
  margin: 4px 0 0 0;
  font-size: 11px;
}

.am-pi-pre-card {
  white-space: pre-wrap;
  max-height: 360px;
  overflow: auto;
  margin: 0;
  font-size: 11px;
}
.am-pi-pre-card-tall {
  max-height: 280px;
}
.am-pi-pre-card-short {
  max-height: 200px;
}

.am-pi-section-spacer {
  margin-top: 16px;
}

.am-pi-action-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

/* ── Forms (cmd, note, favorites etc.) ────────────────────────────────── */

.am-pi-form-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
}

.am-pi-form-row {
  display: flex;
  gap: 8px;
  align-items: end;
}

.am-pi-cmd-form {
  display: flex;
  gap: 8px;
}
.am-pi-cmd-form > input { flex: 1 1 auto; }
.am-pi-cmd-form > select { flex: 0 0 120px; }

.am-pi-cmd-output {
  white-space: pre-wrap;
  max-height: 220px;
  overflow: auto;
  margin-top: 12px;
}

/* ── Passage drawer ───────────────────────────────────────────────────── */

.am-pi-passage-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
  min-height: 320px;
}
@media (max-width: 768px) {
  .am-pi-passage-grid {
    grid-template-columns: 1fr;
  }
}
.am-pi-passage-sidebar {
  border-right: 1px solid var(--color-border, #2d3148);
  padding-right: 12px;
}
.am-pi-passage-section-title {
  margin: 0 0 8px 0;
  font-size: 13px;
}
.am-pi-passage-section {
  margin-bottom: 16px;
}
.am-pi-passage-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.am-pi-tunnel-card {
  padding: 8px;
  margin-bottom: 6px;
}
.am-pi-tunnel-meta {
  margin: 2px 0;
  font-size: 11px;
}
.am-pi-tunnel-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}
.am-pi-status-line {
  font-size: 12px;
}
.am-pi-status-line.am-pi-error {
  color: var(--color-danger, #da3633);
}

/* ── Terminal drawer (relay MC terminal etc.) ─────────────────────────── */

.am-pi-terminal-output {
  background: #0d1117;
  color: #c9d1d9;
  padding: 12px;
  border-radius: 6px;
  height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: ui-monospace, "SFMono-Regular", "Menlo", monospace;
  margin: 0;
}
.am-pi-terminal-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.am-pi-terminal-form > input {
  flex: 1 1 auto;
  font-family: ui-monospace, "SFMono-Regular", "Menlo", monospace;
}

/* ── Tab body (bridge SC, relay MC, processes/services/tasks tables) ── */

.am-pi-tab-header {
  margin-bottom: 8px;
}
.am-pi-list-card-row {
  padding: 6px 8px;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}
.am-pi-list-card-row > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}
.am-pi-list-card-row-actions {
  display: flex;
  gap: 4px;
}
.am-pi-card-title-meta {
  margin-left: 8px;
  font-size: 11px;
}
