/* ─── Data Renderer ─────────────────────────────────────────────────────────
   Shared styles for renderHTMLFromXML and renderHTMLFromJSON output.
   Uses Bootstrap 5.3 CSS custom properties — dark mode is automatic via
   [data-bs-theme=dark] applied by color-modes.js; no @media block needed.

   Class vocabulary:
     *-object      root / structural container
     *-item        repeated record  (<article>)
     *-field       leaf key-value pair  (<p>)
     *-key         key label  (<span>)
     *-sep         separator  (<span>)
     *-value       value  (<span>)
     *-array       object-array container (JSON)
     *-list        scalar-array list  (<ul>, JSON)
     *-list-item   scalar list item   (<li>,  JSON)
─────────────────────────────────────────────────────────────────────────── */

/* ── Root section container ─────────────────────────────────────────────── */
.xml-object:is(section),
.json-object:is(section) {
  background: var(--bs-body-bg);
  border: var(--bs-border-width) solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  padding: 1.25rem;
  font-family: var(--bs-body-font-family);
  font-size: 0.9rem;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ── Nested object container ────────────────────────────────────────────── */
.xml-object:is(div),
.json-object:is(div) {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-left: 2px solid var(--bs-border-color);
}

/* ── Repeated record card ───────────────────────────────────────────────── */
.xml-item,
.json-item {
  background: var(--bs-tertiary-bg);
  border: var(--bs-border-width) solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  padding: 0.875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  box-shadow: var(--bs-box-shadow-sm);
  transition: box-shadow 0.15s ease;
}

.xml-item:nth-child(even),
.json-item:nth-child(even) {
  background: var(--bs-secondary-bg);
}

.xml-item:hover,
.json-item:hover {
  box-shadow: var(--bs-box-shadow);
}

/* Bootstrap Icons badge inside item headers */
.xml-item > .bi,
.json-item > .bi {
  align-self: flex-start;
  font-size: 0.9rem;
  color: var(--bs-secondary-color);
}

/* ── Array / list containers ────────────────────────────────────────────── */
.json-array,
.json-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ── Leaf field row ─────────────────────────────────────────────────────── */
.xml-field,
.json-field {
  margin: 0;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  padding: 0.125rem 0;
  border-bottom: 1px solid transparent;
}

.xml-field:not(:last-child),
.json-field:not(:last-child) {
  border-bottom-color: var(--bs-border-color);
}

/* ── Key label ──────────────────────────────────────────────────────────── */
.xml-key,
.json-key {
  font-weight: 600;
  color: var(--bs-body-color);
  white-space: nowrap;
  flex-shrink: 0;
  text-transform: capitalize;
}

/* Bootstrap Icons inside key labels */
.xml-key .bi,
.json-key .bi {
  font-size: 0.85em;
  vertical-align: middle;
  margin-right: 0.25em;
  line-height: 1;
}

/* ── Separator ──────────────────────────────────────────────────────────── */
.xml-sep,
.json-sep {
  color: var(--bs-secondary-color);
  margin: 0 0.25rem;
  flex-shrink: 0;
}

/* ── XML value ──────────────────────────────────────────────────────────── */
.xml-value {
  color: var(--bs-info-text-emphasis);
  word-break: break-word;
}

/* ── JSON values ────────────────────────────────────────────────────────── */
.json-value {
  word-break: break-word;
}

.json-value.json-string { color: var(--bs-info-text-emphasis); }
.json-value.json-number { color: var(--bs-success-text-emphasis); font-family: var(--bs-font-monospace); }
.json-value.json-bool   { color: var(--bs-warning-text-emphasis); font-style: italic; }

/* ── Scalar list (<ul class="json-list">) ───────────────────────────────── */
.json-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.json-list-item {
  padding: 0.25rem 0.5rem;
  border-bottom: var(--bs-border-width) solid var(--bs-border-color);
  color: var(--bs-info-text-emphasis);
}

.json-list-item:last-child {
  border-bottom: none;
}
