@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&family=Open+Sans+Condensed:wght@700&family=Fira+Mono:wght@400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  padding: 2rem;
  font-family: "Open Sans", "Segoe UI", Tahoma, sans-serif;
  font-size: 15px;
  background: #F5F7F7;
  color: #002A3A;
}

h1 {
  font-family: "Open Sans Condensed", "Open Sans", "Segoe UI", sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #003b5c;
  margin-bottom: 4px;
}
.subtitle { font-size: 13px; color: #4D8399; margin-bottom: 1.5rem; }

/* ── Status bar ─────────────────────────────────────────────────────────── */
.status-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 1.5rem; align-items: center; }
.version-label { font-size: 12px; color: #4D8399; }
.version-select {
  font-size: 12px; padding: 3px 8px; border: 1px solid #D9E1E2; border-radius: 4px;
  font-family: inherit; color: #002A3A; background: #fff; cursor: pointer;
}
.version-select:focus { outline: none; border-color: #00a3e0; }
.badge-pill {
  font-size: 11px; padding: 3px 10px; border-radius: 999px; font-weight: 600; cursor: default;
}
.badge-pill.ok   { background: rgba(44, 213, 196, 0.12); color: #166B62; }
.badge-pill.warn { background: rgba(221, 74, 105, 0.10); color: #9B2335; }
.badge-pill.info { background: rgba(0, 163, 224, 0.10);  color: #003551; }

/* ── Two-column layout ──────────────────────────────────────────────────── */
.viewer {
  display: flex;
  flex-direction: row;
  background: #fff;
  border: 1px solid #D9E1E2;
  border-radius: 6px;
  overflow: hidden;
  min-height: 640px;
  max-height: calc(100vh - 140px);
}

/* ── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #F5F7F7;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.search-wrap { padding: 10px 12px; border-bottom: 1px solid #D9E1E2; flex-shrink: 0; }

.search-input {
  width: 100%;
  padding: 6px 10px 6px 28px;
  border: 1px solid #D9E1E2;
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
  color: #002A3A;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234D8399' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 8px center;
}
.search-input:focus { outline: none; border-color: #00a3e0; }

.tree-controls {
  padding: 5px 12px;
  border-bottom: 1px solid #D9E1E2;
  font-size: 11px;
  color: #4D8399;
  flex-shrink: 0;
  display: flex;
  gap: 6px;
  align-items: center;
}
.tree-controls a { color: #0055A6; text-decoration: none; }
.tree-controls a:hover { text-decoration: underline; color: #00a3e0; }

.tree-scroll { flex: 1; overflow-y: auto; padding: 6px 0; }

.tree-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
  cursor: pointer;
  font-size: 12px;
  color: #003551;
  user-select: none;
  line-height: 1.4;
}
.tree-item:hover { background: #EAF4F9; }
.tree-item.selected { background: #F1FBFF; }
.tree-item.selected .tree-name { color: #0055A6; }

.tree-toggle { font-size: 9px; color: #4D8399; width: 14px; text-align: center; flex-shrink: 0; }
.tree-name { font-family: "Fira Mono", Consolas, Menlo, Monaco, monospace; font-size: 11.5px; }

/* ── Resizable divider ──────────────────────────────────────────────────── */
.divider {
  flex-shrink: 0;
  width: 6px;
  background: #D9E1E2;
  cursor: col-resize;
  position: relative;
  transition: background 0.15s;
  touch-action: none;
}
.divider::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 24px;
  background: repeating-linear-gradient(to bottom, #4D8399 0 3px, transparent 3px 6px);
}
.divider:hover,
.divider.dragging { background: #EAF4F9; }
.divider:hover::after,
.divider.dragging::after {
  background: repeating-linear-gradient(to bottom, #00a3e0 0 3px, transparent 3px 6px);
}

/* ── Main panel ─────────────────────────────────────────────────────────── */
.main { flex: 1; overflow-y: auto; min-width: 0; }
.empty-state { padding: 60px 40px; color: #4D8399; font-size: 13px; text-align: center; font-style: italic; }

/* ── Welcome panel ──────────────────────────────────────────────────────── */
.welcome-panel { padding: 28px 32px; max-width: 600px; }
.welcome-section { margin-bottom: 28px; }
.welcome-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: #4D8399; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid #D9E1E2;
}
.welcome-text { font-size: 13px; color: #002A3A; line-height: 1.7; margin-bottom: 10px; }
.welcome-link { font-size: 13px; color: #0055A6; text-decoration: none; }
.welcome-link:hover { color: #00a3e0; text-decoration: underline; }
.welcome-steps { padding-left: 18px; font-size: 13px; color: #002A3A; line-height: 1.9; }
.legend-rows { display: flex; flex-direction: column; gap: 10px; }
.legend-row { display: flex; align-items: center; gap: 12px; }
.legend-desc { font-size: 12px; color: #4D8399; }

/* ── Change summary ─────────────────────────────────────────────────────── */
.diff-title-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid #D9E1E2;
}
.diff-title-row .welcome-section-title { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.diff-compare-wrap { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.diff-compare-label { font-size: 11px; color: #4D8399; }
.diff-compare-select {
  font-size: 11px; padding: 2px 6px; border: 1px solid #D9E1E2; border-radius: 4px;
  font-family: inherit; color: #002A3A; background: #fff; cursor: pointer;
}
.diff-compare-select:focus { outline: none; border-color: #00a3e0; }
.diff-note {
  font-size: 11px; color: #4D8399; font-style: italic; margin-bottom: 12px;
  padding: 6px 10px; background: rgba(0, 163, 224, 0.06); border-radius: 4px;
  border-left: 2px solid #46BDE9; line-height: 1.5;
}
.diff-group { margin-bottom: 10px; }
.diff-label {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 4px; margin-bottom: 6px;
}
.diff-added    { background: rgba(44, 213, 196, 0.12); color: #166B62; border: 1px solid #2CD5C4; }
.diff-removed  { background: rgba(221,  74, 105, 0.10); color: #9B2335; border: 1px solid #DD4A69; }
.diff-modified { background: rgba(255, 184,  28, 0.12); color: #7A5000; border: 1px solid #FFB81C; }
.diff-list { list-style: none; padding-left: 4px; }
.diff-item { font-size: 12px; padding: 2px 0; color: #002A3A; }
.diff-field { font-family: "Fira Mono", Consolas, Menlo, Monaco, monospace; color: #003b5c; }
.diff-desc  { color: #4D8399; }

/* ── Field card ─────────────────────────────────────────────────────────── */
.field-card { padding: 24px 28px; }

.breadcrumb { font-family: "Fira Mono", Consolas, Menlo, Monaco, monospace; font-size: 11px; color: #4D8399; margin-bottom: 10px; }

.field-title-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.field-title { font-family: "Fira Mono", Consolas, Menlo, Monaco, monospace; font-size: 22px; font-weight: 500; color: #003b5c; }

.field-desc { font-size: 13px; color: #002A3A; line-height: 1.6; margin-bottom: 18px; }

.meta-row { display: flex; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; align-items: center; }
.meta-item { display: flex; align-items: center; gap: 8px; }
.meta-label { font-size: 12px; color: #4D8399; }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 11px; padding: 2px 10px; border-radius: 4px; font-weight: 500; white-space: nowrap;
}
.badge-required { background: rgba(255, 184, 28, 0.12); color: #7A5000; border: 1px solid #FFB81C; }
.badge-optional { background: #F5F7F7;                  color: #4D8399; border: 1px solid #D9E1E2; }
.badge-default  { background: rgba(0, 163, 224, 0.08);  color: #003551; border: 1px solid #92D9F3; }
.badge-expert   { background: rgba(105, 42, 132, 0.08); color: #692A84; border: 1px solid #C8A0F0; }

.type-badge    { background: rgba(0,  85, 166, 0.07); color: #003551; border: 1px solid #92D9F3; }
.type-string   { background: rgba(44, 213, 196, 0.10); color: #166B62; border-color: #2CD5C4; }
.type-object   { background: rgba(0,  85, 166, 0.07); color: #003551; border-color: #92D9F3; }
.type-boolean  { background: rgba(255,184,  28, 0.12); color: #7A5000; border-color: #FFB81C; }
.type-array    { background: rgba(0, 163, 224, 0.10);  color: #003551; border-color: #46BDE9; }
.type-integer,
.type-number   { background: rgba(0, 163, 224, 0.10);  color: #003551; border-color: #46BDE9; }
.type-union    { background: rgba(105, 42, 132, 0.08); color: #692A84; border-color: #C8A0F0; }

/* ── Sections ───────────────────────────────────────────────────────────── */
.section { margin-bottom: 28px; }
.section-title {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: #4D8399; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid #D9E1E2;
}

/* ── Union rows ─────────────────────────────────────────────────────────── */
.union-list { border: 1px solid #D9E1E2; border-radius: 4px; overflow: hidden; }
.union-row {
  display: flex; align-items: baseline; gap: 16px;
  padding: 10px 14px; border-bottom: 1px solid #D9E1E2; font-size: 12px;
}
.union-row:last-child { border-bottom: none; }
.union-row:nth-child(even) { background: #F5F7F7; }
.union-value { font-family: "Fira Mono", Consolas, Menlo, Monaco, monospace; color: #0055A6; min-width: 110px; flex-shrink: 0; }
.union-desc  { color: #002A3A; line-height: 1.5; }

/* ── Properties table ───────────────────────────────────────────────────── */
.props-table { width: 100%; border-collapse: collapse; font-size: 12px; border: 1px solid #D9E1E2; border-radius: 4px; overflow: hidden; }
.props-table tr:not(:last-child) td { border-bottom: 1px solid #D9E1E2; }
.prop-name-cell {
  padding: 10px 14px; width: 150px; vertical-align: top;
  background: #F5F7F7; border-right: 1px solid #D9E1E2;
}
.prop-name  { font-family: "Fira Mono", Consolas, Menlo, Monaco, monospace; font-weight: 500; color: #003b5c; display: block; }
.prop-drill { font-family: "Fira Mono", Consolas, Menlo, Monaco, monospace; font-weight: 500; color: #0055A6; display: block; text-decoration: none; }
.prop-drill:hover { text-decoration: underline; color: #00a3e0; }
.prop-type { font-family: "Fira Mono", Consolas, Menlo, Monaco, monospace; font-size: 10px; color: #4D8399; margin-top: 2px; display: block; }
.prop-desc-cell { padding: 10px 14px; vertical-align: top; color: #002A3A; line-height: 1.5; }
.prop-badges { display: flex; gap: 6px; margin-top: 5px; flex-wrap: wrap; }

/* ── Variant grouping ───────────────────────────────────────────────────── */
.variant-block { margin-bottom: 12px; }
.variant-label {
  font-size: 11px; color: #4D8399;
  padding: 5px 10px; background: #F5F7F7;
  border: 1px solid #D9E1E2; border-bottom: none; border-radius: 4px 4px 0 0;
}
.variant-label code { font-family: "Fira Mono", Consolas, Menlo, Monaco, monospace; color: #0055A6; }
.variant-block .props-table { border-radius: 0 0 4px 4px; }

/* ── Mobile layout ──────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  body { padding: 1rem; }

  .viewer {
    flex-direction: column;
    min-height: 0;
    max-height: calc(100vh - 120px);
  }

  .sidebar {
    width: 100%;
    height: 300px;
  }

  .divider {
    width: 100%;
    height: 6px;
    cursor: row-resize;
  }
  .divider::after {
    width: 24px;
    height: 2px;
    background: repeating-linear-gradient(to right, #4D8399 0 3px, transparent 3px 6px);
  }
  .divider:hover::after,
  .divider.dragging::after {
    background: repeating-linear-gradient(to right, #00a3e0 0 3px, transparent 3px 6px);
  }
}
