/*
==================================================
AETHERIC INTERFACE DESIGN SYSTEM V2.5
==================================================
*/

/* --- FONT IMPORT --- */
@import url('https://fonts.googleapis.com/css2?family=Exo:wght@300;400;500;700&display=swap');

/* --- THEME VARIABLES --- */
:root {
    --font-family-base: 'Exo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-base: 16px;

    /* Dark Theme */
    --theme-bg-primary: hsl(225, 10%, 12%);
    --theme-bg-secondary: hsla(225, 10%, 18%, 0.9);
    --theme-text-primary: hsl(210, 15%, 90%);
    --theme-text-secondary: hsl(210, 15%, 60%);
    --theme-border-color: hsla(225, 10%, 40%, 0.5);
    --theme-accent-primary: #00d9ff;
    /* Cyan */
    --theme-accent-glow: 0 0 5px rgba(0, 217, 255, 0.2);
    --theme-glass-backdrop: blur(8px);
    --theme-input-bg: hsla(0, 0%, 0%, 0.3);
}

body.light-theme {
    --theme-bg-primary: hsl(210, 20%, 98%);
    --theme-bg-secondary: hsla(0, 0%, 100%, 0.9);
    --theme-text-primary: hsl(210, 10%, 25%);
    --theme-text-secondary: hsl(210, 10%, 50%);
    --theme-border-color: hsla(210, 20%, 80%, 0.5);
    --theme-accent-glow: 0 0 10px hsla(180, 100%, 40%, 0.2);
    --theme-input-bg: hsla(210, 10%, 90%, 0.5);
}

/* --- RESETS --- */
body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    font-family: var(--font-family-base);
    background-color: var(--theme-bg-primary);
    color: var(--theme-text-primary);
    transition: background-color 0.3s, color 0.3s;
}

* {
    box-sizing: border-box;
}

a {
    color: var(--theme-accent-primary);
    text-decoration: none;
    transition: all 0.2s;
}

a:hover {
    text-decoration: underline;
    text-shadow: var(--theme-accent-glow);
}

/* --- UTILITIES --- */
.hidden {
    display: none !important;
}

/* --- LAYOUT OVERHAUL: FULL SCREEN --- */
.app-container {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: relative;
    background-color: var(--theme-bg-primary);
}

#map-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    /* Background Layer */
}

/* --- TOP NAVIGATION BAR --- */
.top-nav-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 64px;
    z-index: 100;
    /* Floating above map */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: linear-gradient(to bottom, rgba(10, 15, 30, 0.9) 0%, rgba(10, 15, 30, 0.6) 80%, rgba(10, 15, 30, 0) 100%);
    pointer-events: none;
    /* Allow clicks to pass through empty spaces */
}

.top-nav-bar>* {
    pointer-events: auto;
    /* Re-enable for controls */
}

.nav-left,
.nav-center,
.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-center {
    flex-grow: 1;
    justify-content: center;
    max-width: 500px;
}

/* Branding */
.branding {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--theme-accent-primary);
    font-weight: 700;
    letter-spacing: 1px;
    margin-right: 16px;
}

.text-light {
    color: #fff;
}

/* View Toggles */
.view-toggles {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 2px;
    backdrop-filter: blur(4px);
}

.nav-tab {
    background: transparent;
    border: none;
    color: var(--theme-text-secondary);
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-tab.active {
    background: var(--theme-accent-primary);
    color: #000;
    box-shadow: 0 0 10px rgba(0, 217, 255, 0.3);
}

/* Search Inputs (Tailwind-like) */
.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-wrapper i {
    position: absolute;
    left: 10px;
    width: 16px;
    height: 16px;
    color: var(--theme-text-secondary);
}

.search-wrapper input {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--theme-border-color);
    color: var(--theme-text-primary);
    padding: 8px 12px 8px 36px;
    border-radius: 8px;
    font-size: 14px;
    backdrop-filter: blur(4px);
    transition: all 0.2s;
    width: 220px;
}

.location-search input {
    width: 100%;
    min-width: 300px;
    border-color: rgba(0, 217, 255, 0.3);
    background: rgba(0, 0, 0, 0.6);
}

.search-wrapper input:focus {
    outline: none;
    border-color: var(--theme-accent-primary);
    background: rgba(0, 0, 0, 0.8);
    box-shadow: 0 0 0 2px rgba(0, 217, 255, 0.2);
}

/* User Menu */
.user-avatar-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--theme-border-color);
    background: transparent;
    color: var(--theme-text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.user-avatar-btn:hover {
    border-color: var(--theme-accent-primary);
    background: rgba(0, 217, 255, 0.1);
}

.dropdown-menu {
    position: absolute;
    top: 55px;
    right: 0;
    width: 260px;
    background: var(--theme-bg-secondary);
    border: 1px solid var(--theme-border-color);
    border-radius: 8px;
    padding: 0;
    /* Content injected */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(16px);
    overflow: hidden;
}

/* BOTTOM HUD */
.bottom-hud {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 95%;
    /* Responsive width */
    max-width: 1200px;
    height: 50px;
    z-index: 90;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
}

.bottom-hud>* {
    pointer-events: auto;
}

.hud-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

.hud-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    /* Smoother rounding */
    background: rgba(18, 22, 36, 0.85);
    border: 1px solid var(--theme-border-color);
    color: var(--theme-text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.hud-btn:hover {
    background: var(--theme-accent-primary);
    color: #000;
    transform: translateY(-2px);
}

#coord-display {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--theme-border-color);
    padding: 6px 16px;
    border-radius: 20px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: var(--theme-accent-primary);
    backdrop-filter: blur(4px);
    pointer-events: auto;
}

#layer-tree-container {
    position: absolute;
    bottom: 80px;
    /* Moved up slightly */
    left: 24px;
    width: 500px;
    /* Wider for 2 columns */
    /* Toggled by JS via .hidden class */
    background: var(--theme-bg-secondary);
    border: 1px solid var(--theme-border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(16px);
    max-height: 500px;
    overflow-y: auto;

    /* Grid Layout */
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

#layer-tree-control {
    display: contents;
    /* Allow children to participate in grid */
}

/* Header spans both columns */
#layer-tree-control>.overlay-title {
    grid-column: 1 / -1;
    margin-top: 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--theme-border-color);
    padding-bottom: 8px;
    font-size: 16px;
    letter-spacing: 1px;
    color: var(--theme-accent-primary);
}

.layer-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.layer-group-title {
    margin: 0 0 8px 0;
    font-size: 13px;
    text-transform: uppercase;
    color: var(--theme-text-secondary);
    font-weight: 700;
}

.layer-option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    color: var(--theme-text-primary);
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.layer-option:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Dynamic Legend Reposition */
#dynamic-legend {
    position: absolute;
    bottom: 80px;
    right: 0;
    /* Styles retained from prev, just repositioned */
}

/* WIKI OVERLAY (Glass Full Screen) */
.glass-overlay {
    position: absolute;
    top: 64px;
    /* Below Top Bar */
    left: 0;
    width: 100%;
    height: calc(100% - 64px);
    background: rgba(10, 15, 30, 0.85);
    backdrop-filter: blur(12px);
    z-index: 50;
    /* Below Nav, Above Map */
    padding: 40px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#wiki-content {
    width: 100%;
    max-width: 900px;
    background: transparent;
    /* Remove card bg */
}

.wiki-header {
    width: 100%;
    max-width: 900px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--theme-border-color);
    padding-bottom: 16px;
}

/* REPORT MODAL (Sophisticated) */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content.glass-panel {
    background: linear-gradient(135deg, rgba(20, 25, 40, 0.95), rgba(10, 15, 25, 0.98));
    border: 1px solid var(--theme-border-color);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    width: 600px;
    max-width: 90%;
    border-radius: 12px;
    overflow: hidden;
    animation: modalSlideUp 0.3s ease-out;
}

@keyframes modalSlideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background: rgba(255, 255, 255, 0.03);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--theme-border-color);
}

.modal-body {
    padding: 24px;
}

.form-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--theme-text-secondary);
    font-weight: 600;
}

.form-group.full {
    width: 100%;
}

.form-group.half {
    width: calc(50% - 8px);
}

.form-group.third {
    width: calc(33.33% - 11px);
}

/* Suggestions Dropdown */
.suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--theme-bg-secondary);
    border: 1px solid var(--theme-border-color);
    border-radius: 8px;
    margin-top: 6px;
    list-style: none;
    /* Reset */
    padding: 0;
    max-height: 200px;
    overflow-y: auto;
    z-index: 101;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.suggestions-dropdown li {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 14px;
    color: var(--theme-text-primary);
}

.suggestions-dropdown li:hover {
    background: rgba(0, 217, 255, 0.1);
    color: var(--theme-accent-primary);
}