:root {
    --bg-color: #0b0b0b;
    --sidebar-bg: #0b0b0b;
    --card-bg: #121212;
    --border-color: #1a1a1a;
    --text-main: #eeeeee;
    --text-muted: #888888;
    --accent: #e5b061;
    --hover-bg: #161616;
    --active-bg: #1a1a1a;
    --error: #e57373;
    --radius-soft: 8px;
    --radius-pill: 30px;
    --font-sans: 'Inter', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-sans);
    height: 100vh;
    overflow: hidden;
}

/* LAYOUT */
.dashboard { display: flex; height: 100vh; }

.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.main-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-color);
    overflow: hidden;
    position: relative;
}

.explorer-results {
    position: absolute;
    bottom: 30px;
    left: 30px;
    width: 320px;
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: none;
    border-left: 3px solid var(--accent);
}

.explorer-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 16px;
}
.explorer-close:hover { color: #fff; }

/* BRANDING */
.brand { padding: 24px 24px; display: flex; align-items: center; gap: 12px; }
.brand-icon {
    background: var(--accent); color: #111; font-weight: 700;
    width: 24px; height: 24px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: 0.5px; }

/* NAV MENU */
.nav-menu { flex: 1; overflow-y: auto; padding: 10px 10px; }
.nav-menu::-webkit-scrollbar { width: 4px; }
.nav-menu::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

.nav-group { margin-bottom: 5px; }
.nav-group summary {
    padding: 8px 14px; font-size: 11px; color: #666; text-transform: uppercase;
    letter-spacing: 1px; cursor: pointer; font-weight: 500; margin-top: 15px;
    outline: none; list-style: none; display: flex; align-items: center;
}
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::before { content: "−"; display: inline-block; margin-right: 10px; color: #444; }
.nav-group:not([open]) summary::before { content: "+"; }

.nav-item {
    width: 100%; background: transparent; border: none; color: #999;
    text-align: left; padding: 8px 14px 8px 30px; font-family: var(--font-sans);
    font-size: 13px; cursor: pointer; border-radius: 6px; margin-bottom: 2px;
    transition: all 0.2s ease; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-item:hover { background: var(--hover-bg); color: var(--text-main); }
.nav-item.active { background: var(--active-bg); color: var(--text-main); font-weight: 500; }
.nav-item.status-btn { padding-left: 14px; color: #888; }

/* TOPBAR */
.topbar { padding: 24px 40px; border-bottom: none; }
.breadcrumb { color: #555; font-size: 12px; font-weight: 500; }
.breadcrumb span { color: var(--text-main); }

/* MAIN CONTENT */
.content-wrapper { padding: 0 40px 40px 40px; flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* INPUT SECTION */
.query-interface { margin-bottom: 30px; }
.input-header { margin-bottom: 10px; }
.input-group {
    background: var(--bg-color); border: 1px solid var(--border-color);
    border-radius: var(--radius-pill); padding: 6px 6px 6px 20px;
    display: flex; align-items: center; transition: border-color 0.2s;
}
.input-group:focus-within { border-color: #333; }

.cyber-select {
    background: transparent; border: none; color: #bbb;
    font-family: var(--font-sans); font-size: 14px; outline: none; cursor: pointer;
    font-weight: 500; margin-right: 15px; padding-right: 10px; border-right: 1px solid var(--border-color);
}
.cyber-select.hidden { display: none; }
.cyber-select option { background: var(--card-bg); color: var(--text-main); }

input[type="text"] {
    flex: 1; background: transparent; border: none; color: var(--text-main);
    font-family: var(--font-sans); font-size: 14px; outline: none;
}
input[type="text"]::placeholder { color: #555; font-weight: 400; }

.cyber-button {
    background: var(--accent); color: #111; border: none;
    height: 38px; padding: 0 24px; border-radius: var(--radius-pill);
    font-family: var(--font-sans); font-size: 13px; font-weight: 600;
    cursor: pointer; display: flex; align-items: center; transition: opacity 0.2s;
}
.cyber-button:hover { opacity: 0.9; }
.cyber-button:disabled { opacity: 0.5; cursor: not-allowed; }

/* RESULTS WINDOW */
.results-window {
    flex: 1; background: var(--card-bg); border: 1px solid var(--border-color);
    border-radius: var(--radius-soft); display: flex; flex-direction: column; overflow: hidden;
}
.results-content { flex: 1; padding: 0 30px 30px 30px; overflow-y: auto; color: #ccc; }
.results-content::-webkit-scrollbar { width: 8px; }
.results-content::-webkit-scrollbar-track { background: transparent; }
.results-content::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

/* TABS */
.view-tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--border-color); margin-bottom: 20px; }
.view-tab {
    background: transparent; border: none; color: #666; font-size: 12px; font-weight: 600;
    cursor: pointer; font-family: var(--font-sans); padding-bottom: 12px; text-transform: uppercase;
}
.view-tab.active { color: var(--text-main); border-bottom: 2px solid var(--accent); }

/* VISUAL ENGINE STYLES */
.visual-layout { display: flex; gap: 30px; align-items: flex-start; margin-top: 10px; }
@media(max-width: 1100px) { .visual-layout { flex-direction: column; } }

.visual-sidebar { width: 320px; display: flex; flex-direction: column; gap: 20px; flex-shrink: 0; }
.visual-main { flex: 1; display: flex; flex-direction: column; gap: 20px; width: 100%; min-width: 0; }

.v-card {
    background: var(--bg-color); border: 1px solid var(--border-color);
    border-radius: var(--radius-soft); padding: 20px;
}
.v-card-title {
    font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #666;
    margin-bottom: 15px; display: flex; align-items: center; gap: 8px; font-weight: 600;
}

.profile-hero { text-align: center; }
.profile-avatar { width: 90px; height: 90px; border-radius: 12px; margin: 0 auto 15px; border: 1px solid #333; object-fit: cover; background: #111; }
.profile-name { font-size: 18px; font-weight: 600; color: #fff; }
.profile-sub { font-size: 12px; color: #aaa; margin-top: 4px; }
.p-stat-box { display: flex; justify-content: center; gap: 30px; margin-top: 20px; border-top: 1px solid #1a1a1a; padding-top: 15px; }
.p-stat { text-align: center; }
.p-stat-val { font-size: 16px; font-weight: 600; color: #fff; line-height: 1; margin-bottom: 5px; }
.p-stat-lbl { font-size: 10px; text-transform: uppercase; color: #666; }

.link-btn {
    display: block; width: 100%; text-align: center; text-decoration: none; font-size: 12px;
    border: 1px solid var(--accent); color: var(--accent); padding: 8px; border-radius: 6px;
    margin-top: 15px; transition: 0.2s; font-weight: 500;
}
.link-btn:hover { background: var(--accent); color: #000; }

.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.kv-item { display: flex; flex-direction: column; }
.kv-lbl { font-size: 10px; text-transform: uppercase; color: #666; margin-bottom: 4px; font-weight: 600;}
.kv-val { font-size: 13px; color: #ddd; word-break: break-all; }

.tags-container { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { background: #111; border: 1px solid var(--accent); color: var(--accent); padding: 4px 10px; border-radius: 12px; font-size: 11px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 15px; }
.sub-card { background: #111; border: 1px solid #1a1a1a; border-radius: 8px; padding: 15px; }
.sub-card-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; border-bottom: 1px solid #1a1a1a; padding-bottom: 12px; }
.sub-card-icon { width: 36px; height: 36px; border-radius: 18px; background: #222; object-fit: cover; }
.sub-card-icon-placeholder { width: 36px; height: 36px; border-radius: 18px; background: #222; display:flex; align-items:center; justify-content:center; font-size:16px; }
.sub-card-title { font-weight: 600; font-size: 14px; color: #fff; margin-bottom: 4px;}
.sub-card-subtitle { font-size: 11px; color: #888; }
.sub-card-body { display: flex; flex-direction: column; gap: 8px; }
.sub-card-row { display: flex; justify-content: space-between; font-size: 12px; border-bottom: 1px solid rgba(255,255,255,0.02); padding-bottom: 4px; }
.sub-card-lbl { color: #666; }
.sub-card-val { color: #ddd; text-align: right; word-break: break-all; max-width: 60%; }

/* JSON FORMATTING */
pre { font-family: 'Consolas', monospace; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; padding-top: 10px;}
.json-key { color: #f0f0f0; }
.json-string { color: var(--accent); }
.json-number { color: #81a1c1; }
.json-boolean { color: #b48ead; }
.json-null { color: #6272a4; }

/* MISC UI */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: #444; min-height: 200px; padding-top: 40px;}
.empty-state svg { margin-bottom: 15px; opacity: 0.5; }
.loader-container { display: flex; align-items: center; justify-content: center; height: 100%; flex-direction: column; min-height: 200px; padding-top: 40px; }
.spinner { width: 24px; height: 24px; border: 2px solid #222; border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 15px; }
.loader-text { color: #777; font-size: 13px; }
@keyframes spin { 100% { transform: rotate(360deg); } }
.alert { padding: 15px 20px; border-radius: 6px; background: #1a1a1a; margin-top:20px; }
.alert.error { border-left: 3px solid var(--error); color: #fca5a5; }

.pulse { animation: status-pulse 1.5s infinite; }
@keyframes status-pulse { 0% { opacity: 1; } 50% { opacity: 0.3; } 100% { opacity: 1; } }
.warning-btn { background: #f44336 !important; color: #fff !important; }

/* MAP HUB ENHANCEMENTS */
.map-layer-btn {
    width: 32px; height: 32px; border-radius: 6px; background: rgba(10,10,10,0.8);
    border: 1px solid var(--border-color); color: #888; cursor: pointer;
    font-weight: 700; transition: all 0.2s; font-size: 11px;
}
.map-layer-btn:hover { border-color: var(--accent); color: #fff; }
.map-layer-btn.active { background: var(--accent); color: #000; border-color: var(--accent); }

.map-bookmark-item {
    padding: 12px 15px; border-radius: 8px; margin-bottom: 8px;
    background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05);
    cursor: pointer; transition: 0.2s;
}
.map-bookmark-item:hover { background: rgba(255,255,255,0.05); border-color: var(--accent); }
.map-bookmark-item:active { transform: scale(0.98); }

/* MOBILE OPTIMIZATION */
#mobile-menu-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    margin-right: 15px;
}

@media (max-width: 768px) {
    #mobile-menu-toggle { display: block; }

    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        z-index: 3000;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 20px 0 50px rgba(0,0,0,0.8);
    }
    .sidebar.open { left: 0; }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        backdrop-filter: blur(4px);
        z-index: 2500;
    }
    .sidebar-overlay.open { display: block; }

    .topbar { 
        padding: 15px 20px; 
        display: flex; 
        align-items: center; 
        border-bottom: 1px solid var(--border-color);
    }
    
    .content-wrapper { padding: 0 15px 15px 15px; }
    
    .input-group { padding: 4px 4px 4px 15px; border-radius: 12px; }
    .cyber-button { padding: 0 15px; font-size: 12px; }
    
    .breadcrumb { font-size: 10px; line-height: 1.4; }

    /* Map Explorer Mobile */
    #explorer-hub-container { grid-template-columns: 1fr !important; }
    #map-sidebar { display: none !important; }
    
    .explorer-overlay { width: 90%; top: 10px; }
    .map-layer-controls { top: 70px; right: 10px; }
    
    .v-card { padding: 15px; }
    .kv-grid { grid-template-columns: 1fr; gap: 10px; }
    .card-grid { grid-template-columns: 1fr; }
}
