/* JSON Formatter Styles */

.formatter-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.formatter-header {
    text-align: center;
    margin-bottom: 2rem;
}

.formatter-header h1 {
    font-family: 'Orbitron', monospace;
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.formatter-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Action Bar */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.action-group {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.action-btn.primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border: none;
    color: white;
}

.action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(88, 101, 242, 0.4);
}

.action-btn svg {
    width: 16px;
    height: 16px;
}

/* Status Bar */
.status-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.status-icon {
    font-size: 1rem;
}

.status-bar.valid {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.1);
}

.status-bar.valid .status-icon {
    color: var(--success);
}

.status-bar.valid .status-text {
    color: var(--success);
}

.status-bar.error {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.status-bar.error .status-icon {
    color: var(--error);
}

.status-bar.error .status-text {
    color: var(--error);
}

.status-text {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Main Editor */
.editor-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.editor-panel {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--dark-bg);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.panel-info {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
}

.panel-tabs {
    display: flex;
    gap: 0.25rem;
}

.panel-tab {
    padding: 0.4rem 0.75rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.panel-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.panel-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Editor Wrapper */
.editor-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.line-numbers {
    padding: 1rem 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    text-align: right;
    user-select: none;
    min-width: 40px;
    overflow: hidden;
    white-space: pre;
}

#jsonInput {
    flex: 1;
    padding: 1rem;
    background: transparent;
    border: none;
    color: var(--text-light);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    resize: none;
    outline: none;
    min-height: 400px;
}

#jsonInput::placeholder {
    color: var(--text-muted);
}

/* Output Wrapper */
.output-wrapper {
    flex: 1;
    overflow: auto;
}

.output-formatted {
    display: flex;
    min-height: 400px;
}

#jsonOutput {
    flex: 1;
    padding: 1rem;
    margin: 0;
    background: transparent;
    color: var(--text-light);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: auto;
}

/* Syntax Highlighting */
.json-key {
    color: #7dd3fc;
}

.json-string {
    color: #a5d6a7;
}

.json-number {
    color: #ffcc80;
}

.json-boolean {
    color: #ce93d8;
}

.json-null {
    color: #ef9a9a;
}

.json-bracket {
    color: #90a4ae;
}

/* Tree View */
.output-tree {
    padding: 1rem;
    min-height: 400px;
    overflow: auto;
}

.tree-node {
    margin-left: 1rem;
}

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

.tree-key {
    color: #7dd3fc;
    cursor: pointer;
}

.tree-key:hover {
    text-decoration: underline;
}

.tree-value {
    color: #a5d6a7;
}

.tree-value.number {
    color: #ffcc80;
}

.tree-value.boolean {
    color: #ce93d8;
}

.tree-value.null {
    color: #ef9a9a;
}

.tree-toggle {
    display: inline-block;
    width: 1rem;
    cursor: pointer;
    color: var(--text-muted);
}

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

/* Settings Section */
.settings-section {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.settings-section h3 {
    color: var(--text-light);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.settings-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.setting-item label:first-child {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.setting-item select {
    padding: 0.5rem 1rem;
    background: var(--dark-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-light);
    cursor: pointer;
}

/* Toggle Switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

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

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

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: 0.3s;
}

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

.toggle input:checked + .toggle-slider:before {
    background: white;
    transform: translateX(20px);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--success);
    color: white;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

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

/* Responsive */
@media (max-width: 1024px) {
    .editor-main {
        grid-template-columns: 1fr;
    }

    #jsonInput,
    .output-formatted {
        min-height: 300px;
    }
}

@media (max-width: 768px) {
    .formatter-container {
        padding: 1rem;
    }

    .formatter-header h1 {
        font-size: 2rem;
    }

    .action-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .action-group {
        flex-wrap: wrap;
        justify-content: center;
    }

    .settings-grid {
        flex-direction: column;
        gap: 1rem;
    }

    .setting-item {
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .formatter-container {
        padding: 0.75rem;
    }

    .formatter-header h1 {
        font-size: 1.6rem;
    }

    .formatter-header p {
        font-size: 1rem;
    }

    .action-btn {
        padding: 0.6rem 0.9rem;
        font-size: 0.82rem;
    }

    .action-group {
        width: 100%;
        justify-content: stretch;
    }

    .action-group .action-btn {
        flex: 1;
        justify-content: center;
    }

    .panel-header {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .panel-info {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    #jsonInput {
        min-height: 220px;
        font-size: 0.8rem;
    }

    .output-formatted {
        min-height: 220px;
    }

    #jsonOutput {
        font-size: 0.8rem;
    }
}
