/* ============================================
   View as JSON Overlay
   ============================================ */

/* JSON Toggle Button in Navbar */
.json-toggle {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    position: relative;
}

.json-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--glass-shadow);
}

.json-toggle.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

.json-toggle svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* JSON View Overlay */
.json-view-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9998;
    background: #0d1117;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.json-view-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* JSON View Header */
.json-view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.5rem;
    background: #161b22;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    z-index: 2;
}

.json-view-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.json-view-header .file-icon {
    color: #e6b450;
    font-size: 0.85rem;
}

.json-view-header .file-name {
    color: #e6edf3;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    font-weight: 500;
}

.json-view-header .file-meta {
    color: #8b949e;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    margin-left: 0.5rem;
}

.json-view-close {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #8b949e;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    padding: 0.35rem 0.8rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.json-view-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e6edf3;
    border-color: rgba(255, 255, 255, 0.2);
}

.json-view-close kbd {
    background: rgba(255, 255, 255, 0.08);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* JSON View Body */
.json-view-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    padding: 0;
    position: relative;
}

.json-view-body::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.json-view-body::-webkit-scrollbar-track {
    background: #0d1117;
}

.json-view-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}

.json-view-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* JSON Code Container */
.json-code-container {
    display: flex;
    min-height: 100%;
}

/* Line Numbers */
.json-line-numbers {
    padding: 1rem 0;
    text-align: right;
    user-select: none;
    flex-shrink: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    background: #0d1117;
    position: sticky;
    left: 0;
    z-index: 1;
}

.json-line-numbers span {
    display: block;
    padding: 0 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    line-height: 1.65;
    color: #484f58;
    min-width: 3rem;
}

/* JSON Content */
.json-content {
    padding: 1rem 1.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    line-height: 1.65;
    color: #e6edf3;
    white-space: pre;
    flex: 1;
}

/* Syntax Highlighting */
.json-key {
    color: #79c0ff;
}

.json-string {
    color: #a5d6ff;
}

.json-number {
    color: #79c0ff;
}

.json-boolean {
    color: #ff7b72;
}

.json-null {
    color: #ffa657;
}

.json-bracket {
    color: #e6edf3;
}

.json-punctuation {
    color: #8b949e;
}

/* JSON View Footer */
.json-view-footer {
    padding: 0.4rem 1.5rem;
    background: #161b22;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: #8b949e;
    flex-shrink: 0;
}

.json-view-footer-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.json-view-footer-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.json-footer-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.json-footer-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #7ee787;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .json-toggle {
        display: none !important;
    }

    .json-view-header {
        padding: 0.6rem 1rem;
    }

    .json-content {
        font-size: 0.68rem;
        padding: 0.8rem;
    }

    .json-line-numbers span {
        font-size: 0.68rem;
        padding: 0 0.6rem;
    }

    .json-view-header .file-meta {
        display: none;
    }
}