/**
 * JSON Tree Viewer Styles
 * Corporate, functional design for recursive JSON/YAML viewing
 */

.json-tree-viewer {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0; /* Critical for flex children */
    overflow: hidden;
    background: white;
}

.json-tree-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    gap: 1rem;
    flex-wrap: wrap;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.json-tree-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.75rem 1rem;
    background: #e9ecef;
    border-bottom: 1px solid #dee2e6;
    font-size: 0.875rem;
    flex-wrap: wrap;
}

.json-tree-stats span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.json-tree-stats strong {
    color: var(--primary);
}

.json-tree-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    min-height: 0; /* Critical for flex children */
}

/* JSON Node Styles */
.json-node {
    margin-bottom: 0.25rem;
}

.json-node-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s ease;
}

.json-node-header:hover {
    background: #f0f4f8;
}

.json-expand-icon {
    width: 16px;
    color: #6c757d;
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.json-key {
    font-weight: 600;
    color: #495057;
}

.json-separator {
    color: #adb5bd;
    margin: 0 0.25rem;
}

.json-value {
    color: #212529;
    word-break: break-word;
}

.json-value-string {
    color: #38a169;
    /* Green */
}

.json-value-number {
    color: #3182ce;
    /* Blue */
}

.json-value-boolean {
    color: #d69e2e;
    /* Orange */
}

.json-value-null {
    color: #718096;
    /* Gray */
    font-style: italic;
}

.json-type-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: #e9ecef;
    color: #495057;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.json-node-object .json-type-badge {
    background: #d6e8f7;
    color: #1a3a52;
}

.json-node-array .json-type-badge {
    background: #d4edda;
    color: #155724;
}

.json-count {
    color: #6c757d;
    font-size: 0.75rem;
    font-style: italic;
}

.json-copy-path-btn {
    margin-left: auto;
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: 1px solid #ced4da;
    border-radius: 4px;
    color: #6c757d;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.15s ease;
    opacity: 0;
}

.json-node-header:hover .json-copy-path-btn {
    opacity: 1;
}

.json-copy-path-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.json-node-children {
    border-left: 2px solid #e9ecef;
    padding-left: 0.5rem;
    margin-left: 0.5rem;
}

.json-empty {
    color: #adb5bd;
    font-style: italic;
    padding: 0.25rem 0;
}

/* Search Highlight */
.search-highlight {
    background: #fff3cd;
    border-left: 3px solid #ffc107;
    padding-left: 0.5rem;
}

.search-highlight .json-node-header {
    background: #fff3cd;
}

/* Value Node */
.json-node-value {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
}

.json-node-value:hover {
    background: #f8f9fa;
}

/* Responsive */
@media (max-width: 768px) {
    .json-tree-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-group {
        width: 100%;
        justify-content: space-between;
    }

    .json-tree-stats {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .json-node-header {
        font-size: 0.8rem;
    }

    .json-tree-container {
        font-size: 0.8rem;
    }
}

/* Dark mode (optional for future) */
@media (prefers-color-scheme: dark) {
    .json-tree-viewer {
        background: #1e1e1e;
        color: #d4d4d4;
    }

    .json-tree-toolbar,
    .json-tree-stats {
        background: #252526;
        border-color: #3e3e42;
    }

    .json-node-header:hover {
        background: #2d2d30;
    }

    .json-key {
        color: #9cdcfe;
    }

    .json-value-string {
        color: #ce9178;
    }

    .json-value-number {
        color: #b5cea8;
    }

    .json-value-boolean {
        color: #569cd6;
    }

    .json-value-null {
        color: #808080;
    }
}