/* Override global styles that conflict */
.container {
    max-width: 1400px !important;
    margin: 0 auto;
    padding: 2rem;
    text-align: left !important;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    text-align: left;
}

/* Back link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--link-color);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    transition: opacity 0.2s;
}

.back-link:hover {
    opacity: 0.8;
}

/* Mode Tabs */
.mode-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    background: var(--nav-submenu-bg);
    border-radius: 12px;
    padding: 0.35rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    width: fit-content;
}

.mode-tab {
    padding: 0.7rem 1.4rem;
    border-radius: 9px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.mode-tab:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.04);
}

.mode-tab.active {
    background: rgba(77, 171, 247, 0.15);
    color: var(--link-color);
    font-weight: 600;
}

.mode-content {
    display: none;
}

.mode-content.active {
    display: block;
}

/* Toolbar */
.toolbar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    align-items: center;
}

.toolbar-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.toolbar-separator {
    width: 1px;
    height: 28px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 0.5rem;
}

/* Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn:hover {
    background: rgba(77, 171, 247, 0.1);
    border-color: rgba(77, 171, 247, 0.3);
    color: var(--link-color);
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--link-color) 0%, #339af0 100%);
    color: #121212;
    border: none;
    font-weight: 600;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #339af0 0%, #228be6 100%);
    color: #121212;
    box-shadow: 0 4px 15px rgba(77, 171, 247, 0.4);
}

.btn-danger {
    border-color: rgba(231, 76, 60, 0.3);
}

.btn-danger:hover {
    background: rgba(231, 76, 60, 0.1);
    border-color: rgba(231, 76, 60, 0.5);
    color: #e74c3c;
}

.tool-select {
    padding: 0.6rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: #1e1e1e;
    color: var(--text-color);
    font-size: 0.9rem;
    cursor: pointer;
}

.tool-select option {
    background: #1e1e1e;
    color: var(--text-color);
}

.tool-select:focus {
    outline: none;
    border-color: var(--link-color);
}

/* Editor panels */
.editor-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    min-height: 500px;
}

.editor-panel {
    display: flex;
    flex-direction: column;
    background: var(--nav-submenu-bg);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.panel-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.6);
}

.panel-actions {
    display: flex;
    gap: 0.5rem;
}

.panel-btn {
    padding: 0.35rem 0.7rem;
    border-radius: 5px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.panel-btn:hover {
    background: rgba(77, 171, 247, 0.15);
    color: var(--link-color);
}

.editor-textarea {
    flex: 1;
    width: 100%;
    padding: 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-color);
    font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    resize: none;
    outline: none;
    tab-size: 2;
    text-align: left;
}

.editor-textarea::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

/* Output area */
.output-area {
    flex: 1;
    padding: 1.25rem;
    overflow: auto;
    font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    text-align: left;
}

.placeholder-text {
    color: rgba(255, 255, 255, 0.25);
}

/* Syntax highlighting */
.json-key { color: #9cdcfe; }
.json-string { color: #ce9178; }
.json-number { color: #b5cea8; }
.json-boolean { color: #569cd6; }
.json-null { color: #569cd6; }
.json-bracket { color: #ffd700; }
.json-comma { color: rgba(255, 255, 255, 0.5); }

/* JSON Path Bar */
.json-path-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    margin-bottom: 1.5rem;
    background: var(--nav-submenu-bg);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
}

.json-path-bar i {
    color: var(--link-color);
}

.json-path-bar span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.json-path-bar .path-active {
    color: #4dabf7;
}

/* Tree View Styles */
.tree-output {
    white-space: normal;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.tree-node {
    margin-left: 1.25rem;
    text-align: left;
}

.tree-node-root {
    margin-left: 0;
}

.tree-item {
    display: flex;
    align-items: flex-start;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
    gap: 0.4rem;
}

.tree-item:hover {
    background: rgba(77, 171, 247, 0.08);
}

.tree-item.selected {
    background: rgba(77, 171, 247, 0.15);
    border-left: 2px solid var(--link-color);
}

.tree-toggle {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.7rem;
    flex-shrink: 0;
    margin-top: 2px;
    transition: transform 0.2s;
}

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

.tree-toggle.leaf {
    visibility: hidden;
}

.tree-key {
    color: #9cdcfe;
    font-weight: 500;
    margin-right: 0.3rem;
}

.tree-colon {
    color: rgba(255, 255, 255, 0.4);
    margin-right: 0.4rem;
}

.tree-value {
    color: #ce9178;
}

.tree-value.type-number { color: #b5cea8; }
.tree-value.type-boolean { color: #569cd6; }
.tree-value.type-null { color: #569cd6; font-style: italic; }

.tree-type-badge {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.4);
    margin-left: 0.5rem;
}

.tree-children {
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    margin-left: 0.5rem;
    padding-left: 0.5rem;
}

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

/* Schema Results */
.schema-results {
    margin-top: 1.5rem;
    background: var(--nav-submenu-bg);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1.5rem;
    text-align: left;
    min-height: 60px;
}

.schema-results .result-success {
    color: #2ecc71;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.schema-results .result-error {
    color: #e74c3c;
}

.schema-results .result-error-item {
    padding: 0.5rem 0.75rem;
    margin: 0.5rem 0;
    background: rgba(231, 76, 60, 0.08);
    border-left: 3px solid #e74c3c;
    border-radius: 0 6px 6px 0;
    font-size: 0.85rem;
    line-height: 1.5;
}

.schema-results .result-error-path {
    color: #f39c12;
    font-family: monospace;
    font-size: 0.8rem;
}

/* Status bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    margin-bottom: 1.5rem;
    background: var(--nav-submenu-bg);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-valid { color: #2ecc71; }
.status-invalid { color: #e74c3c; }
.status-empty { color: rgba(255, 255, 255, 0.3); }

/* Error display */
.error-message {
    padding: 1rem 1.25rem;
    background: rgba(231, 76, 60, 0.08);
    border-left: 3px solid #e74c3c;
    color: #e74c3c;
    font-size: 0.85rem;
    line-height: 1.5;
    text-align: left;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 0.85rem 1.5rem;
    background: var(--nav-submenu-bg);
    border: 1px solid rgba(77, 171, 247, 0.3);
    border-radius: 10px;
    color: var(--link-color);
    font-size: 0.9rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Mobile */
@media (max-width: 900px) {
    .editor-wrapper {
        grid-template-columns: 1fr;
        min-height: auto;
    }
    .editor-panel { min-height: 300px; }
    .toolbar { gap: 0.5rem; }
    .container { padding: 1rem; }
    .mode-tabs { flex-wrap: wrap; width: 100%; }
}
