/* =============================================================
   JSON Batch Field Aggregator - styles
   ============================================================= */

:root {
  --bg: #101418;
  --bg-panel: #171c22;
  --bg-panel-hdr: #1e252d;
  --bg-input: #0c1015;
  --bg-hover: #232b34;
  --bg-selected: #2a3a50;
  --border: #2b333d;
  --text: #e6ecf1;
  --text-dim: #9aa7b4;
  --text-faint: #6b7785;
  --accent: #4ea1ff;
  --accent-hover: #6fb2ff;
  --danger: #ff6b6b;
  --warning-bg: #3b2f16;
  --warning-border: #8a6a22;
  --warning-text: #f0c75e;
  --v-string: #a6e3a1;
  --v-number: #f9b17a;
  --v-boolean: #c6a0ff;
  --v-null: #ff8080;
  --v-key: #7fc8ff;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel-hdr);
}
.app-header h1 {
  margin: 0 0 4px 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.app-header .hint {
  margin: 0;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.45;
}

/* -------- Grid layout -------- */
.app-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 320px 320px 1fr;
  gap: 10px;
  padding: 10px;
  min-height: 0;
}

@media (max-width: 900px) {
  .app-grid {
    grid-template-columns: 1fr;
  }
}

.panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-height: 0;
  overflow: hidden;
}

.panel-header {
  padding: 10px 12px;
  background: var(--bg-panel-hdr);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.panel-header h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
}

.selected-path {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}

.panel-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  flex: 1;
}

/* -------- Form controls -------- */
.block-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: -4px;
}
.inline-label {
  font-size: 12px;
  color: var(--text-dim);
}

input[type="file"],
input[type="search"],
input[type="text"],
textarea,
select {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 13px;
  font-family: inherit;
  width: 100%;
}

textarea {
  font-family: var(--mono);
  resize: vertical;
  min-height: 100px;
}

input[type="search"]:focus,
input[type="text"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
}

button {
  background: var(--accent);
  color: #07101c;
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
button:hover { background: var(--accent-hover); }
button.secondary {
  background: var(--bg-hover);
  color: var(--text);
  border: 1px solid var(--border);
}
button.secondary:hover {
  background: #2d3843;
}

.btn-row, .controls-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.checkbox {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
}

/* -------- Status / warnings -------- */
.status {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--mono);
  white-space: pre-wrap;
  word-break: break-word;
}
.status .ok { color: #a6e3a1; }
.status .err { color: var(--danger); }

.warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning-text);
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 12px;
}

/* -------- Field list -------- */
.field-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-input);
  overflow: auto;
  flex: 1;
  min-height: 120px;
}
.field-list:focus { outline: 1px solid var(--accent); }

.field-item {
  padding: 5px 8px;
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid #1b222a;
  color: var(--text);
}
.field-item:hover { background: var(--bg-hover); }
.field-item.selected { background: var(--bg-selected); color: #fff; }

.field-item .count {
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.empty-state {
  color: var(--text-faint);
  font-size: 12px;
  font-style: italic;
  padding: 6px 2px;
}

/* -------- Output list -------- */
.output-list {
  flex: 1;
  min-height: 120px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-input);
  padding: 6px 8px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.5;
}

.output-row {
  padding: 3px 0;
  border-bottom: 1px dashed #1f262e;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.output-row:last-child { border-bottom: none; }

.source {
  color: var(--text-faint);
  font-size: 11px;
  padding: 1px 6px;
  background: #1b222a;
  border-radius: 3px;
  flex-shrink: 0;
}

.value-wrap {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

/* -------- Primitive value styles -------- */
.v-string { color: var(--v-string); }
.v-string::before, .v-string::after { content: '"'; color: #4a7a55; }
.v-number { color: var(--v-number); }
.v-boolean { color: var(--v-boolean); }
.v-null { color: var(--v-null); font-style: italic; }
.v-key { color: var(--v-key); }

/* -------- Collapsible -------- */
.collapsible {
  display: inline-block;
  vertical-align: top;
  max-width: 100%;
}

.collapsible__toggle {
  cursor: pointer;
  user-select: none;
  color: var(--text-dim);
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 0 2px;
  border-radius: 3px;
}
.collapsible__toggle:hover { background: var(--bg-hover); color: var(--text); }
.collapsible__toggle:focus {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}

.collapsible__caret { font-size: 10px; display: inline-block; width: 10px; }
.collapsible__type { font-weight: 600; }
.collapsible__size { color: var(--text-faint); font-size: 11px; }

.collapsible__body {
  display: none;
  border-left: 2px solid var(--border);
  margin: 2px 0 2px 8px;
  padding: 2px 0 2px 10px;
}
.collapsible[data-state="expanded"] > .collapsible__body {
  display: block;
}

.object-entry, .array-entry {
  display: block;
  padding: 1px 0;
}
.object-entry > .v-key {
  margin-right: 4px;
}
.object-entry > .v-key::after {
  content: ":";
  color: var(--text-faint);
  margin-left: 1px;
}

.array-index {
  color: var(--text-faint);
  font-size: 10.5px;
  margin-right: 4px;
}
