:root {
    --primary-blue: #1e3a8a;
    --secondary-blue: #1e40af;
    --accent-blue: #3b82f6;
    --light-blue: #60a5fa;
    --dark-blue: #0f172a;
    --darker-blue: #020617;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: #334155;
    --success-green: #10b981;
    --warning-yellow: #f59e0b;
    --error-red: #ef4444;
    --purple: #a855f7;
}

* {
    box-sizing: border-box;
}

html, body {
    max-width: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--darker-blue);
    color: var(--text-primary);
    overflow-x: hidden;
}

body {
    background: linear-gradient(135deg, var(--darker-blue) 0%, var(--dark-blue) 100%);
    min-height: 100vh;
}

/* Header Styles */
header {
    height: 60px;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 4px 20px rgba(30, 58, 138, 0.3);
    border-bottom: 1px solid var(--border-color);
}

header .logo {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-decoration: none;
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
}

header .logo:hover {
    transform: translateY(-1px);
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

header .logo::before {
    content: '</>';
    font-size: 28px;
    color: var(--light-blue);
    font-weight: 800;
}

.tagline {
    position: absolute;
    right: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    opacity: 0.8;
}

/* Main Layout */
main {
    display: flex;
    height: calc(100vh - 120px);
    background: var(--dark-blue);
    position: relative;
}

/* Input Textarea */
textarea {
    outline: none;
    width: calc(50% - 5px);
    height: 100%;
    border: 1px solid var(--border-color);
    border-right: none;
    resize: none;
    padding: 24px;
    background: var(--darker-blue);
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    line-height: 1.6;
    transition: all 0.3s ease;
}

textarea:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

#json-input.dragover {
    border: 2px dashed var(--light-blue);
    background: rgba(30, 58, 138, 0.1);
    box-shadow: 0 0 20px rgba(96, 165, 250, 0.2);
}

#json-input.dragover::placeholder {
    visibility: hidden;
}

/* Resizer */
#resizer {
    width: 10px;
    background: linear-gradient(to bottom, var(--border-color), var(--primary-blue));
    cursor: ew-resize;
    position: relative;
    z-index: 10;
    transition: all 0.3s ease;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

#resizer:hover {
    background: linear-gradient(to bottom, var(--accent-blue), var(--primary-blue));
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

#resizer::after {
    content: '⋮⋮⋮';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-muted);
    font-size: 12px;
    line-height: 0.3;
}

/* Output View */
#json-view {
    outline: none;
    width: calc(50% - 5px);
    height: 100%;
    background: var(--darker-blue);
    overflow-y: auto;
    padding: 20px;
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    line-height: 1.3;
    font-size: 12px;
    border: 1px solid var(--border-color);
    border-left: none;
    position: relative;
}

#json-view::-webkit-scrollbar {
    width: 8px;
}

#json-view::-webkit-scrollbar-track {
    background: var(--dark-blue);
}

#json-view::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

#json-view::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
}

#json-view a {
    color: var(--light-blue);
    text-decoration: underline;
    transition: color 0.2s ease;
}

#json-view a:hover {
    color: var(--accent-blue);
}

/* Syntax Highlighting */
.key {
    color: var(--light-blue);
    font-weight: 600;
}

.string,
.string a {
    color: var(--text-primary);
    font-style: normal;
}

.error {
    color: var(--error-red);
    font-weight: 600;
    background: rgba(239, 68, 68, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
}

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

.boolean {
    color: var(--text-secondary);
    font-weight: normal;
}

.number {
    color: var(--text-secondary);
    font-weight: normal;
}

/* Tree View Controls */
.toggle {
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    position: absolute;
    left: 4px;
}

.toggle::before {
    font-size: 10px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    content: '−';
    display: inline-block;
    line-height: 1;
    margin: 0;
    padding: 0;
    font-weight: 400;
    width: 12px;
    text-align: center;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.toggle:hover::before {
    color: var(--text-secondary);
    opacity: 1;
}

.collapsed .indent {
    display: none;
}

.collapsed .toggle::before {
    content: '+';
}

.collapsed > .children {
    display: none;
}

.toggle:hover + .children {
    opacity: 0.7;
}

.children-count {
    font-size: 11px;
    margin-left: 6px;
    margin-right: 6px;
    color: var(--text-muted);
    opacity: 0.8;
}

/* Footer */
footer {
    height: 60px;
    background: var(--darker-blue);
    color: var(--text-muted);
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    border-top: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

footer a {
    color: var(--light-blue);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

footer a:hover {
    color: var(--accent-blue);
}

#footer-stats {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-secondary);
}

/* Table Styles for CSV */
table {
    border-collapse: collapse;
    width: 100%;
    margin: 16px 0;
    background: var(--dark-blue);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

th, td {
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    text-align: left;
}

th {
    background: var(--primary-blue);
    color: white;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    background: var(--darker-blue);
    transition: background-color 0.2s ease;
}

tr:hover td {
    background: rgba(203, 213, 225, 0.02);
}

/* Utility Classes */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--accent-blue);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.child {
    transition: all 0.2s ease;
    position: relative;
    padding-left: 16px;
}

.child:hover {
    background: rgba(203, 213, 225, 0.02);
    border-radius: 4px;
    margin: -2px;
    padding: 2px 2px 2px 16px;
}

/* Focus Styles */
textarea:focus,
#json-view:focus {
    outline: 2px solid var(--accent-blue);
    outline-offset: -2px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    header {
        height: 50px;
        padding: 0 16px;
    }

    header .logo {
        font-size: 20px;
    }

    .tagline {
        display: none;
    }

    main {
        flex-direction: column;
        height: calc(100vh - 110px);
    }

    textarea,
    #json-view {
        width: 100% !important;
        height: calc(40vh - 20px);
        border: 1px solid var(--border-color);
    }

    textarea {
        border-bottom: none;
        border-radius: 0;
    }

    #json-view {
        height: calc(60vh - 20px);
        border-top: none;
    }

    #resizer {
        display: none;
    }

    footer {
        position: fixed;
        bottom: 0;
        width: 100vw;
        height: 50px;
        padding: 0 16px;
        justify-content: center;
        background: rgba(2, 6, 23, 0.95);
        backdrop-filter: blur(10px);
    }

    .hide-before-600px {
        display: none;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(2, 6, 23, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.help-modal {
    background: var(--darker-blue);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.help-modal h3 {
    margin: 0 0 20px 0;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
}

.shortcut-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.shortcut {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.shortcut:last-child {
    border-bottom: none;
}

.shortcut kbd {
    background: var(--primary-blue);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
    font-weight: 600;
}

.shortcut span {
    color: var(--text-secondary);
    font-size: 14px;
}

.help-footer {
    margin-top: 20px;
    text-align: right;
}

.help-footer button {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.help-footer button:hover {
    background: var(--light-blue);
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 16px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    z-index: 1001;
    max-width: 350px;
    animation: slideIn 0.3s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.notification-info {
    background: var(--accent-blue);
}

.notification-success {
    background: var(--success-green);
}

.notification-warning {
    background: var(--warning-yellow);
}

.notification-error {
    background: var(--error-red);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
} 