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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.dual-pane-container {
    display: flex;
    gap: 20px;
    padding: 20px;
    min-height: 600px;
}

.pane {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
    position: relative;
}

.pane-header {
    background: #f3f4f6;
    padding: 15px 20px;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 10px 10px 0 0;
    font-weight: 600;
    color: #374151;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pane-title {
    font-size: 1.1em;
}

.pane-status {
    font-size: 0.9em;
    color: #6b7280;
}

.header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 300;
}

.header p {
    opacity: 0.9;
    font-size: 1.1em;
}

.header-controls {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.mode-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.mode-toggle.active {
    background: rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.6);
}

.upload-section {
    padding: 40px;
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
}

.file-drop-zone {
    border: 3px dashed #d1d5db;
    border-radius: 12px;
    padding: 60px 40px;
    background: #f9fafb;
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-drop-zone.dragover {
    border-color: #4f46e5;
    background: #eef2ff;
}

.file-drop-zone:hover {
    border-color: #6366f1;
    background: #f0f9ff;
}

.upload-icon {
    font-size: 4em;
    color: #9ca3af;
    margin-bottom: 20px;
}

.upload-text {
    font-size: 1.3em;
    color: #374151;
    margin-bottom: 10px;
}

.upload-subtext {
    color: #6b7280;
    font-size: 1em;
}

#fileInput {
    display: none;
}

.btn {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    margin-top: 20px;
    transition: transform 0.2s ease;
}

.btn:hover {
    transform: translateY(-2px);
}

.loading {
    display: none;
    padding: 20px;
    text-align: center;
    color: #6b7280;
}

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4f46e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    background: #fee2e2;
    color: #dc2626;
    padding: 15px;
    border-radius: 8px;
    margin: 20px;
    display: none;
}

.json-viewer {
    padding: 20px;
    display: none;
    height: 100%;
}

.pane .json-viewer {
    display: block;
    padding: 0;
    height: calc(100% - 60px);
}

.pane .upload-section {
    padding: 40px 20px;
    border-bottom: none;
    height: calc(100% - 60px);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.pane .file-drop-zone {
    padding: 40px 20px;
}

.json-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
}

.json-title {
    font-size: 1.8em;
    color: #1f2937;
    font-weight: 600;
}

.json-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.control-btn {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

.path-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.path-filter label {
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}

.path-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    background: white;
}

.path-input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.path-examples {
    font-size: 12px;
    color: #6b7280;
    margin-top: 5px;
}

.path-error {
    background: #fee2e2;
    color: #dc2626;
    padding: 10px;
    border-radius: 6px;
    margin-top: 10px;
    font-size: 14px;
    display: none;
}

.path-info {
    background: #eff6ff;
    color: #1e40af;
    padding: 10px;
    border-radius: 6px;
    margin-top: 10px;
    font-size: 14px;
    display: none;
}

.json-content {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 0;
    overflow: auto;
    max-height: 600px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
}

/* JSONTree Viewer Custom Styles */
.json-tree {
    padding: 20px;
}

.json-tree-node {
    margin: 2px 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.json-tree-key {
    color: #0066cc;
    font-weight: 600;
    cursor: pointer;
}

.json-tree-key:hover {
    color: #004499;
    text-decoration: underline;
}

.json-tree-value-string {
    color: #22c55e;
    font-weight: normal;
}

.json-tree-value-number {
    color: #f59e0b;
    font-weight: normal;
}

.json-tree-value-boolean {
    color: #ef4444;
    font-weight: normal;
}

.json-tree-value-null {
    color: #6b7280;
    font-style: italic;
    font-weight: normal;
}

.json-tree-bracket {
    color: #374151;
    font-weight: bold;
}

.json-tree-expand-icon {
    display: inline-block;
    width: 16px;
    text-align: center;
    cursor: pointer;
    margin-right: 4px;
    user-select: none;
    font-size: 12px;
    color: #6b7280;
}

.json-tree-expand-icon:hover {
    color: #374151;
}

.json-tree-node.collapsed > .json-tree-children {
    display: none;
}

.json-tree-children {
    margin-left: 20px;
    border-left: 1px solid #e5e7eb;
    padding-left: 10px;
}

.json-tree-comma {
    color: #6b7280;
}

.json-tree-type-indicator {
    color: #9ca3af;
    font-size: 12px;
    margin-left: 8px;
}

.json-tree-array-length {
    color: #9ca3af;
    font-size: 12px;
    margin-left: 4px;
}

.copy-btn {
    background: #10b981;
    color: white;
    border: none;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    cursor: pointer;
    margin-left: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.json-tree-node:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background: #059669;
}

.delete-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    cursor: pointer;
    margin-left: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.json-tree-node:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    background: #dc2626;
}

.export-controls {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    padding: 10px;
    background: #f3f4f6;
    border-radius: 6px;
}

.export-btn {
    background: #8b5cf6;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.export-btn:hover {
    background: #7c3aed;
}

.path-selector {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    padding: 8px;
    border-radius: 6px;
    margin: 4px 0;
    font-size: 12px;
    color: #92400e;
}

/* JSON Editor Modal */
.editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.editor-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    width: 90vw;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.editor-header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-title {
    font-size: 1.3em;
    font-weight: 600;
    color: #1f2937;
}

.editor-path {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    color: #6b7280;
    background: #f3f4f6;
    padding: 4px 8px;
    border-radius: 4px;
    margin-left: 10px;
}

.editor-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.editor-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.editor-content {
    flex: 1;
    padding: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.editor-textarea {
    flex: 1;
    width: 100%;
    min-height: 300px;
    padding: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    transition: border-color 0.2s ease;
    background: #ffffff;
    color: #1f2937;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
}

.editor-textarea:focus {
    border-color: #4f46e5;
}

.editor-textarea.error {
    border-color: #ef4444;
    background: #fef2f2;
}

.editor-footer {
    padding: 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.editor-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.9em;
}

.editor-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.editor-status.valid {
    background: #dcfce7;
    color: #166534;
}

.editor-status.invalid {
    background: #fee2e2;
    color: #dc2626;
}

.editor-buttons {
    display: flex;
    gap: 10px;
}

.editor-btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.editor-btn.primary {
    background: #4f46e5;
    color: white;
}

.editor-btn.primary:hover {
    background: #4338ca;
}

.editor-btn.secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.editor-btn.secondary:hover {
    background: #e5e7eb;
}

.editor-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.json-tree-node:hover {
    background: #f8fafc;
    border-radius: 4px;
}

.json-tree-node.editing {
    background: #eff6ff;
    border-radius: 4px;
}

/* Edit indicator */
.edit-indicator {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    cursor: pointer;
    margin-left: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.json-tree-node:hover .edit-indicator {
    opacity: 1;
}

.edit-indicator:hover {
    background: #2563eb;
}

.single-pane-mode .dual-pane-container {
    display: block;
}

.single-pane-mode .pane:last-child {
    display: none;
}

.back-btn {
    background: #6b7280;
    margin-bottom: 20px;
}

.back-btn:hover {
    background: #4b5563;
}

@media (max-width: 768px) {
    .container {
        margin: 10px;
        border-radius: 10px;
    }
    
    .header {
        padding: 20px;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .upload-section {
        padding: 20px;
    }
    
    .file-drop-zone {
        padding: 40px 20px;
    }
    
    .json-viewer {
        padding: 20px;
    }
    
    .json-content {
        padding: 20px;
        font-size: 12px;
    }
}