<!DOCTYPE html>
<html>
<head>
    <title>JSON Parser</title>
    <style>
        .header-container {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 10px;
            margin-bottom: 10px;
        }

        .button-group {
            display: flex;
            gap: 5px;
        }

        .toggle-button {
            padding: 4px 8px;
            background-color: #f0f0f0;
            border: 1px solid #ddd;
            border-radius: 4px;
            cursor: pointer;
            font-size: 12px;
        }

        .toggle-button:hover {
            background-color: #e0e0e0;
        }

        body {
            font-family: Arial, sans-serif;
            margin: 20px;
            display: flex;
            gap: 0;
            height: calc(100vh - 40px);
        }

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

        .resizer {
            width: 20px;
            background-color: #f0f0f0;
            cursor: col-resize;
            display: flex;
            justify-content: center;
            align-items: center;
            transition: background-color 0.2s;
        }

        .resizer:hover {
            background-color: #ddd;
        }

        .resizer::after {
            content: "⋮";
            color: #666;
            font-size: 20px;
        }

        h3 {
            margin: 0;
        }

        textarea {
            width: 100%;
            flex: 1;
            padding: 10px;
            font-family: monospace;
            resize: none;
            box-sizing: border-box;
        }

        .error {
            color: red;
            margin-top: 10px;
        }

        .tree-view {
            width: 100%;
            flex: 1;
            padding: 10px;
            background-color: #f5f5f5;
            border: 1px solid #ddd;
            overflow: auto;
            box-sizing: border-box;
            font-family: monospace;
        }

        .tree-item {
            padding-left: 20px;
        }

        .tree-key {
            color: #881391;
            font-weight: bold;
        }

        .tree-value {
            color: #1a1aa6;
        }

        .tree-value.string {
            color: #c41a16;
        }

        .tree-toggle {
            cursor: pointer;
            user-select: none;
        }

        .tree-toggle::before {
            content: '▼';
            display: inline-block;
            margin-right: 5px;
            transition: transform 0.2s;
        }

        .tree-toggle.collapsed::before {
            transform: rotate(-90deg);
        }

        .tree-content.collapsed {
            display: none;
        }

        .item-count {
            color: #666;
            font-size: 0.9em;
            margin-left: 5px;
        }
    </style>
</head>
<body>
    <div class="container" id="left-container" style="width: 50%;">
        <div class="header-container">
            <h3>Input JSON</h3>
        </div>
        <textarea id="input" placeholder="Enter JSON..."></textarea>
    </div>
    <div class="resizer" id="resizer"></div>
    <div class="container" id="right-container" style="flex: 1;">
        <div class="header-container">
            <h3>Output</h3>
            <div class="button-group">
                <button class="toggle-button" id="expand-all">Expand All</button>
                <button class="toggle-button" id="collapse-all">Collapse all</button>
            </div>
        </div>
        <div id="output" class="tree-view"></div>
    </div>

    <script src="jsonparser.js?__=0"></script>
</body>
</html>