/* json-parser.css — JSON在线解析工具（页面私有样式，jp- 前缀；不覆盖全局 --primary） */

.jp-tool {
  position: relative;
}

.jp-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-top: 20px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
}

/* ---------- 卡片头 ---------- */
.jp-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.jp-card-head h2 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #0f172a;
  margin: 0;
}

.jp-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .88rem;
  color: #475569;
  cursor: pointer;
  user-select: none;
}

.jp-switch input {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ---------- 错误条 ---------- */
.jp-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: .88rem;
  line-height: 1.65;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 0 0 12px;
  white-space: pre-wrap;
  word-break: break-all;
}

.jp-error[hidden] {
  display: none;
}

.jp-error::before {
  content: "⚠️";
  flex: none;
}

/* ---------- 双栏 ---------- */
.jp-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.jp-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.jp-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.jp-col-title {
  font-size: .92rem;
  font-weight: 600;
  color: #334155;
}

.jp-col-meta {
  font-size: .78rem;
  color: #94a3b8;
}

.jp-stats {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
}

.jp-stat b {
  color: var(--primary);
  font-weight: 600;
}

/* ---------- 输入编辑器（深色） ---------- */
.jp-editor {
  display: flex;
  height: 460px;
  border-radius: 8px;
  overflow: hidden;
  background: #0f172a;
  border: 1px solid #1e293b;
}

.jp-gutter {
  flex: none;
  min-width: 46px;
  padding: 10px 8px 10px 4px;
  background: #0b1222;
  color: #475569;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
  text-align: right;
  overflow: hidden;
  user-select: none;
  white-space: pre;
}

.jp-gutter .ln-err {
  color: #fca5a5;
  background: rgba(239, 68, 68, .2);
  border-radius: 3px;
}

.jp-editor-stack {
  position: relative;
  flex: 1;
  min-width: 0;
}

.jp-highlight,
.jp-highlight code {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.jp-highlight {
  position: absolute;
  inset: 0;
  padding: 10px 12px;
  overflow: auto;
  pointer-events: none;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
  white-space: pre;
  tab-size: 2;
  color: #e2e8f0;
}

.jp-highlight .tk-key { color: #7dd3fc; }
.jp-highlight .tk-str { color: #86efac; }
.jp-highlight .tk-num { color: #fbbf24; }
.jp-highlight .tk-lit { color: #c084fc; }
.jp-highlight .tk-pun { color: #64748b; }

#jpInput {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  outline: 0;
  resize: none;
  padding: 10px 12px;
  background: transparent;
  color: transparent;
  caret-color: #f8fafc;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
  white-space: pre;
  overflow: auto;
  tab-size: 2;
}

#jpInput::placeholder {
  color: #64748b;
}

#jpInput::selection {
  background: rgba(59, 130, 246, .35);
}

/* ---------- 树视图（浅色） ---------- */
.jp-search {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

#jpSearchInput {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: .86rem;
  color: #0f172a;
  outline: none;
}

#jpSearchInput:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}

.jp-search-count {
  flex: none;
  font-size: .78rem;
  color: #64748b;
  white-space: nowrap;
}

.jp-search-clear {
  flex: none;
  width: 28px;
  height: 28px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  color: #64748b;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.jp-search-clear:hover {
  color: #b91c1c;
  border-color: #fca5a5;
}

.jp-tree {
  height: 418px;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 6px;
}

.jp-tree-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #94a3b8;
  font-size: .9rem;
  text-align: center;
  padding: 0 20px;
}

.jp-tree-empty-icon {
  font-size: 34px;
  margin-bottom: 4px;
}

.jp-tree-empty-hint {
  font-size: .8rem;
  color: #cbd5e1;
}

.jp-tree-body {
  font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
  color: #0f172a;
}

.jp-node {
  min-width: fit-content;
}

.jp-children {
  margin-left: 9px;
  padding-left: 8px;
  border-left: 1px solid #e2e8f0;
}

.jp-row {
  display: flex;
  align-items: baseline;
  padding: 2px 6px;
  border-radius: 5px;
  white-space: pre-wrap;
  word-break: break-all;
}

.jp-row:hover {
  background: #eef2ff;
}

.jp-row.jp-row-hit {
  background: #fef9c3;
}

.jp-row.jp-hit-cur {
  background: #fef3c7;
  outline: 2px solid #f59e0b;
  outline-offset: -2px;
}

.jp-toggle {
  flex: none;
  width: 16px;
  cursor: pointer;
  color: #94a3b8;
  font-size: 11px;
  user-select: none;
}

.jp-toggle:hover {
  color: var(--primary);
}

.jp-key {
  color: #1d4ed8;
}

.jp-colon {
  color: #94a3b8;
}

.jp-val-str { color: #a31515; }
.jp-val-num { color: #047857; }
.jp-val-bool { color: #7c3aed; }
.jp-val-null { color: #64748b; font-style: italic; }
.jp-val-big { color: #b45309; }

.jp-summary {
  color: #94a3b8;
}

.jp-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  font: 600 10px/16px ui-monospace, SFMono-Regular, Consolas, monospace;
  vertical-align: 1px;
}

.jp-badge-t-str { background: #fee2e2; color: #b91c1c; }
.jp-badge-t-num { background: #d1fae5; color: #065f46; }
.jp-badge-t-bool { background: #ede9fe; color: #6d28d9; }
.jp-badge-t-null { background: #f1f5f9; color: #64748b; }
.jp-badge-t-obj { background: #dbeafe; color: #1d4ed8; }
.jp-badge-t-arr { background: #e0e7ff; color: #4338ca; }
.jp-badge-big { background: #fef3c7; color: #92400e; }

.jp-index {
  color: #94a3b8;
}

/* ---------- 工具栏 ---------- */
.jp-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.jp-toolbar .btn small {
  font-size: .72rem;
  opacity: .75;
  margin-left: 2px;
}

.jp-toolbar .btn:disabled,
.jp-toolbar .btn:disabled:hover {
  opacity: .45;
  cursor: not-allowed;
}

.jp-example-select {
  height: 38px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: .9rem;
  cursor: pointer;
}

.jp-example-select:focus {
  outline: none;
  border-color: var(--primary);
}

.jp-toolbar-sep {
  width: 1px;
  height: 22px;
  background: #e2e8f0;
  margin: 0 4px;
}

.jp-record-badge {
  margin-left: auto;
  padding: 4px 12px;
  border-radius: 999px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #4338ca;
  font-size: .8rem;
  font-weight: 600;
}

/* ---------- 设置行 ---------- */
.jp-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #f1f5f9;
}

.jp-settings label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .88rem;
  color: #475569;
  cursor: pointer;
  user-select: none;
}

.jp-settings input {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ---------- 右键菜单 ---------- */
.jp-ctx {
  position: fixed;
  z-index: 999;
  min-width: 148px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .16);
  padding: 5px;
}

.jp-ctx-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 6px;
  padding: 7px 12px;
  font-size: .86rem;
  color: #334155;
  cursor: pointer;
}

.jp-ctx-item:hover {
  background: #eef2ff;
  color: var(--primary);
}

/* ---------- 正文区 ---------- */
.jp-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 14px;
}

.jp-feature-icon {
  margin-right: 7px;
}

.jp-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary, #4f46e5);
  color: #fff;
  font-size: 13px;
  margin-right: 6px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 14px;
}

.info-item {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 14px 16px;
}

.info-item h3 {
  font-size: .95rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 6px;
}

.info-item p {
  font-size: .86rem;
  color: var(--gray-500);
  line-height: 1.7;
}

.faq-item {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.faq-item h3 {
  font-size: .95rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 6px;
}

.faq-item p {
  font-size: .86rem;
  color: var(--gray-500);
  line-height: 1.75;
}

.info-section p {
  color: var(--gray-600);
  line-height: 1.8;
  font-size: .92rem;
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .jp-columns {
    grid-template-columns: 1fr;
  }

  .jp-editor {
    height: 320px;
  }

  .jp-tree {
    height: 300px;
  }

  .jp-record-badge {
    margin-left: 0;
  }
}
