:root {
    --primary-color: #5e35b1;
    --primary-light: #7e57c2;
    --secondary-color: #2979ff;
    --accent-color: #00bcd4;
    --background-color: #f5f7fa;
    --card-bg-color: #ffffff;
    --text-color: #333;
    --text-light: #666;
    --border-color: rgba(0, 0, 0, 0.08);
    --hover-color: #f0f4ff;
    --string-color: #2e7d32;
    --number-color: #1565c0;
    --boolean-color: #d81b60;
    --null-color: #757575;
    --key-color: #6d1b7b;
    --error-color: #d32f2f;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    background-image: linear-gradient(135deg, #f5f7fa 0%, #e8edf5 100%);
    min-height: 100vh;
}

.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: var(--primary-color);
    font-size: 2.8rem;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    letter-spacing: -0.5px;
    margin-bottom: 5px;
    position: relative;
    display: inline-block;
}

header h1::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

.main-content {
    display: flex;
    flex: 1;
    gap: 20px;
}

.input-section, .output-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background-color: var(--card-bg-color);
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.input-section:hover, .output-section:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px;
    background: linear-gradient(to right, #f9fafd, #f0f4f8);
    border-bottom: 1px solid var(--border-color);
}

.btn {
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 5px rgba(94, 53, 177, 0.2);
    letter-spacing: 0.5px;
}

.btn:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    box-shadow: 0 4px 8px rgba(94, 53, 177, 0.3);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 3px rgba(94, 53, 177, 0.2);
}

.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.file-input-wrapper:hover {
    transform: translateY(-1px);
}

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

.file-input-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.file-input-wrapper:hover::after {
    opacity: 1;
}

#json-input {
    flex: 1;
    padding: 20px;
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 15px;
    line-height: 1.5;
    border: none;
    resize: none;
    outline: none;
    color: var(--text-color);
    background-color: var(--card-bg-color);
    transition: background-color var(--transition-fast);
}

#json-input:focus {
    background-color: #fafbff;
}

.view-options {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 15px;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 6px 12px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.view-options label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-light);
    transition: color var(--transition-fast);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.view-options label:hover {
    color: var(--primary-color);
    background-color: var(--hover-color);
}

.view-options input[type="radio"] {
    accent-color: var(--primary-color);
    transform: scale(1.2);
}

#json-output, #json-code-view {
    flex: 1;
    padding: 20px;
    overflow: auto;
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 15px;
    line-height: 1.6;
    background-color: var(--card-bg-color);
    scrollbar-width: thin;
    scrollbar-color: var(--primary-light) transparent;
}

#json-output::-webkit-scrollbar, #json-code-view::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#json-output::-webkit-scrollbar-track, #json-code-view::-webkit-scrollbar-track {
    background: transparent;
}

#json-output::-webkit-scrollbar-thumb, #json-code-view::-webkit-scrollbar-thumb {
    background-color: rgba(126, 87, 194, 0.3);
    border-radius: 20px;
}

#json-output::-webkit-scrollbar-thumb:hover, #json-code-view::-webkit-scrollbar-thumb:hover {
    background-color: rgba(126, 87, 194, 0.5);
}

.json-tree-view {
    user-select: text;
}

.json-code-view {
    white-space: pre-wrap;
}

.hidden {
    display: none;
}

/* JSON Tree Styling */
.json-key {
    color: var(--key-color);
    font-weight: bold;
    position: relative;
}

.json-string {
    color: var(--string-color);
    font-style: italic;
}

.json-number {
    color: var(--number-color);
    font-weight: 500;
}

.json-boolean {
    color: var(--boolean-color);
    font-weight: 500;
}

.json-null {
    color: var(--null-color);
    font-style: italic;
    opacity: 0.8;
}

.json-bracket {
    cursor: pointer;
    color: var(--text-color);
    transition: color var(--transition-fast);
}

.json-bracket:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.json-item {
    margin-left: 24px;
    position: relative;
    padding-top: 2px;
    padding-bottom: 2px;
    transition: background-color var(--transition-fast);
    border-radius: var(--radius-sm);
}

.json-item:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.json-toggle {
    cursor: pointer;
    position: absolute;
    left: -18px;
    top: 1px;
    width: 14px;
    height: 14px;
    text-align: center;
    line-height: 14px;
    font-size: 12px;
    transition: all var(--transition-fast);
    border-radius: 50%;
    background-color: transparent;
}

.json-toggle:hover {
    background-color: rgba(94, 53, 177, 0.1);
}

.json-toggle:before {
    content: "▼";
    color: var(--primary-color);
    transition: transform var(--transition-fast);
    display: inline-block;
}

.json-toggle.collapsed:before {
    content: "►";
    transform: scale(0.9);
}

.json-collapsed {
    display: none;
}

footer {
    text-align: center;
    margin-top: 30px;
    padding: 15px;
    color: var(--text-light);
    font-size: 14px;
    position: relative;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--primary-light), transparent);
    border-radius: 100%;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-fast);
    padding: 3px 6px;
    border-radius: var(--radius-sm);
}

footer a:hover {
    color: var(--secondary-color);
    background-color: rgba(94, 53, 177, 0.1);
    text-decoration: none;
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    box-shadow: var(--shadow-md);
    font-weight: 500;
    min-width: 250px;
    text-align: center;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Responsive Design */
@media (max-width: 900px) {
    .main-content {
        flex-direction: column;
    }
    
    .input-section, .output-section {
        min-height: 300px;
    }
    
    header h1 {
        font-size: 2.2rem;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .view-options {
        padding: 4px 8px;
    }
}

/* Error Styling */
.error-message {
    color: var(--error-color);
    padding: 16px 20px;
    border-left: 4px solid var(--error-color);
    border-radius: var(--radius-md);
    background-color: rgba(211, 47, 47, 0.08);
    margin: 15px 0;
    box-shadow: var(--shadow-sm);
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
    font-weight: 500;
}

@keyframes shake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
}

/* Line Numbers */
.line-numbers {
    counter-reset: line;
    padding-right: 10px;
    border-right: 1px solid var(--border-color);
    text-align: right;
    color: #999;
    user-select: none;
}

.line-numbers span {
    counter-increment: line;
}

.line-numbers span::before {
    content: counter(line);
    display: block;
}

/* Path Display */
.json-path-display {
    padding: 5px 10px;
    background-color: #f5f5f5;
    border-top: 1px solid var(--border-color);
    font-family: monospace;
    font-size: 12px;
    color: var(--secondary-color);
}
