/* ════════ JSON FORMATTER, VALIDATOR & DEV SUITE STYLES ════════ */

:root {
  --tool-indigo: #6366f1;
  --tool-indigo-hover: #4f46e5;
  --tool-indigo-soft: rgba(99, 102, 241, 0.08);
  --tool-indigo-glow: rgba(99, 102, 241, 0.2);
  --warning-amber: #f59e0b;
  --warning-amber-glow: rgba(245, 158, 11, 0.2);
  --danger-red: #ef4444;
  --danger-red-glow: rgba(239, 68, 68, 0.2);
  --success-green: #10b981;
  --success-green-glow: rgba(16, 185, 129, 0.2);
}

body.light {
  --tool-indigo: #4f46e5;
  --tool-indigo-hover: #3730a3;
  --tool-indigo-soft: rgba(79, 70, 229, 0.08);
  --tool-indigo-glow: rgba(79, 70, 229, 0.2);
  --warning-amber: #d97706;
  --warning-amber-glow: rgba(217, 119, 6, 0.25);
  --danger-red: #dc2626;
  --danger-red-glow: rgba(220, 38, 38, 0.25);
  --success-green: #059669;
  --success-green-glow: rgba(5, 150, 105, 0.2);
}

/* ─── CONTAINER UI STANDARD WIDTH ─── */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 100px;
  position: relative;
  z-index: 1;
  box-sizing: border-box;
}

/* ─── LAYOUT GRID RATIO OVERRIDE ─── */
.tool-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1024px) {
  .tool-layout {
    grid-template-columns: 1fr !important;
    gap: 20px;
  }
}

/* ─── MOBILE RESPONSIVENESS OVERRIDES ─── */
@media (max-width: 768px) {
  .container {
    padding: 0 14px 60px;
  }

  .view-tabs {
    flex-wrap: wrap;
    gap: 4px;
  }

  .view-tab-btn {
    flex: 1 1 45%;
    font-size: 11px;
    padding: 8px 4px;
  }

  .textarea-toolbar {
    padding: 8px 10px;
    gap: 6px;
  }

  .toolbar-group {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .toolbar-group::-webkit-scrollbar {
    display: none;
  }

  .toolbar-btn {
    padding: 6px 10px;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .metrics-summary-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
  }

  .counter-card {
    padding: 10px 4px;
  }

  .counter-value {
    font-size: 18px !important;
  }

  #pane-diff > div {
    grid-template-columns: 1fr !important;
  }
}

/* ─── UNIFIED EDITOR CARD WRAPPER ─── */
.editor-box-wrapper {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.editor-box-wrapper:focus-within {
  border-color: var(--tool-indigo-glow);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), 0 0 0 3px var(--tool-indigo-soft);
}

body.light .editor-box-wrapper {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

body.light .editor-box-wrapper:focus-within {
  border-color: var(--tool-indigo);
  box-shadow: 0 6px 24px rgba(79, 70, 229, 0.08), 0 0 0 3px rgba(79, 70, 229, 0.12);
}

/* ─── TOOLBAR BUTTONS ─── */
.textarea-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-wrap: wrap;
  gap: 8px;
}

body.light .textarea-toolbar {
  background: #f8fafc;
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

.secondary-toolbar {
  background: rgba(255, 255, 255, 0.015) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: none !important;
}

body.light .secondary-toolbar {
  background: #f8fafc !important;
  border-top-color: rgba(15, 23, 42, 0.08);
  border-bottom: none !important;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.toolbar-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  font-family: 'Figtree', sans-serif;
}

.toolbar-btn:hover {
  background: var(--tool-indigo-soft);
  border-color: var(--tool-indigo-glow);
  color: var(--tool-indigo);
  transform: translateY(-1px);
}

body.light .toolbar-btn {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
  color: #334155;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

body.light .toolbar-btn:hover {
  background: var(--tool-indigo-soft);
  border-color: var(--tool-indigo);
  color: var(--tool-indigo);
}

.toolbar-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: transparent !important;
  color: var(--text-3) !important;
  border-color: transparent !important;
  transform: none !important;
}

/* ─── ERROR BANNER ─── */
.error-banner {
  display: none;
  background: rgba(239, 68, 68, 0.1);
  border-bottom: 1px solid rgba(239, 68, 68, 0.25);
  padding: 10px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #f87171;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.error-banner.visible {
  display: flex;
}

body.light .error-banner {
  background: rgba(220, 38, 38, 0.08);
  border-bottom-color: rgba(220, 38, 38, 0.2);
  color: #dc2626;
}

.error-pointer-badge {
  background: rgba(239, 68, 68, 0.2);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ─── CODE EDITOR INPUT ─── */
#json-input, #code-output {
  width: 100%;
  min-height: 320px;
  max-height: 520px;
  padding: 16px 20px;
  background: transparent;
  border: none;
  outline: none;
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
  resize: vertical;
  box-sizing: border-box;
  tab-size: 2;
  white-space: pre;
  overflow-x: auto;
}

body.light #json-input, body.light #code-output {
  color: #0f172a;
}

#json-input::placeholder {
  color: var(--text-3);
}

body.light #json-input::placeholder {
  color: #94a3b8;
}

/* ─── STATUS BAR ─── */
.text-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  font-family: 'Figtree', sans-serif;
  font-weight: 600;
}

body.light .text-status-bar {
  background: #f8fafc;
  border-top-color: rgba(15, 23, 42, 0.08);
}

.status-badge-item {
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

body.light .status-badge-item {
  color: #64748b;
}

.status-badge-item.valid-badge {
  color: var(--success-green);
  background: var(--success-green-glow);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--success-green-glow);
}

.status-badge-item.invalid-badge {
  color: var(--danger-red);
  background: var(--danger-red-glow);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--danger-red-glow);
}

/* ─── SEGMENTED VIEW TABS WITH SLIDING INDICATOR ─── */
.view-tabs {
  position: relative;
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 16px;
}

body.light .view-tabs {
  background: #f1f5f9;
  border-color: rgba(15, 23, 42, 0.08);
}

.tab-indicator {
  position: absolute;
  top: 4px;
  height: calc(100% - 8px);
  left: 0;
  width: 0;
  background: var(--tool-indigo);
  border-radius: 8px;
  box-shadow: 0 4px 14px var(--tool-indigo-glow);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  z-index: 1;
}

.view-tab-btn {
  position: relative;
  z-index: 2;
  flex: 1;
  padding: 9px 12px;
  background: transparent !important;
  border: none;
  border-radius: 8px;
  color: var(--text-2);
  font-family: 'Outfit', sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.25s ease;
  text-align: center;
  box-shadow: none !important;
}

body.light .view-tab-btn {
  color: #64748b;
}

.view-tab-btn.active {
  color: #ffffff !important;
}

/* ─── JSON DIFF COMPARATOR ─── */
.diff-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

@media (max-width: 640px) {
  .diff-grid {
    grid-template-columns: 1fr;
  }
}

.diff-label {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: 1px;
  display: block;
  margin-bottom: 6px;
  text-transform: uppercase;
}

body.light .diff-label {
  color: #64748b;
}

.diff-textarea {
  min-height: 160px;
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  line-height: 1.5;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--text);
  outline: none;
  resize: vertical;
  transition: all 0.2s ease;
}

.diff-textarea:focus {
  border-color: var(--tool-indigo);
  box-shadow: 0 0 0 3px var(--tool-indigo-soft);
}

body.light .diff-textarea {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

body.light .diff-textarea::placeholder {
  color: #94a3b8;
}

body.light .diff-textarea:focus {
  border-color: var(--tool-indigo);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.diff-submit-btn {
  width: 100%;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--tool-indigo) 0%, var(--tool-indigo-hover) 100%);
  color: #ffffff !important;
  border: none;
  border-radius: 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--tool-indigo-glow);
  transition: all 0.2s ease;
  margin-bottom: 14px;
}

.diff-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--tool-indigo-glow);
}

.diff-result-box {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  line-height: 1.6;
}

body.light .diff-result-box {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}

.diff-line-added {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 8px 12px;
  border-radius: 8px;
  color: #34d399;
}

body.light .diff-line-added {
  background: rgba(5, 150, 105, 0.1);
  border-color: rgba(5, 150, 105, 0.25);
  color: #047857;
}

.diff-line-removed {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 8px 12px;
  border-radius: 8px;
  color: #f87171;
}

body.light .diff-line-removed {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.25);
  color: #b91c1c;
}

.diff-line-modified {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 8px 12px;
  border-radius: 8px;
  color: #fbbf24;
}

body.light .diff-line-modified {
  background: rgba(217, 119, 6, 0.1);
  border-color: rgba(217, 119, 6, 0.25);
  color: #b45309;
}

/* ─── TREE VIEW INSPECTOR ─── */
#tree-view-container {
  min-height: 280px;
  max-height: 500px;
  overflow: auto;
  padding: 16px 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

body.light #tree-view-container {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.08);
}

.tree-node {
  margin-left: 18px;
}

.tree-root {
  margin-left: 0;
}

.tree-toggle {
  cursor: pointer;
  user-select: none;
  display: inline-block;
  width: 14px;
  text-align: center;
  color: var(--text-3);
  font-size: 10px;
  transition: transform 0.2s ease;
}

.tree-toggle.collapsed {
  transform: rotate(-90deg);
}

.tree-key {
  color: #38bdf8;
  font-weight: 600;
}

body.light .tree-key {
  color: #0284c7;
}

.tree-string {
  color: #4ade80;
}

body.light .tree-string {
  color: #15803d;
}

.tree-number {
  color: #f6e05e;
}

body.light .tree-number {
  color: #b45309;
}

.tree-boolean {
  color: #fb923c;
  font-weight: 700;
}

body.light .tree-boolean {
  color: #c2410c;
}

.tree-null {
  color: #94a3b8;
  font-style: italic;
}

.tree-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--tool-indigo-soft);
  color: var(--tool-indigo);
  border: 1px solid var(--tool-indigo-glow);
  margin-left: 6px;
}

/* ─── CODE TYPE GENERATOR TABS ─── */
.type-gen-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 12px;
  scrollbar-width: none;
}

.type-gen-tabs::-webkit-scrollbar {
  display: none;
}

.type-tab-btn {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.type-tab-btn.active {
  background: var(--tool-indigo-soft);
  border-color: var(--tool-indigo);
  color: var(--tool-indigo);
}

body.light .type-tab-btn {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.1);
  color: #334155;
}

body.light .type-tab-btn.active {
  background: var(--tool-indigo-soft);
  border-color: var(--tool-indigo);
  color: var(--tool-indigo);
}

/* ─── METRIC CARD GRID ─── */
.metrics-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}

@media (max-width: 480px) {
  .metrics-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.counter-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 8px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  box-sizing: border-box;
  text-align: center;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.counter-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
}

.counter-title {
  font-family: 'Outfit', sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 4px;
}

.counter-value {
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: 800;
  background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

body.light .counter-card {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.02);
}

body.light .counter-card:hover {
  background: #ffffff;
  border-color: rgba(79, 70, 229, 0.3);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.08);
}

body.light .counter-title {
  color: #64748b;
}

body.light .counter-value {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ─── FILE LOAD & DROP ZONE ─── */
.file-drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.015);
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.drop-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--tool-indigo-soft);
  border: 1px solid var(--tool-indigo-glow);
  color: var(--tool-indigo);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.file-drop-zone:hover .drop-icon-box {
  transform: scale(1.08);
}

.file-drop-zone:hover, .file-drop-zone.dragover {
  border-color: var(--tool-indigo);
  background: rgba(99, 102, 241, 0.04);
}

body.light .file-drop-zone {
  border-color: rgba(15, 23, 42, 0.12);
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

body.light .file-drop-zone:hover, body.light .file-drop-zone.dragover {
  border-color: var(--tool-indigo);
  background: rgba(79, 70, 229, 0.04);
}

/* ─── GRID LAYOUT SPACING OVERRIDES ─── */
.toolbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  width: 100%;
}

.toolbox-btn {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
  font-family: 'Figtree', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.toolbox-btn:hover {
  border-color: var(--tool-indigo-glow);
  background: var(--tool-indigo-soft);
  color: var(--tool-indigo);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.12);
}

body.light .toolbox-btn {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  color: #334155;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

body.light .toolbox-btn:hover {
  background: var(--tool-indigo-soft);
  border-color: var(--tool-indigo);
  color: var(--tool-indigo);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

/* Sidebar selectors overrides */
.switch-row,
.switch-row span,
.fg label,
.lbl-text,
#volume-label,
select,
option {
  font-family: 'Figtree', sans-serif !important;
}

/* ─── TOGGLE SWITCH & CHECKBOX SIZE OVERRIDES ─── */
input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--tool-indigo);
  cursor: pointer;
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: .3s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 34px;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: .3s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.switch input:checked + .switch-slider {
  background-color: var(--tool-indigo);
  border-color: var(--tool-indigo);
}

.switch input:checked + .switch-slider:before {
  transform: translateX(22px);
}

body.light .switch-slider {
  background-color: rgba(15, 23, 42, 0.12);
  border-color: rgba(15, 23, 42, 0.15);
}

body.light .switch input:checked + .switch-slider {
  background-color: var(--tool-indigo);
  border-color: var(--tool-indigo);
}
