/* JSON Comparator — DevStack Hub / Techoral theme */
.json-tool-page {
  padding-top: 74px;
  min-height: 100vh;
  background: var(--light-color, #f8f9fa);
}

.json-tool-hero {
  background: linear-gradient(135deg, var(--primary-dark, #1e40af) 0%, var(--primary-color, #2563eb) 55%, var(--accent-color, #0d9488) 100%);
  color: #fff;
  padding: 2.5rem 0 2rem;
}

.json-tool-hero h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.json-tool-hero .breadcrumb-item a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
}

.json-tool-hero .breadcrumb-item.active,
.json-tool-hero .breadcrumb-item + .breadcrumb-item::before {
  color: rgba(255, 255, 255, 0.65);
}

.json-workspace {
  padding: 1.25rem 0 3rem;
}

.json-toolbar {
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.08);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  position: sticky;
  top: 74px;
  z-index: 100;
}

.json-toolbar .btn {
  border-radius: 50px;
  font-size: 0.8125rem;
  padding: 0.35rem 0.85rem;
}

.json-toolbar .btn-primary {
  background-color: var(--primary-color, #2563eb);
  border-color: var(--primary-color, #2563eb);
}

.json-options-panel {
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.08);
  padding: 1rem;
  margin-bottom: 0.75rem;
}

/* Primary compare action — between options and side-by-side editors */
.json-compare-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.06) 0%, rgba(13, 148, 136, 0.08) 50%, rgba(37, 99, 235, 0.06) 100%);
  border: 1px solid rgba(37, 99, 235, 0.15);
  border-radius: 0.5rem;
  position: sticky;
  top: 130px;
  z-index: 90;
  box-shadow: 0 0.125rem 0.5rem rgba(37, 99, 235, 0.08);
}

.json-compare-btn {
  min-width: 10rem;
  font-weight: 600;
  border-radius: 50px;
  padding: 0.65rem 2rem;
  box-shadow: 0 0.25rem 0.75rem rgba(37, 99, 235, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.json-compare-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0.35rem 1rem rgba(37, 99, 235, 0.45);
}

.json-compare-btn:active {
  transform: translateY(0);
}

@media (min-width: 992px) {
  .json-editors-row {
    position: relative;
  }

  .json-compare-bar {
    top: 118px;
    margin-bottom: 1.25rem;
  }
}

@media (max-width: 575.98px) {
  .json-compare-bar {
    top: 108px;
    flex-direction: column;
    gap: 0.35rem;
  }

  .json-compare-btn {
    width: 100%;
    max-width: 280px;
  }
}

.json-panel-card {
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.08);
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.json-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--light-color, #f8f9fa);
  border-bottom: 1px solid var(--gray-light, #e9ecef);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.json-panel-header h2 {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0;
}

.json-panel-status {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 50px;
}

.json-panel-status.valid {
  background: rgba(25, 135, 84, 0.12);
  color: var(--success-color, #198754);
}

.json-panel-status.invalid {
  background: rgba(220, 53, 69, 0.12);
  color: var(--danger-color, #dc3545);
}

.json-panel-status.empty {
  background: rgba(108, 117, 125, 0.12);
  color: var(--gray-color, #6c757d);
}

.json-diff-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  justify-content: flex-end;
}

.json-diff-legend .legend-removed { color: #c92a2a; }
.json-diff-legend .legend-added { color: #2b8a3e; }
.json-diff-legend .legend-changed { color: #e67700; }

.json-editor-wrap {
  display: flex;
  flex: 1;
  min-height: 280px;
  max-height: 420px;
  overflow: hidden;
}

.json-line-numbers {
  padding: 0.75rem 0.35rem;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--gray-color, #6c757d);
  background: #f1f3f5;
  text-align: right;
  user-select: none;
  overflow: auto;
  min-width: 2.75rem;
  border-right: 1px solid var(--gray-light, #e9ecef);
  scrollbar-width: none;
}

.json-line-numbers::-webkit-scrollbar {
  display: none;
}

.json-line-numbers .gutter-line {
  display: block;
  padding: 0 0.25rem;
  min-height: 1.5em;
}

.json-line-numbers .gutter-equal { color: #868e96; }
.json-line-numbers .gutter-removed { background: #ffe3e3; color: #c92a2a; font-weight: 600; }
.json-line-numbers .gutter-added { background: #d3f9d8; color: #2b8a3e; font-weight: 600; }
.json-line-numbers .gutter-changed { background: #fff3bf; color: #e67700; font-weight: 600; }
.json-line-numbers .gutter-empty { background: #f8f9fa; color: #ced4da; }

.json-editor-stack {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 280px;
  max-height: 420px;
  overflow: hidden;
}

.json-highlight-layer {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0.75rem;
  overflow: auto;
  pointer-events: none;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.8125rem;
  line-height: 1.5;
  tab-size: 2;
  white-space: pre;
  word-wrap: normal;
  border: none;
  background: #fff;
  scrollbar-width: none;
}

.json-highlight-layer::-webkit-scrollbar {
  display: none;
}

.json-highlight-layer .diff-line {
  min-height: 1.5em;
  white-space: pre;
}

.json-highlight-layer .diff-equal { background: transparent; }
.json-highlight-layer .diff-removed { background: #ffe3e3; }
.json-highlight-layer .diff-added { background: #d3f9d8; }
.json-highlight-layer .diff-changed { background: #fff3bf; }
.json-highlight-layer .diff-empty {
  background: #f8f9fa;
  min-height: 1.5em;
}

.json-highlight-layer .char-removed {
  background: #ffc9c9;
  text-decoration: line-through;
  border-radius: 2px;
}

.json-highlight-layer .char-added {
  background: #b2f2bb;
  border-radius: 2px;
}

.json-editor.json-editor-input {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border: none;
  resize: none;
  padding: 0.75rem;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.8125rem;
  line-height: 1.5;
  outline: none;
  overflow: auto;
  min-height: 280px;
  max-height: 420px;
  tab-size: 2;
  white-space: pre;
  word-wrap: normal;
  background: transparent;
  color: #212529;
  caret-color: #212529;
}

.json-editor-wrap.is-diff-mode .json-editor-input {
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.json-editor-wrap.is-diff-mode .json-editor-input::selection {
  background: rgba(37, 99, 235, 0.35);
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.json-panel-footer {
  padding: 0.35rem 0.75rem;
  font-size: 0.7rem;
  color: var(--gray-color, #6c757d);
  border-top: 1px solid var(--gray-light, #e9ecef);
}

.json-results-card {
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.08);
  margin-top: 1rem;
}

.json-results-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-light, #e9ecef);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.json-summary-badge {
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.35rem 1rem;
  border-radius: 50px;
}

.json-summary-badge.equal {
  background: rgba(25, 135, 84, 0.15);
  color: var(--success-color, #198754);
}

.json-summary-badge.diff {
  background: rgba(255, 193, 7, 0.2);
  color: #856404;
}

.json-summary-badge.error {
  background: rgba(220, 53, 69, 0.12);
  color: var(--danger-color, #dc3545);
}

.json-diff-table-wrap {
  max-height: 360px;
  overflow: auto;
}

.json-diff-table {
  font-size: 0.8125rem;
  margin: 0;
}

.json-diff-table th {
  position: sticky;
  top: 0;
  background: var(--light-color, #f8f9fa);
  z-index: 1;
}

.json-diff-type {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 0.2rem;
}

.json-diff-type.added { background: rgba(25, 135, 84, 0.15); color: #198754; }
.json-diff-type.removed { background: rgba(220, 53, 69, 0.12); color: #dc3545; }
.json-diff-type.changed { background: rgba(255, 193, 7, 0.25); color: #856404; }
.json-diff-type.type-changed { background: rgba(13, 148, 136, 0.15); color: #0d9488; }

.json-diff-path {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.75rem;
  word-break: break-all;
}

.json-diff-value {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.75rem;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.json-tree-view {
  padding: 1rem;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.8125rem;
  max-height: 400px;
  overflow: auto;
  line-height: 1.6;
}

.json-tree-line.same { color: var(--gray-color, #6c757d); }
.json-tree-line.added { background: rgba(25, 135, 84, 0.08); color: #198754; }
.json-tree-line.removed { background: rgba(220, 53, 69, 0.08); color: #dc3545; }
.json-tree-line.changed { background: rgba(255, 193, 7, 0.12); }

.json-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  color: var(--gray-color, #6c757d);
  border-top: 1px solid var(--gray-light, #e9ecef);
}

.json-stats-row strong {
  color: var(--dark-color, #212529);
}

@media (max-width: 991.98px) {
  .json-toolbar {
    top: 60px;
  }
  .json-editor-wrap,
  .json-editor-stack,
  .json-editor.json-editor-input {
    max-height: 320px;
    min-height: 220px;
  }
}

@media (max-width: 575.98px) {
  .json-toolbar .btn-group {
    width: 100%;
  }
  .json-toolbar .btn {
    flex: 1 1 auto;
  }
}
