/* ============================================================================
   SCHEMAS PAGE — REDESIGNED
   ============================================================================ */

/* ─── Hero ────────────────────────────────────────────────────────────────── */

.schema-page {
  padding-bottom: 80px;
}

.schema-hero {
  border-bottom: 1px solid var(--border);
  padding: 48px 0 40px;
}

.schema-hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 40px;
}

.schema-hero-text {
  flex: 1;
  min-width: 0;
}

.schema-hero-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: rgba(108,140,255,0.08);
  border: 1px solid rgba(108,140,255,0.15);
  padding: 3px 10px;
  border-radius: 4px;
  margin-bottom: 14px;
}

.schema-hero h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.schema-hero p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 560px;
}

.schema-hero-stats {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
  padding-top: 8px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 80px;
}

.stat-val {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ─── Section ─────────────────────────────────────────────────────────────── */

.schema-section {
  padding: 36px 0;
}

.schema-section-alt {
  border-top: 1px solid var(--border);
}

.schema-section-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 32px;
}

.section-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-bar h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ─── Copy Button ─────────────────────────────────────────────────────────── */

.schema-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.schema-copy-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  color: var(--text);
}

.schema-copy-btn.copied {
  color: var(--green);
  border-color: rgba(52,211,153,0.3);
  background: rgba(52,211,153,0.06);
}

.schema-copy-btn.small {
  padding: 5px 10px;
  font-size: 11px;
}

/* ─── Field Table ─────────────────────────────────────────────────────────── */

.field-table {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Group */
.ft-group {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-card);
}

.ft-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.ft-group-icon {
  font-size: 15px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(108,140,255,0.06);
  border-radius: 6px;
  flex-shrink: 0;
}

.ft-group-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.ft-group-meta {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

/* Column header row */
.ft-cols {
  display: grid;
  grid-template-columns: 200px 120px 1fr 100px;
  gap: 12px;
  padding: 8px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.ft-col-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  opacity: 0.6;
}

/* Field row */
.ft-row {
  display: grid;
  grid-template-columns: 200px 120px 1fr 100px;
  gap: 12px;
  align-items: baseline;
  padding: 10px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.02);
  transition: background 0.1s;
}

.ft-row:last-child {
  border-bottom: none;
}

.ft-row:hover {
  background: rgba(255,255,255,0.012);
}

/* Field name */
.ft-name {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ft-name.nested {
  padding-left: 18px;
}

.ft-name .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ft-name .dot.match { background: var(--green); }
.ft-name .dot.req   { background: var(--red); }
.ft-name .dot.opt   { background: var(--text-dim); opacity: 0.4; }

/* Type */
.ft-type {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}

/* Description */
.ft-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
}

/* Weight badge */
.ft-weight {
  text-align: right;
}

.weight-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.weight-badge.high {
  color: var(--green);
  background: rgba(52,211,153,0.08);
}

.weight-badge.mid {
  color: var(--accent);
  background: rgba(108,140,255,0.08);
}

.weight-badge.low {
  color: var(--text-dim);
  background: rgba(92,100,120,0.12);
}

.weight-badge.none {
  color: var(--text-dim);
  opacity: 0.4;
  font-size: 10px;
}

/* ─── Legend (inline in section bar) ──────────────────────────────────────── */

.field-legend-inline {
  display: flex;
  gap: 14px;
  align-items: center;
}

.legend-inline-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-dim);
}

.legend-inline-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.legend-inline-dot.match { background: var(--green); }
.legend-inline-dot.req   { background: var(--red); }
.legend-inline-dot.opt   { background: var(--text-dim); opacity: 0.4; }

/* ─── Raw JSON Toggle ─────────────────────────────────────────────────────── */

.raw-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  padding: 4px 0;
}

.raw-toggle h2 {
  font-size: 16px;
  font-weight: 700;
}

.raw-toggle-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  transition: color 0.15s;
}

.raw-toggle:hover .raw-toggle-hint {
  color: var(--accent);
}

.raw-panel {
  display: none;
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.raw-panel.open {
  display: block;
}

.raw-panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.raw-filename {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
}

.raw-code {
  margin: 0;
  padding: 20px 24px;
  background: var(--bg);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-muted);
  overflow-x: auto;
  max-height: 520px;
  tab-size: 2;
}

/* Syntax colors — muted, not screaming */
.raw-code .tk-key   { color: var(--text); font-weight: 500; }
.raw-code .tk-str   { color: #7ec699; }
.raw-code .tk-num   { color: #d4976c; }
.raw-code .tk-bool  { color: #c9a0dc; }
.raw-code .tk-null  { color: var(--text-dim); font-style: italic; }
.raw-code .tk-brace { color: var(--text-dim); opacity: 0.5; }
.raw-code .tk-colon { color: var(--text-dim); opacity: 0.35; }

/* ─── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .schema-hero-inner {
    flex-direction: column;
  }
  .schema-hero-stats {
    padding-top: 0;
  }
  .ft-cols,
  .ft-row {
    grid-template-columns: 160px 100px 1fr 80px;
    gap: 8px;
    padding: 10px 14px;
  }
}

@media (max-width: 640px) {
  .schema-hero {
    padding: 32px 0 28px;
  }
  .schema-hero h1 {
    font-size: 22px;
  }
  .schema-hero-stats {
    gap: 8px;
  }
  .stat-card {
    padding: 12px 14px;
    min-width: 60px;
  }
  .stat-val {
    font-size: 20px;
  }
  .ft-cols { display: none; }
  .ft-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 12px 14px;
  }
  .ft-weight { text-align: left; }
  .section-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}
