:root {
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --text-color: #333333;
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --success-color: #06d6a0;
    --error-color: #ef476f;
    --border-color: #e0e0e0;
    --key-color: #0066cc;
    --string-color: #d14;
    --number-color: #008000;
    --boolean-color: #ff0080;
    --null-color: #777;
    --toggle-bg: #f0f0f0;
}

.dark-theme {
    --bg-color: #121826;
    --card-bg: #1e293b;
    --text-color: #f0f0f0;
    --primary-color: #60a5fa;
    --secondary-color: #3b82f6;
    --border-color: #2d3748;
    --toggle-bg: #2d3748;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s, color 0.3s;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

h1 {
    font-size: 28px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 700;
}

.theme-toggle {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.theme-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--toggle-bg);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(30px);
}

.tool-description {
    margin-bottom: 25px;
    padding: 15px;
    background-color: rgba(67, 97, 238, 0.08);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.tool-description p {
    margin-bottom: 8px;
}

.input-section {
    margin-bottom: 25px;
}

.input-container {
    position: relative;
    margin-bottom: 15px;
}

textarea {
    width: 100%;
    height: 200px;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    background: var(--card-bg);
    color: var(--text-color);
    resize: vertical;
    transition: border-color 0.3s;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
}

.textarea-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.char-count {
    font-size: 0.85em;
    color: #777;
}

.controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

button {
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

button:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

button.secondary {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

button.secondary:hover {
    background-color: rgba(67, 97, 238, 0.1);
}

button.danger {
    background-color: var(--error-color);
}

button.danger:hover {
    background-color: #d81159;
}

button.success {
    background-color: var(--success-color);
}

button.success:hover {
    background-color: #05b790;
}

.file-upload {
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.file-upload input[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.output-section {
    margin-top: 30px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.section-title {
    font-size: 20px;
    font-weight: 600;
}

.tree {
    background-color: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    padding: 20px;
    max-height: 500px;
    overflow: auto;
    border: 1px solid var(--border-color);
}

.tree ul {
    list-style-type: none;
    padding-left: 20px;
}

.tree li {
    margin: 8px 0;
    position: relative;
    padding-left: 20px;
}

.tree li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 12px;
    width: 12px;
    height: 1px;
    background-color: var(--border-color);
}

.tree li::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 1px;
    background-color: var(--border-color);
}

.tree li:last-child::after {
    height: 12px;
}

.key {
    color: var(--key-color);
    font-weight: bold;
}

.string {
    color: var(--string-color);
}

.number {
    color: var(--number-color);
}

.boolean {
    color: var(--boolean-color);
}

.null {
    color: var(--null-color);
}

.url-decode {
    color: var(--number-color);
    cursor: pointer;
    margin-left: 10px;
    font-size: 0.9em;
}

.toggle {
    cursor: pointer;
    margin-right: 5px;
    font-size: 0.8em;
    color: var(--primary-color);
    font-weight: bold;
    display: inline-block;
    width: 20px;
    text-align: center;
}

.collapsed > ul {
    display: none;
}

.status-bar {
    margin-top: 15px;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.9em;
    display: none;
}

.status-bar.success {
    background-color: rgba(6, 214, 160, 0.15);
    color: var(--success-color);
    display: block;
}

.status-bar.error {
    background-color: rgba(239, 71, 111, 0.15);
    color: var(--error-color);
    display: block;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #777;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: #555;
}

footer {
    margin-top: 40px;
    text-align: center;
    font-size: 0.9em;
    color: #777;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .controls {
        flex-direction: column;
    }
    
    button {
        width: 100%;
    }
    
    header {
        flex-direction: column;
        align-items: flex-start;
    }
}