* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: 'Poppins', sans-serif;
  display: flex;
  flex-direction: column;
  background-color: #f7f7f7;
}

header {
  background-color: #0077b6;
  padding: 2rem 2rem 1rem;
  color: white;
  text-align: center;
  position: relative;
}

.json-formatter-container {
  flex: 1;
  display: flex;
  padding: 2rem;
  gap: 2rem;
  max-width: 1200px;
  margin: auto;
  width: 100%;
}

.editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.editor label {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.editor textarea,
.editor pre {
  flex: 1;
  resize: none;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-family: monospace;
  font-size: 14px;
  font-weight: 500;
  padding: 1rem;
  background: white;
  color: #333;
  overflow: auto;
}

textarea[readonly] {
  background: #f8f8f8;
}

.stats {
  font-size: 12px;
  color: #666;
  margin-top: 0.5rem;
  text-align: right;
}

.format-button-container {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 2rem auto;
  padding: 0 1rem;
  max-width: 800px;
}

button {
  padding: 0.6rem 1.2rem;
  background-color: #0077b6;
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s;
  font-size: 16px;
}

button:hover {
  background-color: #005f87;
}

footer {
  text-align: center;
  padding: 1rem;
  background: #f1f1f1;
  font-size: 14px;
  margin-top: auto;
}

@media (max-width: 768px) {
  .json-formatter-container {
    flex-direction: column;
  }

  .format-button-container {
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
  }

  .dark-toggle {
    font-size: 1.25rem;
  }
}

/* JSON highlight */
.json-output {
  border: 1px solid #ccc;
  border-radius: 8px;
  background: #f8f8f8;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 1rem;
  font-size: 14px;
  font-family: monospace;
  font-weight: 500;
  color: #333;
}

.json-key {
  color: #0077b6;
}
.json-string {
  color: #d00000;
}
.json-number {
  color: #3a86ff;
}
.json-boolean {
  color: #ff9f1c;
}
.json-null {
  color: #6c757d;
}