body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background-color: #f4f7f6;
    color: #333;
}

.container {
    max-width: 900px; /* Wider for better JSON display */
    margin: 20px auto;
    padding: 25px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 10px;
}

h1 i {
    margin-right: 10px;
    color: #e67e22; /* JSON color */
}

p {
    text-align: center;
    color: #555;
    margin-bottom: 25px;
}

.io-area {
    margin-bottom: 20px;
    position: relative; /* For copy button positioning */
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #34495e;
}

textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    font-size: 1rem;
    font-family: monospace; /* Use monospace for code input */
    resize: vertical;
    min-height: 150px; /* Ensure decent height */
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
    justify-content: center;
}

button {
    padding: 10px 18px;
    border: none;
    border-radius: 5px;
    background-color: #3498db;
    color: white;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background-color 0.3s ease;
    display: inline-flex; /* Align icon and text */
    align-items: center;
    gap: 8px; /* Space between icon and text */
}

button:hover {
    background-color: #2980b9;
}

button#btn-format {
    background-color: #2ecc71; /* Green for format */
}
button#btn-format:hover {
    background-color: #27ae60;
}

button#btn-minify {
    background-color: #f39c12; /* Orange for minify */
}
button#btn-minify:hover {
    background-color: #e67e22;
}


button#btn-clear {
    background-color: #e74c3c; /* Red for clear */
}
button#btn-clear:hover {
    background-color: #c0392b;
}

.output-container {
    position: relative; /* Needed for copy button */
}

.output-box {
    background-color: #ecf0f1;
    padding: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    min-height: 150px; /* Match textarea height */
    overflow-x: auto; /* Allow horizontal scrolling for long lines */
    white-space: pre; /* Preserve whitespace and line breaks */
    font-family: monospace; /* Use monospace for code output */
    font-size: 0.95rem;
    color: #2c3e50;
    margin-top: 0; /* Remove default margin */
}

.error-box {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 10px 15px;
    border-radius: 5px;
    margin-top: 10px; /* Space above error message */
    display: none; /* Hidden by default */
    font-family: monospace;
    white-space: pre-wrap; /* Wrap long error messages */
}

button#btn-copy {
    position: absolute;
    top: 5px; /* Position near the top right of the output area */
    right: 5px;
    padding: 5px 10px;
    background-color: #95a5a6;
    font-size: 0.8rem;
    z-index: 10; /* Ensure it's above the pre content */
}

button#btn-copy:hover {
    background-color: #7f8c8d;
}

.back-link {
    text-align: center;
    margin-top: 30px;
}

.back-link a {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
}

.back-link a:hover {
    text-decoration: underline;
}