/* JSON Formatter Styles */

/* Full-width layout */
.formatter-container {
  padding: 1rem 1.5rem;
  max-width: 100%;
}

.formatter-layout {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  height: calc(100vh - 140px);
  min-height: 400px;
}

/* Panels (input & output) */
.formatter-panel {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  overflow: hidden;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
}

.panel-header h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-color);
  margin: 0;
}

.panel-actions {
  display: flex;
  gap: 0.375rem;
}

.btn-small {
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.25rem;
  background: white;
  color: var(--text-color);
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-small:hover {
  background: #f1f5f9;
}

.btn-small.btn-copy {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.btn-small.btn-copy:hover {
  background-color: var(--primary-hover);
}

/* Input textarea */
.panel-textarea {
  flex: 1;
  width: 100%;
  padding: 1rem;
  border: none;
  font-size: 0.875rem;
  font-family: 'Courier New', monospace;
  resize: none;
  line-height: 1.6;
  outline: none;
}

/* Output area */
.panel-output {
  flex: 1;
  padding: 1rem;
  overflow: auto;
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
  line-height: 1.6;
}

.placeholder-text {
  color: var(--text-light);
  text-align: center;
  padding: 3rem 1rem;
  font-family: -apple-system, sans-serif;
}

/* Center action buttons */
.formatter-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem;
}

.formatter-actions .btn {
  width: 70px;
  text-align: center;
  font-size: 0.8125rem;
  padding: 0.5rem 0;
}

/* Error message */
.error-message {
  color: var(--error-color);
  font-weight: 500;
  padding: 1rem;
  background-color: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 0.375rem;
  font-family: -apple-system, sans-serif;
}

/* Tree View */
.json-tree {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.json-tree ul {
  list-style: none;
  padding-left: 1.25rem;
  margin: 0;
  border-left: 1px solid #e2e8f0;
}

.json-tree li {
  position: relative;
}

.json-line {
  display: flex;
  align-items: flex-start;
  padding: 1px 0;
}

.json-line:hover {
  background-color: #f8fafc;
}

.toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  margin-right: 0.25rem;
  border: none;
  background: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 0.75rem;
  flex-shrink: 0;
  padding: 0;
  margin-top: 2px;
}

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

.toggle-placeholder {
  display: inline-block;
  width: 1rem;
  margin-right: 0.25rem;
  flex-shrink: 0;
}

.json-key {
  color: #881391;
  margin-right: 0.25rem;
}

.json-string {
  color: #0b7285;
}

.json-number {
  color: #c2255c;
}

.json-boolean {
  color: #e67700;
}

.json-null {
  color: #868e96;
}

.json-bracket {
  color: var(--text-color);
}

.json-comma {
  color: var(--text-color);
}

.json-collapsed-info {
  color: var(--text-light);
  font-style: italic;
  font-size: 0.8125rem;
}

.json-children.collapsed {
  display: none;
}

/* Responsive */
@media (max-width: 768px) {
  .formatter-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .formatter-actions {
    flex-direction: row;
    padding: 0.75rem 0;
  }

  .panel-textarea {
    min-height: 200px;
  }

  .panel-output {
    min-height: 200px;
  }
}
