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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0d1117;
  color: #c9d1d9;
  min-height: 100vh;
}

header {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1rem 2rem;
  background: #161b22;
  border-bottom: 1px solid #30363d;
}

header h1 {
  font-size: 1.4rem;
  color: #58a6ff;
}

nav { display: flex; gap: 0.5rem; }

.nav-btn {
  background: transparent;
  border: 1px solid #30363d;
  color: #8b949e;
  padding: 0.4rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}

.nav-btn:hover { border-color: #58a6ff; color: #c9d1d9; }
.nav-btn.active { background: #1f6feb; border-color: #1f6feb; color: #fff; }

main { padding: 1.5rem 2rem; }

.view { display: none; }
.view.active { display: block; }

/* Browser */
.browser-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  height: calc(100vh - 120px);
}

#version-list {
  overflow-y: auto;
  scrollbar-width: none;
  background: #161b22;
  border-radius: 8px;
  padding: 1rem;
  border: 1px solid #30363d;
}
#version-list::-webkit-scrollbar { display: none; }

#version-list h2 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: #8b949e;
}

#version-list ul, #key-nav ul { list-style: none; }

#version-list li {
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: monospace;
}

#version-list li:hover { background: #1c2128; }
#version-list li.active { background: #1f6feb; color: #fff; }
#version-list li.no-schema { color: #484f58; cursor: default; }

#schema-panel {
  overflow-y: auto;
  scrollbar-width: none;
  background: #161b22;
  border-radius: 8px;
  padding: 1.5rem;
  border: 1px solid #30363d;
}
#schema-panel::-webkit-scrollbar { display: none; }

#schema-search {
  width: 100%;
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
  background: #0d1117;
  color: #c9d1d9;
  border: 1px solid #30363d;
  border-radius: 6px;
  font-family: monospace;
  font-size: 0.85rem;
  outline: none;
}
#schema-search:focus { border-color: #58a6ff; }
#schema-search::placeholder { color: #484f58; }


#schema-placeholder {
  color: #484f58;
  text-align: center;
  margin-top: 4rem;
}

/* Schema tree */
.prop-group { margin-left: 1.2rem; }

.prop-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0;
  cursor: pointer;
  user-select: none;
}

.prop-header:hover { background: #1c2128; border-radius: 4px; }

.prop-toggle {
  width: 16px;
  text-align: center;
  color: #484f58;
  font-size: 0.8rem;
}

.prop-name {
  color: #79c0ff;
  font-family: monospace;
  font-size: 0.9rem;
}

.prop-type {
  color: #d2a8ff;
  font-size: 0.8rem;
  font-family: monospace;
}

.prop-required {
  color: #f85149;
  font-size: 0.7rem;
}

.prop-desc {
  color: #8b949e;
  font-size: 0.8rem;
  margin-left: 0.5rem;
}

.prop-meta {
  color: #484f58;
  font-size: 0.75rem;
  margin-left: 2rem;
  font-family: monospace;
}

.prop-values {
  margin-left: 2rem;
  margin-top: 0.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.prop-value-pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  background: #1c2128;
  border: 1px solid #30363d;
  border-radius: 12px;
  font-family: monospace;
  font-size: 0.75rem;
  color: #e3b341;
}

.prop-sample {
  margin-left: 2rem;
  margin-top: 0.25rem;
  padding: 0.4rem 0.6rem;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.75rem;
  color: #7ee787;
  white-space: pre;
  max-width: 500px;
  overflow-x: auto;
}

.prop-children { display: none; }
.prop-children.open { display: block; }

/* Search-in-tree: hide non-matching nodes, highlight matches */
#schema-tree.search-active .prop-group { display: none; }
#schema-tree.search-active .prop-group.search-match,
#schema-tree.search-active .prop-group.search-ancestor { display: block; }
#schema-tree.search-active .prop-group.search-match > .prop-header {
  background: #9e6a0333;
  border-radius: 4px;
}

/* Validator */
.validator-layout {
  max-width: 900px;
  margin: 0 auto;
}

.validator-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.validator-controls label { color: #8b949e; }

select, button, textarea {
  font-family: inherit;
  font-size: 0.9rem;
}

select {
  background: #0d1117;
  color: #c9d1d9;
  border: 1px solid #30363d;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
}

button {
  background: #238636;
  color: #fff;
  border: none;
  padding: 0.5rem 1.2rem;
  border-radius: 6px;
  cursor: pointer;
}

button:hover { background: #2ea043; }

textarea {
  width: 100%;
  height: 400px;
  background: #0d1117;
  color: #c9d1d9;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 1rem;
  font-family: monospace;
  font-size: 0.85rem;
  resize: vertical;
}

#validate-result {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 8px;
  font-family: monospace;
  font-size: 0.85rem;
  white-space: pre-wrap;
}

.result-valid {
  background: #0d2818;
  border: 1px solid #238636;
  color: #3fb950;
}

.result-invalid {
  background: #2d1212;
  border: 1px solid #f85149;
  color: #f85149;
}

.result-error {
  background: #2d2200;
  border: 1px solid #d29922;
  color: #e3b341;
}

/* Diff */
.diff-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.diff-controls label { color: #8b949e; }

#diff-result {
  max-width: 900px;
}

.diff-entry {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  margin-bottom: 2px;
  font-family: monospace;
  font-size: 0.85rem;
}

.diff-added { background: #0d2818; }
.diff-removed { background: #2d1212; }
.diff-changed { background: #2d2200; }

.diff-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-weight: bold;
  text-transform: uppercase;
  flex-shrink: 0;
}

.diff-added .diff-badge { background: #238636; color: #fff; }
.diff-removed .diff-badge { background: #da3633; color: #fff; }
.diff-changed .diff-badge { background: #9e6a03; color: #fff; }

.diff-path { color: #79c0ff; }
.diff-details { color: #8b949e; }

.diff-summary {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  font-size: 0.9rem;
}

.diff-summary span { margin-right: 1.5rem; }
.diff-summary .added { color: #3fb950; }
.diff-summary .removed { color: #f85149; }
.diff-summary .changed { color: #e3b341; }

.no-changes {
  color: #484f58;
  text-align: center;
  margin-top: 3rem;
}
