/**
 * FILENAME: styles.css
 * GitGalaxy Aesthetic Framework
 * Consolidated UI Styling & Glassmorphism Core
 */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;700&family=Space+Mono:wght@400;700&display=swap');

:root {
    --accent: #00f3ff;
    --bg-ui: rgba(2, 2, 5, 0.98);
    --input-bg: #000000;
    --text: #ffffff;
    --panel-border: rgba(0, 243, 255, 0.5);
    --btn-hover: rgba(0, 243, 255, 0.2);
    --text-glow: 0 0 15px var(--accent), 0 0 30px rgba(0, 243, 255, 0.3);
}

body, html {
    margin: 0; 
    padding: 0; 
    width: 100%; 
    height: 100%;
    background: #000; 
    overflow: hidden;
    font-family: 'Space Grotesk', sans-serif; 
    color: var(--text); 
    user-select: none;
}

#viewport { 
    position: absolute; 
    inset: 0; 
    z-index: 5; 
}

/* --- TEXT SELECTION EXCEPTIONS --- */
/* Allow users to highlight and copy file names, stats, and search results */
.passport-value, .stat-result-label, .search-item span {
    user-select: text;
}

/* LEFT HUD: The Sidebar */
#ui-layer {
    position: absolute; 
    top: 0; 
    left: 0;
    width: 380px; 
    height: 100%; 
    background: var(--bg-ui);
    border-right: 1px solid var(--panel-border);
    padding: 30px; 
    box-sizing: border-box;
    z-index: 100; 
    pointer-events: all;
    display: flex; 
    flex-direction: column;
    box-shadow: 20px 0 60px rgba(0,0,0,0.8); 
    backdrop-filter: blur(15px);
}

header h1 { 
    font-size: 24px; 
    margin: 0; 
    color: var(--accent); 
    letter-spacing: 1px; 
    text-transform: uppercase; 
    text-shadow: var(--text-glow), 0 0 40px var(--accent); 
}

header h2 { 
    font-size: 11px; 
    margin: 5px 0 25px 0; 
    opacity: 0.6; 
    font-weight: 400; 
    letter-spacing: 1px; 
    color: var(--accent); 
}

.panel-section { 
    margin-bottom: 25px; 
    position: relative; 
}

label { 
    display: block; 
    font-size: 10px; 
    color: var(--accent); 
    margin-bottom: 10px; 
    font-weight: bold; 
    text-transform: uppercase; 
    letter-spacing: 1.5px; 
    text-shadow: 0 0 8px var(--accent); 
}

select, button, input[type="text"] {
    width: 100%; 
    background: var(--input-bg); 
    border: 1px solid var(--panel-border);
    color: var(--text); 
    padding: 14px; 
    cursor: pointer;
    font-family: inherit; 
    font-size: 12px; 
    outline: none; /* You can actually leave this here! */
    border-radius: 4px;
    transition: all 0.2s ease; 
    letter-spacing: 0.5px; 
    box-sizing: border-box; 
    text-transform: uppercase;
}

select option { background: #000000; color: #ffffff; }
input[type="text"] { cursor: text; }
input[type="text"]:focus { border-color: var(--accent); box-shadow: 0 0 20px var(--btn-hover); }
select:hover, button:hover { border-color: var(--accent); background: var(--btn-hover); box-shadow: 0 0 20px var(--btn-hover); }

/* --- ACCESSIBILITY FOCUS RING --- */
select:focus-visible, button:focus-visible, input[type="text"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.cyber-scroll { 
    flex-grow: 1; 
    overflow-y: auto; 
    padding-right: 8px; 
    margin-top: 5px; 
    /* Add these two lines for Firefox: */
    scrollbar-width: thin; 
    scrollbar-color: var(--panel-border) transparent; 
}

/* Apply neon scrollbars globally to all HUDs and cyber-scroll containers */
.cyber-scroll::-webkit-scrollbar,
#file-hud::-webkit-scrollbar,
#ui-layer::-webkit-scrollbar { width: 4px; }

.cyber-scroll::-webkit-scrollbar-track,
#file-hud::-webkit-scrollbar-track,
#ui-layer::-webkit-scrollbar-track { background: transparent; }

.cyber-scroll::-webkit-scrollbar-thumb,
#file-hud::-webkit-scrollbar-thumb,
#ui-layer::-webkit-scrollbar-thumb { background: var(--panel-border); border-radius: 2px; }

.cyber-scroll::-webkit-scrollbar-thumb:hover,
#file-hud::-webkit-scrollbar-thumb:hover,
#ui-layer::-webkit-scrollbar-thumb:hover { background: var(--accent); box-shadow: 0 0 10px var(--accent); }

.search-results-container {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    background: var(--bg-ui); border: 1px solid var(--panel-border);
    max-height: 250px; overflow-y: auto; z-index: 200;
    display: none; box-shadow: 0 10px 30px rgba(0,0,0,0.9); border-radius: 4px;
}

.search-item { padding: 12px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 11px; transition: all 0.2s ease; display: flex; justify-content: space-between; }
.search-item:hover { background: var(--btn-hover); padding-left: 16px; border-left: 2px solid var(--accent); }

/* Dynamic Buttons */
.warp-btn { text-align: left; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; background: var(--input-bg); padding: 12px; border: 1px solid var(--panel-border); color: var(--text); font-size: 12px; box-sizing: border-box; }
.warp-btn span { opacity: 0.8; font-size: 9px; border: 1px solid currentColor; padding: 2px 5px; border-radius: 2px; color: var(--accent); font-family: 'Space Mono', monospace; }
.warp-btn:hover { border-color: var(--accent); transform: translateX(6px); box-shadow: -10px 0 20px var(--btn-hover); }

footer#status-line { font-size: 10px; opacity: 0.8; margin-top: 15px; border-top: 1px solid var(--panel-border); padding-top: 20px; line-height: 2; font-family: 'Space Mono', monospace; text-transform: uppercase; letter-spacing: 1px; color: var(--accent); }
.status-row { display: flex; justify-content: space-between; }

/* HEALTH BAR METRIC HUD (Top Left) */
#metric-legend {
    position: absolute; 
    top: 30px; 
    left: 390px; /* Shifted to clear the 380px left HUD */
    width: 400px; 
    padding: 20px; 
    background: #000000;
    border: 1px solid #333333; 
    border-radius: 0 6px 6px 0;
    z-index: 90; 
    display: block; 
    opacity: 0; 
    pointer-events: none;
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
    transition: opacity 0.5s ease, transform 0.5s ease;
    transform: translateX(-20px);
}
#metric-legend.active { opacity: 1; transform: translateX(0); }

.legend-header { font-size: 14px; color: var(--accent); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 3px; font-weight: 700; text-shadow: var(--text-glow); border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 8px; }
.legend-bar { height: 12px; width: 100%; margin-bottom: 8px; background: #333; border-radius: 2px; border: 1px solid rgba(255,255,255,0.3); box-shadow: 0 0 10px rgba(0,0,0,0.5) inset; transition: background 0.5s ease; }
.legend-labels { display: flex; justify-content: space-between; font-size: 10px; color: white; opacity: 0.9; font-family: 'Space Mono', monospace; font-weight: 700; text-shadow: 0 0 5px rgba(0,0,0,0.8); }

/* OVERLAY HUD: Deep Scan File Terminal (Left Anchored) */
#file-hud {
    position: absolute; 
    top: 0; 
    left: 0; /* Anchors it to the left over the main menu */
    width: 380px; 
    max-width: 100%; 
    overflow-x: hidden; 
    height: 100%; 
    background: var(--bg-ui);
    border-right: 1px solid var(--panel-border); /* Border on the right now */
    padding: 30px; 
    box-sizing: border-box;
    display: flex; 
    flex-direction: column; 
    opacity: 0; 
    transform: translateX(-50px); /* Slides in from the left */
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1); 
    pointer-events: none; 
    z-index: 200; /* Sits higher than the ui-layer (100) */
    box-shadow: 20px 0 60px rgba(0,0,0,0.8); /* Shadow casts to the right */
    backdrop-filter: blur(15px);
}
#file-hud.active { opacity: 1; transform: translateX(0); pointer-events: all; }

/* HUD Internal Formatting */
.hud-title { margin: 0 0 18px 0; font-size: 18px; color: var(--accent); text-transform: uppercase; text-shadow: var(--text-glow); border-bottom: 1px solid var(--panel-border); padding-bottom: 12px; letter-spacing: 2px; text-align: center; }
.passport-container { padding: 20px; border-bottom: 1px solid var(--accent); margin-bottom: 20px; background: rgba(0,0,0,0.3); }
.passport-row { display: flex; justify-content: space-between; font-family: 'Space Mono', monospace; font-size: 12px; margin-bottom: 8px; color: rgba(255,255,255,0.9); }
.passport-value { color: var(--accent); font-weight: bold; }
.close-btn { position: absolute; top: 20px; right: 20px; background: transparent; border: none; width: auto; padding: 5px; color: var(--text); font-size: 16px; cursor: pointer; }
.close-btn:hover { color: var(--accent); transform: scale(1.1); }

/* HUD Copy Button */
.copy-btn { 
    margin-top: auto; 
    background: transparent; 
    border: 1px solid var(--panel-border); 
    border-radius: 4px; 
    padding: 12px; 
    color: var(--accent); 
    font-family: 'Space Mono', monospace; 
    font-size: 12px; 
    cursor: pointer; 
    transition: all 0.2s ease; 
    text-transform: uppercase; 
    width: 100%;
    text-align: center;
    letter-spacing: 2px;
}
.copy-btn:hover { background: var(--btn-hover); box-shadow: 0 0 10px var(--btn-hover); }
.copy-btn.success { background: var(--accent); color: #000; box-shadow: 0 0 15px var(--accent); font-weight: bold; }

/* Strict containment for the dynamic cards */
#file-stats-body {
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    padding-right: 5px; 
}

/* =========================================
   3D CANVAS OVERLAYS (Star Labels)
   ========================================= */
#label-container {
    position: absolute;
    inset: 0;
    pointer-events: none; 
    z-index: 40; 
    overflow: hidden;
}

.star-label {
    position: absolute;
    font-family: 'Space Mono', monospace;
    font-size: 14px; 
    font-weight: bold; 
    color: var(--accent); /* Default Ice Crystal */
    text-transform: uppercase;
    pointer-events: none; 
    text-shadow: 0 0 5px #000, 0 0 10px var(--accent), 0 0 20px #000; 
    white-space: nowrap;
    z-index: 50;
    will-change: transform, opacity;
}

/* --- NEW: THEME OVERRIDES FOR LABELS --- */

/* Theme 2: Galactic (Pure White with White Glow) */
#label-container.theme-galactic .star-label {
    color: #ffffff;
    text-shadow: 0 0 5px #000, 0 0 10px #fff, 0 0 20px #000;
}

/* Theme 3: Matrix (Hacker Green) */
#label-container.theme-matrix .star-label {
    color: #00ff41;
    text-shadow: 0 0 5px #000, 0 0 10px #00ff41, 0 0 20px #000;
}

/* Theme 4: High-Vis (Bold Black, No Glow, Larger Font) */
#label-container.theme-high-vis .star-label {
    color: #000000;
    font-size: 18px;
    font-weight: 900;
    text-shadow: none; /* Strip the glow for max contrast on white bg */
}


/* =========================================
   ZEN MODE & RESPONSIVE MOBILE OVERLAYS
   ========================================= */

/* Zen Mode Utility */
.zen-hidden {
    display: none !important;
}

/* Master Toggle Hover */
#master-hud-toggle:hover {
    background: var(--btn-hover) !important;
    box-shadow: 0 0 20px var(--accent) !important;
    transform: scale(1.1);
}

@media (max-width: 768px) {
    /* Stretch Left Menu to full width */
    #ui-layer {
        width: 100%;
        border-right: none;
    }

    /* Shift Legend to the bottom on mobile so it doesn't clip the menu */
    #metric-legend {
        left: 10px;
        top: auto;
        bottom: 80px; /* Above the Zen button */
        width: calc(100% - 20px);
        box-sizing: border-box;
        border-radius: 6px;
        transform: translateY(20px);
    }
    
    #metric-legend.active { 
        transform: translateY(0); 
    }
}

/* --- ZEN MODE MASTER BUTTON --- */
.zen-master-btn {
    position: absolute; 
    top: 25px; 
    left: 325px; /* Anchors it to the right side of the desktop menu */
    background: transparent; 
    border: 1px solid var(--panel-border); 
    color: var(--accent); 
    width: 30px; 
    height: 30px; 
    border-radius: 4px; 
    cursor: pointer; 
    z-index: 300; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Space Mono', monospace;
    font-size: 14px;
}

.zen-master-btn:hover {
    background: var(--btn-hover);
    box-shadow: 0 0 15px var(--accent);
}

/* The Collapsed "HUD" State */
.zen-master-btn.zen-collapsed {
    left: 20px !important; /* Moves it to the far left edge */
    width: 45px; /* Widens to fit the text */
    background: rgba(0,0,0,0.8);
}

/* Mobile Alignment */
@media (max-width: 768px) {
    .zen-master-btn {
        left: auto;
        right: 25px; /* On mobile, the menu is 100% width, so pin it to the right */
    }
}

/* =========================================
   META-VISUALIZER SYSTEM PROFILE OVERLAYS
   ========================================= */
.bar-physical { background: linear-gradient(to top, #10b981, #34d399); }
.bar-risk { background: linear-gradient(to top, #f43f5e, #fb7185); }
.bar-satellite { background: linear-gradient(to top, #3b82f6, #60a5fa); }

.bar-tooltip { cursor: crosshair; }
.bar-tooltip:hover { filter: brightness(1.2) saturate(1.2); z-index: 100; }

.bar-tooltip:hover::after {
    content: attr(data-title);
    position: absolute;
    bottom: calc(100% + 12px); 
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
    z-index: 200;
    border: 1px solid #475569;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    opacity: 1;
}

.bar-tooltip:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: #475569 transparent transparent transparent;
    z-index: 200;
    pointer-events: none;
}

/* Scaling Switch Mechanics */
.toggle-checkbox:checked { right: 0; border-color: #3b82f6; }
.toggle-checkbox:checked + .toggle-label { background-color: #3b82f6; }

/* =========================================
   MOBILE INVISIBLE GLASS FIX 
   ========================================= */
.hud-panel:not(.active), 
#metric-legend:not(.active),
#ui-layer[style*="translateX(-100%)"] {
    pointer-events: none !important;
    touch-action: none !important;
}