/* 
   LumaHUB - Shadcn/Zinc Design System (v5.0-dev)
*/

:root {
    /* Luma Aerials Authentic Desktop Brand (Dark Copper) */
    --bg-background: #0D0A08;
    --bg-header: #0D0A08;
    --bg-side: rgba(13, 10, 8, 0.85);
    --bg-muted: #1A1008;

    --border: #2E1A0E;

    --text: #F5EDE6;
    --text-muted: #8C7060;

    --accent: #C8764A;
    --accent-glow: rgba(200, 118, 74, 0.2);

    --radius: 4px;
    --font-sans: 'Outfit', 'Inter', system-ui, sans-serif;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    background: var(--bg-background);
    color: var(--text);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    /* Crisper text */
}

/* Header */
/* FLOATING ISLAND HEADER */
.main-header {
    position: absolute;
    top: 24px;
    left: 24px;
    /* transform: translateX(-50%); REMOVED */
    width: auto;
    min-width: 400px;
    height: 64px;
    /* Taller */
    background: rgba(9, 9, 11, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 100px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 5000;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

.logo {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-right: 24px;
    border-right: 1px solid var(--border);
}

.logo img {
    height: 48px !important;
    width: auto;
}

.logo-icon {
    color: var(--accent);
    font-size: 24px;
}

.brand-name {
    font-weight: 600;
    font-size: 18px;
    color: var(--text);
    letter-spacing: -0.5px;
    /* Inter Tight tracking */
}

.header-center {
    flex: 1;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    /* 14px */
    font-weight: 500;
    text-transform: none;
    /* Sentence case is cleaner */
}

/* Layout Grid */
/* FLOATING LAYOUT */
.main-layout {
    display: block;
    /* No flex, allowing absolute pos */
    width: 100vw;
    height: 100vh;
}

.sidebar-nav {
    position: absolute;
    top: 104px;
    left: 24px;
    bottom: 24px;
    width: 260px;

    background: var(--bg-overlay, rgba(9, 9, 11, 0.85));
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px;
    z-index: 4000;

    padding: 24px 16px;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

.sidebar-data {
    /* For right sidebar, we handle pos later or here? Reuse same style? */
    background: var(--bg-side);
    border-left: 1px solid var(--border);
}

.view-shell {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
    /* Behind panels */
}

.viewport {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* Nav Groups */
.nav-section {
    margin-bottom: 32px;
}

.nav-section h3 {
    font-size: 0.75rem;
    /* 12px */
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
    border-bottom: none;
    /* Remove underline */
    padding-bottom: 0px;
    padding-left: 12px;
    /* Align with items */
}

.nav-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    /* Gap between items */
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.875rem;
    /* 14px */
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item:hover {
    background: var(--bg-muted);
    color: var(--text);
}

.nav-item.active {
    background: var(--bg-muted);
    color: var(--text);
    border-left: none;
    /* Remove old style */
    box-shadow: inset 2px 0 0 0 var(--accent);
    /* Subtle indicator or just text color */
}

/* Icon size tweak */
.nav-item .material-symbols-outlined {
    font-size: 20px;
}

/* Map HUD */
#map {
    width: 100%;
    height: 100%;
}

.hud-box {
    position: absolute;
    top: 24px;
    left: 24px;
    z-index: 1000;
    background: var(--bg-side);
    /* Glass */
    backdrop-filter: blur(8px);
    padding: 16px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    min-width: 180px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    /* Soft Shadow */
}

#hud-type {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#hud-results {
    font-size: 1.5rem;
    /* 24px */
    font-weight: 600;
    color: var(--text);
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
    /* Align numbers */
}

/* Media Portal */
.media-header {
    display: flex;
    align-items: center;
    gap: 20px;
    background: var(--bg-header);
    padding: 16px 32px;
    border-bottom: 1px solid var(--border);
}

.tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-muted);
    padding: 4px;
    border-radius: var(--radius);
}

.tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 6px 16px;
    border-radius: 4px;
    /* Integrated radius */
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.tab.active {
    background: var(--bg-background);
    /* Surface */
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-close-view {
    margin-left: auto;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.btn-close-view:hover {
    background: var(--bg-muted);
}

.media-body {
    padding: 40px;
    height: calc(100% - 73px);
    /* Adj for header */
    overflow-y: auto;
    background: var(--bg-background);
}

.player-wrapper {
    max-width: 900px;
    margin: 0 auto 40px;
}

#main-video {
    width: 100%;
    max-height: 500px;
    background: #000;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

#video-info-text {
    margin-top: 20px;
    font-size: 1.25rem;
    color: var(--text);
    font-weight: 500;
}

.asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.asset-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-muted);
    transition: all 0.2s ease;
}

.asset-card:hover {
    border-color: var(--text-muted);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.asset-card img,
.asset-card video {
    width: 100%;
    height: 130px;
    object-fit: cover;
}

.asset-card .label {
    padding: 12px;
    font-size: 11px;
    color: #666;
    text-align: center;
    background: #111;
}

/* Status & Sidebar Tools */
.data-group {
    margin-bottom: 40px;
}

.data-group h3 {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 15px;
    border-bottom: 1px solid #222;
    padding-bottom: 5px;
}

.row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 10px;
}

.row span:first-child {
    color: var(--text-muted);
}

.footer-status {
    margin-top: auto;
    padding: 20px;
    background: #000;
    border-top: 1px solid var(--border);
}

.elev-display {
    font-size: 18px;
    font-weight: bold;
    color: var(--accent);
    font-family: monospace;
}

/* Overlay & Utils */
.screen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ring {
    width: 50px;
    height: 50px;
    border: 4px solid #111;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.btn-outline {
    background: none;
    border: 1px solid #333;
    color: #555;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: 0.2s;
}

.btn-outline:hover {
    color: #fff;
    border-color: #666;
}

.hidden {
    display: none !important;
}

/* Remove close button */
.leaflet-popup-close-button {
    display: none !important;
}

/* ========================================================================= */
/* 8. MipMap Inline Measurement Labels                                       */
/* ========================================================================= */
.map-label-ft {
    background: transparent !important;
    border: none !important;
    color: #00ffcc;
    font-weight: 800;
    font-size: 14px;
    padding: 0;
    box-shadow: none !important;
    text-shadow: 1px 1px 2px #000, -1px -1px 2px #000, 1px -1px 2px #000, -1px 1px 2px #000, 0px 2px 4px rgba(0, 0, 0, 0.8);
    /* Let clicks pass through to the line */
}

/* Hide the small triangle pointer that Leaflet adds to tooltips */
.map-label-ft::before {
    display: none !important;
}

/* Integrated 3D Viewport */
.pc-ui-bar {
    height: 48px;
    /* Taller touch target */
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.pc-ui-bar button {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 16px;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.pc-ui-bar button:hover {
    background: var(--bg-muted);
    border-color: var(--text-muted);
}

/* Basemap Floating Controls */
#map {
    background: var(--bg-background);
}

.basemap-group {
    position: absolute;
    top: 24px;
    right: 24px;
    z-index: 999;
    display: flex;
    gap: 8px;
    background: var(--bg-side);
    backdrop-filter: blur(8px);
    padding: 8px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.basemap-group button {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s;
}

.basemap-group button:hover {
    background: var(--bg-muted);
    color: var(--text);
    border-color: var(--border);
}

.basemap-group button span {
    font-size: 20px;
}

/* 3D Viewer Branding Overlay */
.pc-brand-label {
    position: absolute;
    bottom: 24px;
    left: 24px;
    z-index: 10;
    color: var(--text-muted);
    font-weight: 600;
    font-family: var(--font-sans);
    pointer-events: none;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    opacity: 0.6;
}

/* Collapsible Sidebar */
/* Collapsible Floating Right Sidebar */
.sidebar-data {
    position: absolute;
    top: 88px;
    right: 24px;
    bottom: 24px;
    width: 280px;

    background: var(--bg-overlay, rgba(9, 9, 11, 0.85));
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px;
    z-index: 2000;

    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), padding 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: visible;
}

.sidebar-data.collapsed {
    width: 0 !important;
    padding: 0 !important;
    border: none !important;
    overflow: visible !important;
}

.sidebar-data.collapsed>*:not(.toggle-btn) {
    display: none;
}

.toggle-btn {
    position: absolute;
    left: -32px;
    /* Slightly more gap */
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 64px;
    background: var(--bg-side);
    /* Match sidebar */
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-right: none;
    /* Connect to sidebar */
    border-radius: var(--radius) 0 0 var(--radius);
    cursor: pointer;
    color: var(--accent);
    /* Icon color */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 2001;
    box-shadow: -4px 0 10px -2px rgba(0, 0, 0, 0.1);
    transition: color 0.2s;
}

.toggle-btn:hover {
    color: #fff;
    background: var(--bg-muted);
}

.sidebar-data.collapsed .toggle-btn {
    left: -32px;
}

/* Map Elevation HUD */
.map-elev-hud {
    position: absolute;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    background: var(--bg-side);
    backdrop-filter: blur(8px);
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.map-elev-hud .elev-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 2px;
}

#map-elev-value {
    font-size: 1.125rem;
    /* 18px */
    font-weight: 600;
    color: var(--accent);
    /* Keep accent for high value data */
    font-family: var(--font-sans);
    font-variant-numeric: tabular-nums;
}

/* Map Elevation Legend */
.map-elev-legend {
    position: absolute;
    bottom: 160px;
    right: 24px;
    z-index: 1000;
    background: var(--bg-side);
    backdrop-filter: blur(8px);
    padding: 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    min-width: 60px;
}

.map-elev-legend .legend-title {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    text-align: center;
}

.map-elev-legend .legend-bar {
    width: 16px;
    height: 140px;
    margin: 0 auto;
    border-radius: 4px;
    background: linear-gradient(to bottom, #fde725, #5ec962, #21918c, #3b528b, #440154);
}

.map-elev-legend .legend-labels {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 140px;
    position: absolute;
    right: 36px;
    top: 32px;
    font-size: 0.7rem;
    color: var(--text);
    font-weight: 600;
}

.map-elev-legend .legend-labels span {
    background: rgba(0, 0, 0, 0.4);
    padding: 1px 4px;
    border-radius: 2px;
    backdrop-filter: blur(2px);
}

/* Download Button in Sidebar */
.btn-download-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: #333;
    color: #ccc;
    text-decoration: none;
    padding: 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid #444;
}

.btn-download-all:hover {
    background: #444;
    color: #fff;
    border-color: var(--accent);
}

.btn-download-all .material-symbols-outlined {
    font-size: 16px;
}