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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f9faff;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background-color: #4A90E2;
    color: white;
    padding: 1rem 2rem;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

h1 {
    font-weight: 700;
    font-size: 1.8rem;
}

main {
    flex: 1;
    padding: 1rem 2rem;
}

.container {
    display: flex;
    gap: 1rem;
    height: calc(100vh - 100px);
}

.input-area, .result-area {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.15);
    padding: 1rem;
    flex: 1 1 50%;
    display: flex;
    flex-direction: column;
}

.input-area h2, .result-area h2, .history-sidebar h2 {
    margin-bottom: 0.5rem;
    color: #4A90E2;
    border-bottom: 2px solid #50E3C2;
    padding-bottom: 0.3rem;
}

textarea#json-input {
    flex: 1;
    width: 100%;
    font-family: monospace;
    font-size: 1rem;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    resize: vertical;
    min-height: 300px;
    background-color: #fefefe;
}

.button-group {
    margin-top: 0.8rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.button-group button {
    background-color: #4A90E2;
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s ease;
    flex: 1 1 100px;
}

.button-group button:hover {
    background-color: #357ABD;
}

.result-display {
    flex: 1;
    background-color: #f4f7fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 1rem;
    font-family: monospace;
    font-size: 1rem;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 300px;
}

.error-message {
    margin-top: 0.5rem;
    color: #e74c3c;
    font-weight: 700;
    background-color: #fdecea;
    border: 1px solid #e74c3c;
    border-radius: 6px;
    padding: 0.5rem;
}

.history-sidebar {
    width: 320px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(80, 227, 194, 0.15);
    padding: 1rem;
    overflow-y: auto;
}

.history-sidebar ul {
    list-style: none;
    max-height: 100%;
    overflow-y: auto;
}

.history-sidebar li {
    border-bottom: 1px solid #eee;
    padding: 0.5rem 0;
    font-size: 0.9rem;
}

.history-sidebar details summary {
    cursor: pointer;
    font-weight: 600;
    color: #4A90E2;
    margin-bottom: 0.3rem;
}

.history-sidebar pre {
    background-color: #f4f7fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.5rem;
    font-family: monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 150px;
    overflow-y: auto;
}

@media (max-width: 900px) {
    .container {
        flex-direction: column;
        height: auto;
    }
    .history-sidebar {
        width: 100%;
        max-height: 200px;
        margin-top: 1rem;
    }
}
