/* HERO / HEADER */

.tool-hero {
  margin-top: 1.75rem;
  margin-bottom: 2rem;
  padding: 2.2rem 2.4rem;
  background: radial-gradient(circle at top left, #0f172a, #020617);
  box-shadow: 0 22px 45px rgba(15, 23, 42, 0.35);
  color: #e5e7eb;
  text-align: center;
}

.tool-hero h1 {
  font-size: 1.65rem;
  margin-bottom: 0.7rem;
  color: #22c55e;
}

.tool-hero p {
  max-width: 720px;
  margin: 0 auto;
  font-size: 0.96rem;
  line-height: 1.7;
  color: #cbd5f5;
}

/* MAIN LAYOUT */
.container-json {
    width: 100%;
    margin: 0 auto;
    padding: 0 40px;
}
.json-advanced-wrapper {
  margin-top: 0.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.6rem;
}

/* PANELS */

.json-panel {
  border: 1px solid #1f2937;
  box-shadow: 0 22px 45px rgba(15, 23, 42, 0.45);
  display: flex;
  flex-direction: column;
  min-height: 600px;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.05rem;
  border-bottom: 1px solid #1f2937;
  background: radial-gradient(circle at top left, #1f2937f2, #1f2937f2);
}

.panel-header h2 {
  margin: 0;
  font-size: 0.9rem;
  color: #e5e7eb;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.panel-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.panel-btn {

  border: 1px solid #364152;
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  font-size: 0.75rem;
  padding: 0.28rem 0.7rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease,
    transform 0.1s ease, box-shadow 0.1s ease;
}

.panel-btn:hover {
  background: #0ea5e9;
  border-color: #0ea5e9;
  box-shadow: 0 8px 16px rgba(56, 189, 248, 0.45);
  transform: translateY(-1px);
}

/* EDITOR + OUTPUT */

.json-editor {
  width: 100%;
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  padding: 0.9rem 1rem 0.7rem;
  background: #020617;
  color: #e5e7eb;
  font-family: "Fira Code", Menlo, Consolas, "Courier New", monospace;
  font-size: 0.87rem;
  line-height: 1.55;
  white-space: pre;
  box-sizing: border-box;
}

.json-editor::placeholder {
  color: #6b7280;
}

.json-editor.json-valid {
  box-shadow: inset 0 0 0 1px #10b981;
}

.json-editor.json-invalid {
  box-shadow: inset 0 0 0 1px #ef4444;
}

.json-error {
  min-height: 1.2rem;
  padding: 0.4rem 1rem 0.8rem;
  font-size: 0.8rem;
  color: #fb923c;
}

/* OUTPUT AREA */

.json-output {
  flex: 1;
  padding: 0.9rem 1rem 1rem;
  background: #020617;
  color: #e5e7eb;
  font-family: "Fira Code", Menlo, Consolas, "Courier New", monospace;
  font-size: 0.87rem;
  line-height: 1.55;
  overflow: auto;
  white-space: pre;
}

/* word wrap toggle */

.json-output.wrap,
.json-editor.wrap {
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* TREE VIEW */

.json-output.tree-mode {
  white-space: normal;
}

.json-tree-node {
  position: relative;
  padding-left: 1.2rem;
  font-size: 0.86rem;
}

.json-tree-node.collapsed > .json-children {
  display: none;
}

.json-toggle {
  position: absolute;
  left: 0;
  top: 0.15rem;
  cursor: pointer;
  font-size: 0.7rem;
  color: #a5b4fc;
  user-select: none;
}

.json-key {
  color: #60a5fa;
}

.json-colon {
  color: #94a3b8;
}

.json-string {
  color: #22c55e;
}

.json-number {
  color: #fbbf24;
}

.json-boolean {
  color: #f97316;
}

.json-null {
  color: #e5e7eb;
  font-style: italic;
}

.json-brace {
  color: #e5e7eb;
}

.json-comma {
  color: #6b7280;
}

.json-type-label {
  color: #64748b;
  font-size: 0.72rem;
  margin-left: 0.25rem;
}

/* SETTINGS CARD */

.json-settings {
  margin-top: 2rem;
  padding: 1.5rem 2rem;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 1.5rem 2rem;
  align-items: flex-start;
}

.settings-group h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.settings-row {
  margin-bottom: 0.3rem;
}

.settings-list {
  display: grid;
  gap: 0.4rem;
}

.settings-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.settings-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.settings-item select {
  padding: 0.25rem 0.6rem;
  border: 1px solid #cbd5f5;
  background: #ffffff;
  font-size: 0.9rem;
}

/* ACTION BUTTONS */

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
  align-items: center;
}

/* Ad section spacing */

.ad-inline {
  margin: 2rem 0 1.5rem;
}

/* RESPONSIVE */

@media (max-width: 992px) {
  .json-advanced-wrapper {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  .tool-hero {
    padding: 1.8rem 1.6rem;
  }

  .json-settings {
    grid-template-columns: minmax(0, 1fr);
    padding: 1.4rem 1.5rem;
  }

  .settings-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .panel-header h2 {
    font-size: 0.82rem;
  }

  .panel-btn {
    font-size: 0.7rem;
    padding: 0.22rem 0.55rem;
  }

  .json-panel {
    min-height: 320px;
  }
}
/* ============================
   EDITOR THEMES
============================ */

/* LIGHT THEME */
.editor-light {
  --editor-bg: #ffffff;
  --editor-text: #1f2937;
  --editor-key: #2563eb;
  --editor-string: #16a34a;
  --editor-number: #b45309;
  --editor-boolean: #dc2626;
  --editor-null: #6b7280;
}

/* DARK THEME (default) */
.editor-dark {
  --editor-bg: #020617;
  --editor-text: #e5e7eb;
  --editor-key: #60a5fa;
  --editor-string: #22c55e;
  --editor-number: #fbbf24;
  --editor-boolean: #f97316;
  --editor-null: #f3f4f6;
}

/* MIDNIGHT BLUE */
.editor-midnight {
  --editor-bg: #0f172a;
  --editor-text: #e2e8f0;
  --editor-key: #38bdf8;
  --editor-string: #34d399;
  --editor-number: #fcd34d;
  --editor-boolean: #fb7185;
  --editor-null: #cbd5e1;
}

/* DRACULA THEME */
.editor-dracula {
  --editor-bg: #282a36;
  --editor-text: #f8f8f2;
  --editor-key: #8be9fd;
  --editor-string: #50fa7b;
  --editor-number: #f1fa8c;
  --editor-boolean: #ff79c6;
  --editor-null: #bd93f9;
}

/* OCEANIC THEME */
.editor-ocean {
  --editor-bg: #1b2b34;
  --editor-text: #d8dee9;
  --editor-key: #5fb3b3;
  --editor-string: #99c794;
  --editor-number: #fac863;
  --editor-boolean: #ec5f67;
  --editor-null: #c594c5;
}

/* Apply Theme Variables */
.json-editor,
.json-output {
  background: var(--editor-bg) !important;
  color: var(--editor-text) !important;
}

.json-key { color: var(--editor-key); }
.json-string { color: var(--editor-string); }
.json-number { color: var(--editor-number); }
.json-boolean { color: var(--editor-boolean); }
.json-null { color: var(--editor-null); }
