@charset "UTF-8";
/* Google Fonts loaded via <link> in HTML with font-display=swap */

:root {
    --primary-color: #4a90e2;
    --text-light: #f5f5f5;
    --left-panel-width: 220px;
    --glass-bg-90: rgba(30, 30, 30, 0.9);
    --glass-bg-95: rgba(30, 30, 30, 0.95);
    --glass-bg-60: rgba(30, 30, 30, 0.6);
    --glass-border-18: 1px solid rgba(255, 255, 255, 0.18);
    --glass-border-10: 1px solid rgba(255, 255, 255, 0.1);
    --glass-shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.5);
    --glass-shadow-md: 0 4px 15px rgba(0, 0, 0, 0.5);
    --glass-blur-20: 20px;
    --glass-blur-15: 15px;
    --glass-blur-10: 10px;
    --br-control-h: 32px;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
    background-color: #111;
    color: var(--text-light);
}

/* Disable text selection on UI chrome only, not globally */
#map,
#navbar,
#navbar-popup,
#left-panels,
.bottom-right-container,
.weather-panel,
.modal-panel,
#search-overlay,
#settings-panel,
#loading-chip {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

img,
svg {
    -webkit-user-drag: none;
}

::selection {
    background: transparent;
    color: inherit;
}

::-moz-selection {
    background: transparent;
    color: inherit;
}

#map {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
    transition: bottom 0.3s ease-in-out;
}

#map .maplibregl-canvas-container.maplibregl-interactive {
    cursor: default !important;
}

#map .maplibregl-canvas-container.maplibregl-interactive:active {
    cursor: grabbing !important;
}

/* --- Navbar --- */
#navbar {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    min-width: auto;
    height: 50px;
    background: var(--glass-bg-90);
    backdrop-filter: blur(var(--glass-blur-15));
    border-radius: 24px;
    display: flex;
    align-items: center;
    padding: 0 10px 0 20px;
    box-shadow: var(--glass-shadow-lg);
    z-index: 100;
    border: var(--glass-border-18);
    gap: 15px;
    transition: opacity 0.2s;
}

#navbar.hidden {
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 768px) {
    #navbar,
    #navbar.collapsed {
        left: 20px !important;
        transform: none !important;
        width: 50px !important;
        min-width: 50px !important;
        height: 50px !important;
        padding: 0 !important;
        border-radius: 0 !important;
        gap: 0;
        justify-content: center;
        overflow: hidden;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
    }

    #navbar .logo {
        margin-right: 0;
        gap: 0;
    }

    #navbar .logo span {
        display: none;
    }

    #navbar .logo img {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        display: block;
        object-fit: cover;
    }

    #navbar .nav-divider,
    #navbar .nav-btn,
    #navbar .search-mock-input {
        display: none !important;
    }

    #navbar.collapsed ~ #navbar-popup {
        left: 20px;
        transform: translateY(-10px);
    }
    #navbar.collapsed ~ #navbar-popup.active {
        transform: translateY(0);
    }
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
    color: white;
    margin-right: 5px;
    white-space: nowrap;
}

.logo img {
    height: 24px;
}

.nav-divider {
    width: 1px;
    height: 20px;
    background: rgba(255,255,255,0.2);
}

.nav-btn {
    width: auto;
    height: 32px;
    border-radius: 16px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    transition: all 0.2s;
    gap: 0;
}

.nav-btn i {
    display: none;
}

.nav-btn span {
    font-size: 14px;
    font-weight: 400;
    white-space: nowrap;
    color: white;
}

.nav-btn:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}

.search-mock-input {
    width: 160px;
    height: 36px;
    background: rgba(255,255,255,0.1);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between; /* Space out items */
    padding: 0 10px;
    color: #aaa;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
    margin-left: auto; /* Push to right */
    margin-right: 0;
}

/* --- Collapsed Navbar Styles --- */
#navbar.collapsed {
    cursor: pointer;
    padding: 0 16px;
    justify-content: center;
    gap: 12px;
    width: auto;
    min-width: auto;
    left: 20px;
    right: auto;
    transform: none;
    overflow: visible;
}

#navbar.collapsed .nav-divider,
#navbar.collapsed .nav-btn,
#navbar.collapsed .search-mock-input {
    display: none !important;
}

#navbar.collapsed .logo {
    margin-right: 0;
    pointer-events: none; /* Make logo not capture clicks separately if needed, but navbar handles it */
}

/* --- Navbar Popup --- */
#navbar-popup {
    position: absolute;
    top: 80px; /* Below navbar (20px top + 50px height + 10px gap) */
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    width: 50px; /* Match navbar height or icon size */
    background: var(--glass-bg-60);
    backdrop-filter: blur(var(--glass-blur-15));
    border-radius: 18px;
    display: none; /* Hidden by default */
    flex-direction: column;
    align-items: center;
    padding: 10px 0;
    gap: 10px;
    box-shadow: var(--glass-shadow-lg);
    z-index: 102; /* Above navbar */
    border: var(--glass-border-18);
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
}

#navbar-popup.active {
    display: flex;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

#navbar.collapsed ~ #navbar-popup {
    left: 20px;
    transform: translateY(-10px);
}

#navbar.collapsed ~ #navbar-popup.active {
    transform: translateY(0);
}

.popup-item {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.popup-item:hover {
    background: rgba(255,255,255,0.1);
}

.collapsed-download-btn {
    display: none;
    position: absolute;
    top: 20px;
    left: 86px;
    height: 50px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #0a2e52;
    backdrop-filter: blur(var(--glass-blur-15));
    color: #fff;
    border: var(--glass-border-18);
    border-radius: 24px;
    box-shadow: none;
    padding: 0 20px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    z-index: 99;
}
.collapsed-download-btn:hover {
    background: #0d3f6e;
}
.collapsed-download-btn i {
    font-size: 14px;
}

#navbar.collapsed ~ .collapsed-download-btn {
    display: flex;
}

@media (max-width: 768px) {
    .collapsed-download-btn {
        left: 50%;
        transform: translateX(-50%);
    }
}

/* --- Search Overlay --- */
#search-overlay {
    position: absolute;
    /* Position will be set by JS */
    width: auto;
    min-width: 400px; /* Reduced min-width to fit better if needed */
    height: auto;
    background: transparent;
    z-index: 101;
    display: none;
    flex-direction: column;
    box-sizing: border-box;
}

#search-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.search-input-wrapper-large {
    display: flex;
    align-items: center;
    background: var(--glass-bg-90);
    backdrop-filter: blur(var(--glass-blur-15));
    border-radius: 18px; /* Match navbar radius */
    padding: 0 20px;
    height: 50px; /* Match navbar height */
    border: var(--glass-border-18);
    box-shadow: var(--glass-shadow-lg);
    width: 100%;
    box-sizing: border-box;
}

.search-input-wrapper-large i {
    color: #aaa;
    margin-right: 10px;
}

.search-input-wrapper-large input {
    background: transparent;
    border: none;
    color: white;
    font-size: 16px;
    width: 100%;
    outline: none;
    height: 100%;
}

.search-input-wrapper-large .close-search {
    cursor: pointer;
    color: #aaa;
    width: 28px;
    height: 28px;
    margin-left: 10px;
    margin-right: -8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}

.search-input-wrapper-large .close-search:hover {
    color: white;
    background: transparent;
}

.search-results-container {
    margin-top: 10px;
    background: var(--glass-bg-95);
    backdrop-filter: blur(var(--glass-blur-20));
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.18);
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    box-sizing: border-box;
}

.search-results-container::-webkit-scrollbar { width: 0; height: 0; }

/* --- Custom Marker --- */
.ripple-marker {
    width: 32px;
    height: 32px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    /* The marker is a read-out, not a control: let map clicks fall through the
       whole 32px box so a tap next to the dot still places a new point. */
    pointer-events: none;
}

.ripple-marker .dot {
    width: 14px;
    height: 14px;
    background-color: #ff5500; /* Active Layer Color (Orange) */
    border: 3px solid #ffffff; /* White border */
    border-radius: 50%;
    box-shadow: 0 0 9px rgba(0,0,0,0.4);
    z-index: 2;
}

.ripple-marker .ripple {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 1px solid rgba(255, 255, 255, 0.9);
    background-color: rgba(255, 255, 255, 1);
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0) 100%);
    border-radius: 50%;
    opacity: 0;
    animation: ripple-anim 2s infinite ease-out;
    box-sizing: border-box;
}

@keyframes ripple-anim {
    0% {
        transform: scale(0.1);
        opacity: 1;
    }
    100% {
        transform: scale(2.0); /* Increased radius */
        opacity: 0;
    }
}

/* Reuse existing search list styles but adapt */
.search-section {
    margin-bottom: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #888;
    margin-bottom: 10px;
    text-transform: uppercase;
    font-weight: 600;
}

.edit-link {
    color: var(--primary-color);
    text-decoration: none;
}

.search-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.search-item:hover {
    background: rgba(255,255,255,0.05);
}

.item-icon {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 12px;
}

.item-icon.star { color: #f1c40f; }

.item-info {
    flex: 1;
}

.item-title {
    font-size: 14px;
    color: #ddd;
}

.item-title .sub {
    color: #888;
    font-size: 12px;
}

/* --- Bottom Right Container --- */
.bottom-right-container {
    position: absolute;
    bottom: 10px; /* Moved down by 5px (was 20px) */
    right: 20px;
    display: flex;
    flex-direction: column-reverse; /* Stack from bottom to top */
    gap: 15px; /* Consistent gap between all elements */
    align-items: flex-end; /* Align to right */
    z-index: 20;
    pointer-events: none; /* Let clicks pass through container */
}

.bottom-right-container > * {
    pointer-events: auto; /* Re-enable clicks on children */
    position: static !important; /* Reset absolute positioning */
    margin: 0 !important;
}

/* --- Map Controls (Bottom Right) --- */
#map-controls {
    /* Position handled by container */
    display: flex;
    flex-direction: row; /* Horizontal layout */
    gap: 8px;
    z-index: 20;
}

.control-btn {
    width: var(--br-control-h);
    height: var(--br-control-h);
    border-radius: calc(var(--br-control-h) / 2); /* Match Navbar radius */
    background: var(--glass-bg-90);
    backdrop-filter: blur(var(--glass-blur-10));
    border: var(--glass-border-10);
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    transition: background 0.2s;
}

.control-btn:hover {
    background: rgba(50, 50, 50, 0.9);
}

/* --- Model Tab (Bottom Right) --- */
#model-tab {
    /* Position handled by container */
    z-index: 20;
    min-height: 0; /* Allow collapse */
}

#model-tab:empty {
    display: none;
}

#model-tab #model-selector .segment-control {
    background: var(--glass-bg-90);
    backdrop-filter: blur(var(--glass-blur-10));
    border: var(--glass-border-10);
    width: auto; /* Allow auto width */
    min-width: fit-content;
    height: var(--br-control-h);
    border-radius: calc(var(--br-control-h) / 2);
    padding: 0;
    overflow: hidden;
    display: flex; /* Ensure flex layout */
    gap: 0;
}

#model-tab #model-selector .segment-option {
    flex: 0 0 auto; /* Don't grow/shrink aggressively */
    height: 100%;
    padding: 0 14px;
    min-width: auto; /* Remove min-width constraint */
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: calc(var(--br-control-h) / 2);
}

/* --- Legends (Bottom Left) --- */
#legends {
    position: absolute;
    bottom: 10px;
    left: 20px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
    pointer-events: none;
}

#legends > * {
    pointer-events: auto;
}

.legend {
    pointer-events: auto;
}

.legend-bar {
    position: relative;
    height: var(--br-control-h);
    border-radius: calc(var(--br-control-h) / 2);
    border: 1px solid rgba(255, 255, 255, 0.8);
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    background: rgba(0,0,0,0.3);
}

.gradient {
    height: 100%;
    /* width is set via JS */
}

.legend-labels {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    box-sizing: border-box;
}

.legend-labels span {
    font-size: 12px;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
}

/* Map Controls Repositioning when Panel Open */
.weather-panel-open .bottom-right-container {
    transform: translateY(-30vh);
    transition: transform 0.3s ease-in-out;
}

@media (max-width: 768px) {
    .modal-panel {
        left: var(--navbar-edge-gap, 20px);
        right: var(--navbar-edge-gap, 20px);
        width: auto;
        max-width: none;
        transform: none;
    }

    #search-overlay {
        left: var(--navbar-edge-gap, 20px) !important;
        right: var(--navbar-edge-gap, 20px) !important;
        width: auto !important;
        min-width: 0 !important;
    }

    .search-results-container {
        width: 100%;
        box-sizing: border-box;
    }

    #legends {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        width: 100vw;
        padding: 0;
        margin: 0;
        align-items: stretch;
        gap: 0;
        z-index: 90;
    }

    #legends .legend {
        width: 100%;
    }

    #legends .legend-bar {
        width: 100%;
        height: calc(var(--br-control-h) * 2 / 3);
        border-radius: 0;
        border: none;
        box-shadow: none;
        background: transparent;
    }

    #legends .gradient {
        width: 100% !important;
        border-radius: 0;
    }
}

/* Ensure map height adjusts */

/* --- Left Panel (Layer Panel) --- */
/* Rename/Generalize to Side Panel but keep class for compatibility */
.left-panel {
    position: absolute;
    /* top and bottom will be set by JS */
    right: 20px;
    width: var(--left-panel-width);
    background: var(--glass-bg-60);
    backdrop-filter: blur(var(--glass-blur-15));
    border-radius: 18px; /* Match Navbar radius */
    padding: 0;
    box-shadow: var(--glass-shadow-lg);
    overflow: hidden;
    color: white;
    transition: none; /* No animation for panel expand/collapse */
    z-index: 10;
    border: var(--glass-border-18);
    display: flex;
    flex-direction: column;
}

/* Specific Styles for Layer Panel (Now on Right) */
#layers-panel {
    /* Position is inherited from .left-panel */
    /* Width is inherited from .left-panel */
    /* All other properties are inherited */
}

/* Layer Panel Content */
#layers-panel .left-panel-content {
    flex: 1;
    overflow-y: auto; /* Enable vertical scrolling */
    overflow-x: hidden;
    padding: 20px; /* Increased padding */
    display: flex;
    flex-direction: column; /* Stack items vertically */
    /* justify-content: space-between;  Removed to allow natural flow */
    gap: 10px; /* Reduced gap between sections */
    min-height: 0; /* CRITICAL for flex child scrolling */
}

#layers-panel .left-panel-content::-webkit-scrollbar { width: 0; height: 0; }

/* Container for Grid Items */
.layer-grid-container {
    display: flex; /* Changed from grid to flex to support auto-width items */
    flex-wrap: wrap; /* Wrap items if they overflow horizontally */
    justify-content: center; /* Center items to ensure equal whitespace */
    gap: 8px; /* Reduced gap between items */
    flex-shrink: 0; /* Prevent container from shrinking below content size */
    /* flex: 1; Removed to let it size naturally */
    /* min-height: 0; Removed */
}

/* Layer Items */
.menu-item {
    width: 100%; /* Full width to match particle items */
    height: auto;
    min-height: 40px; /* Reduced minimum height */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    padding: 0;
    margin: 0;
}

.menu-item:not(.particle-item) > label {
    display: flex;
    flex-direction: row; /* Horizontal Layout: Icon + Text */
    align-items: center;
    justify-content: flex-start; /* Left align content */
    gap: 12px; /* Increased space between icon and text */
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    cursor: pointer;
    transition: none;
    position: relative;
}

.menu-item i {
    width: auto;
    margin-right: 0;
    margin-bottom: 0; /* Removed bottom margin since it's horizontal now */
    font-size: 16px; /* Slightly smaller icon for horizontal layout */
}

.menu-item span {
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap; /* Prevent text wrapping if possible */
}

.menu-item:not(.particle-item) span {
    font-size: 13px; /* Slightly larger for base layers */
}

.menu-item:not(.particle-item) > label:hover {
    background: rgba(255, 255, 255, 0.1);
}

.layer-toggle:checked + label {
    background: #ff5500 !important; /* Active state */
    color: white;
    box-shadow: 0 2px 8px rgba(255, 85, 0, 0.4);
}

.check-icon {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 12px;
    color: white;
    opacity: 0;
    transition: none;
    pointer-events: none;
}

.layer-toggle:checked + label .check-icon {
    opacity: 1;
}






/* Layer Panel Header */
.layer-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    cursor: pointer;
}

.layer-panel-header .header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
}

.layer-panel-header .collapse-icon {
    color: #aaa;
    transition: all 0.2s ease;
    width: 28px; /* Slightly larger */
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.layer-panel-header .collapse-icon:hover {
    background-color: rgba(255, 255, 255, 0.1); /* Lighter/Subtle background */
    color: white;
}

/* --- Modal Panels --- */
.modal-panel {
    position: fixed;
    top: calc(var(--navbar-bottom, 70px) + 15px);
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    background: var(--glass-bg-90);
    backdrop-filter: blur(var(--glass-blur-15));
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 200;
    display: none;
    flex-direction: column;
    border: var(--glass-border-18);
    animation: fadeIn 0.2s ease-out;
    max-height: calc(100vh - var(--navbar-bottom, 70px) - 30px);
    overflow-y: hidden;
    box-sizing: border-box;
}

.modal-panel::-webkit-scrollbar { width: 0; height: 0; }

.search-results-container,
#layers-pannel .left-pannel-content,
.modal-panel {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.modal-panel.active {
    display: flex;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-panel .search-header {
    padding: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-panel h2 {
    font-size: 16px;
    margin: 0;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-content-modal {
    padding: 20px;
    color: #ccc;
    font-size: 14px;
    text-align: left; /* Align text left */
}

/* Feature List Styles */
.feature-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 10px;
}

.feature-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.feature-icon {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
}

.feature-text h4 {
    margin: 0 0 4px 0;
    color: white;
    font-size: 14px;
}

.feature-text p {
    margin: 0;
    font-size: 12px;
    color: #aaa;
    line-height: 1.4;
}

/* Download QR */
.qr-container {
    background: white;
    padding: 15px;
    border-radius: 12px;
    width: 140px;
    height: 140px;
    margin: 20px auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-placeholder {
    width: 100%;
    height: 100%;
    background: #000; /* Placeholder for actual QR */
    opacity: 0.1;
}

/* About Section */
.about-section {
    margin-bottom: 20px;
}

.about-label {
    font-size: 12px;
    color: #888;
    margin-bottom: 5px;
    text-transform: uppercase;
    font-weight: 600;
}

.about-value {
    color: white;
    font-size: 14px;
}

.social-links {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.social-link {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transition: all 0.2s;
}

.social-link:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
}

.item-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    flex-shrink: 0;
}

.item-info {
    flex: 1;
}

.item-title {
    color: white;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.item-info p {
    margin: 0;
    color: #aaa;
    font-size: 12px;
    line-height: 1.3;
}

.download-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.download-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    color: white;
    text-decoration: none;
    transition: background 0.2s;
}

.download-link:hover {
    background: rgba(255,255,255,0.2);
}



/* Menu Separator */
.menu-separator {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.1);
    margin: 10px 15px;
}

/* --- Settings Panel --- */
#settings-panel {
    position: fixed;
    top: calc(var(--navbar-bottom, 70px) + 15px);
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    background: rgba(30, 30, 30, 0.9);
    backdrop-filter: blur(20px); /* Stronger blur */
    border-radius: 24px;
    padding: 20px;
    z-index: 200;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.18);
    color: white;
    display: none;
    max-height: calc(100vh - var(--navbar-bottom, 70px) - 30px);
    overflow-y: auto;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    box-sizing: border-box;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#settings-panel::-webkit-scrollbar {
    width: 0;
    height: 0;
}

#settings-panel.active {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.search-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
}

.search-header .close-btn {
    cursor: pointer;
}

#download-panel .search-header {
    margin-bottom: 12px;
    padding-bottom: 8px;
}

.settings-section {
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 15px;
    border: 1px solid rgba(255,255,255,0.05);
}

.section-title {
    font-size: 13px;
    color: #bbb;
    margin: 10px 0 10px;
    font-weight: 600;
    padding-left: 5px;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    color: #eee;
    font-weight: 600;
    margin-bottom: 10px;
    padding-left: 5px;
}

.setting-label i {
    width: 20px;
    text-align: center;
    color: #ddd;
    font-size: 16px;
}

/* Segment Control */
.segment-control {
    background: rgba(0,0,0,0.25);
    border-radius: 20px; /* Pill shape */
    padding: 4px;
    display: flex;
    gap: 0;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(255,255,255,0.05);
}

.segment-option {
    flex: 1;
    padding: 8px 0;
    font-size: 13px;
    cursor: pointer;
    border-radius: 16px; /* Inner pill */
    color: #aaa;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
    z-index: 1;
}

.segment-option:hover:not(.active) {
    color: white;
    background: rgba(255,255,255,0.05);
}

.segment-option.active {
    background: #e0e0e0;
    color: #222;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* --- Weather Forecast Panel --- */
.weather-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    min-height: 100px;
    max-height: 45vh;
    height: auto;
    padding-bottom: 0;
    background: rgba(30, 30, 30, 0.85);
    backdrop-filter: blur(15px);
    z-index: 50;
    display: flex;
    flex-direction: column;
    border-top: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
    transition: transform 0.3s ease-in-out;
    border-radius: 0;
    overflow: hidden;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.weather-panel::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.panel-header {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: rgba(30, 30, 30, 0.85);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    border-radius: 0;
}

.location-info {
    color: #ddd;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.location-info span {
    margin-right: 15px;
}

/* Weather Panel Header Controls */
.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.close-btn, .icon-btn {
    cursor: pointer;
    color: #aaa;
    font-size: 18px;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.close-btn:hover, .icon-btn:hover {
    color: white;
    background: rgba(255,255,255,0.08);
}

.weather-panel .panel-content {
    flex-grow: 1;
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
    padding: 0;
    border-radius: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* Custom Scrollbar */
.weather-panel .panel-content::-webkit-scrollbar {
    height: 0;
}
.weather-panel .panel-content::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
}
.weather-panel .panel-content::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}
.weather-panel .panel-content::-webkit-scrollbar-thumb:hover {
    background: #777;
}

.forecast-cta {
    padding: 16px 0 0 0;
    border-top: 1px solid rgba(255,255,255,0.08);
    text-align: center;
}
.forecast-cta .cta-message {
    color: #aaa;
    font-size: 13px;
    margin: 0 0 12px 0;
}
.forecast-cta .cta-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}
.forecast-cta .store-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #111;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    padding: 6px 12px;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}
.forecast-cta .store-btn:hover {
    background: #222;
}
.forecast-cta .store-btn i {
    font-size: 16px;
}
.forecast-cta .store-btn .brand-icon {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

.modal-panel .panel-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.modal-panel .panel-content::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.forecast-scroll {
    min-width: 100%;
    display: inline-block;
}

#forecast-table {
    border-collapse: collapse;
    width: auto;
    margin: 0;
    color: #ddd;
    font-size: 11px;
}

#forecast-table th, #forecast-table td {
    padding: 6px 0;
    width: 60px;
    text-align: center;
    border: none;
    position: relative;
}

#forecast-table th.col-hover,
#forecast-table td.col-hover {
    border: none !important;
    box-shadow: inset 2px 0 0 0 #ff5500, inset -2px 0 0 0 #ff5500;
}

#forecast-table th.col-hover-top,
#forecast-table td.col-hover-top {
    border: none !important;
    box-shadow: inset 2px 0 0 0 #ff5500, inset -2px 0 0 0 #ff5500, inset 0 2px 0 0 #ff5500;
    border-radius: 6px 6px 0 0;
}

#forecast-table th.col-hover-bottom,
#forecast-table td.col-hover-bottom {
    border: none !important;
    box-shadow: inset 2px 0 0 0 #ff5500, inset -2px 0 0 0 #ff5500, inset 0 -2px 0 0 #ff5500;
    border-radius: 0 0 6px 6px;
}

/* Loading Chip */
#loading-chip {
    position: absolute;
    top: auto;
    bottom: 40px; /* Position at bottom */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    font-size: 14px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

#loading-chip.active {
    opacity: 1;
}

.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Layer List Items Base - Cleanup Duplicate Blocks */
.menu-item {
    position: relative;
}

.layer-toggle {
    display: none;
}

.menu-item i { width: 24px; text-align: center; }

/* Separator */
.menu-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.3);
    margin: 5px 0;
    width: 100%;
    flex-shrink: 0;
}

/* Collapsed State for Layer Panel */
#layers-panel.collapsed {
    /* Keep original positioning */
    /* top, left are controlled by JS/default CSS */
    bottom: auto;
    /* width: auto; Removed - controlled by JS inline style */
    /* min-width: 0; Removed - inherit from base class */
    height: auto !important; /* Force auto height */
    border-radius: 18px; /* Match Navbar radius */
    padding: 0;
    display: flex;
    flex-direction: column; /* Ensure vertical stacking */
    align-items: stretch;
    justify-content: flex-start;
    overflow: hidden;
    cursor: pointer;
    background: var(--glass-bg-60);
    box-shadow: var(--glass-shadow-md);
    transition: none !important;
    z-index: 95;
}

#layers-panel.collapsed .layer-panel-header {
    /* width: 100%; Removed to prevent overflow with padding */
    height: auto;
    padding: 12px 15px; /* Match original header padding */
    justify-content: space-between;
    border-bottom: 1px solid transparent; /* Maintain height occupied by border */
    gap: 0; /* Reset gap, use justify-content */
    box-sizing: border-box; /* Ensure padding doesn't add to width */
}

#layers-panel.collapsed .header-left {
    gap: 10px; /* Match original gap */
    flex: 1; /* Allow text to take available space */
    min-width: 0; /* Enable flex shrinking */
}

#layers-panel.collapsed .header-left i {
    /* Inherit font-size and margin to match expanded state */
    /* Only override color if needed, but if exact match is required, consider removing this too */
    color: #ff5500; /* Highlight color for selected icon */
    flex-shrink: 0; /* Prevent icon from shrinking */
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Ensure title and toggle are VISIBLE */
#layers-panel.collapsed .panel-title {
    display: block;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden; /* Handle overflow */
    text-overflow: ellipsis; /* Show ellipsis */
}

#layers-panel.collapsed .collapse-icon {
    display: flex;
    margin-left: 0; /* Remove margin to match default flex spacing */
    visibility: visible !important;
    opacity: 1 !important;
}

#layers-panel.collapsed .left-panel-content,
#layers-panel.collapsed .layer-panel-footer {
    display: none;
}

/* Hide the redundant Logo Panel */
#logo-pannel {
    display: none;
}

/* Ensure Section Titles span the full width */
.layer-section-title {
    width: 100%;
}

/* Particle List Override */
.layer-grid-container.particle-list {
    flex-direction: column;
    width: 100%;
    gap: 2px; /* Reduced gap */
}

/* Particle Item Styling */
.menu-item.particle-item {
    width: 100%;
    height: 40px; /* Reduced height for tighter spacing */
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    box-sizing: border-box;
    margin-bottom: 0;
}

.particle-info {
    display: flex;
    align-items: center;
    color: #ddd;
    font-size: 14px;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    margin-bottom: 0;
}

/* Hide default HTML checkbox */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* The slider */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #555;
    -webkit-transition: none;
    transition: none;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    -webkit-transition: none;
    transition: none;
}

input:checked + .slider {
    background-color: #ff5500; 
}

input:focus + .slider {
    box-shadow: 0 0 1px #ff5500;
}

input:checked + .slider:before {
    -webkit-transform: translateX(20px);
    -ms-transform: translateX(20px);
    transform: translateX(20px);
}

/* Rounded sliders */
.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* --- Download Panel Redesign --- */
#download-panel .panel-content.download-content {
    display: flex;
    flex-direction: column;
    padding: 16px 30px 30px;
    gap: 12px;
    align-items: center;
    text-align: center;
}

.download-content .app-info {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.download-content .app-logo-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.download-content .app-icon {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.download-content .app-title-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.download-content .app-title-group h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: #fff;
    line-height: 1.2;
}

.download-content .app-version {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.1);
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
    display: inline-block;
}

.download-content .app-description {
    font-size: 14px;
    line-height: 1.5;
    color: rgba(255,255,255,0.7);
    margin: 0;
    max-width: 320px; /* Limit text width for readability */
}

.download-content .store-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 8px;
    width: 100%;
}

.store-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #000;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    padding: 6px 10px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    text-decoration: none;
}

.store-btn:hover {
    background: #222;
    border-color: rgba(255,255,255,0.4);
    transform: translateY(-1px);
}

.store-btn i {
    font-size: 24px;
}

.store-btn .btn-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.store-btn .btn-text span {
    font-size: 10px;
    opacity: 0.8;
}

.store-btn .btn-text strong {
    font-size: 13px;
    font-weight: 600;
}

.store-btn .brand-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.store-btn.cn-only,
.store-btn.global-only {
    display: none;
}
.store-btn.cn-only.visible,
.store-btn.global-only.visible {
    display: flex;
}

@media (max-width: 600px) {
    .download-content .store-buttons {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .modal-panel {
        left: var(--navbar-edge-gap, 20px) !important;
        right: var(--navbar-edge-gap, 20px) !important;
        width: auto !important;
        max-width: none !important;
        transform: none !important;
    }

    #settings-panel {
        left: var(--navbar-edge-gap, 20px) !important;
        right: var(--navbar-edge-gap, 20px) !important;
        width: auto !important;
        transform: none !important;
    }

    #legends .legend-bar {
        height: calc(var(--br-control-h) * 4 / 9) !important;
    }

    #layers-panel.collapsed {
        border: none !important;
        width: 50px !important;
        min-width: 50px !important;
        max-width: 50px !important;
        height: 50px !important;
        border-radius: 50% !important;
        overflow: hidden;
    }

    #layers-panel.collapsed .layer-panel-header {
        height: 50px;
        padding: 0;
        border-bottom: none;
        justify-content: center;
    }

    #layers-panel.collapsed .header-left {
        flex: 0 0 auto;
        justify-content: center;
    }

    #layers-panel.collapsed .panel-title,
    #layers-panel.collapsed .collapse-icon {
        display: none !important;
    }

    #layers-panel.collapsed .header-left i {
        font-size: 18px;
    }
}

/* --- Language Panel --- */
.language-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 20px 20px 20px;
}

.language-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
}

.language-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.language-item.active {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-color);
}

.language-item .lang-native {
    font-size: 15px;
    font-weight: 600;
    color: #eee;
}

.language-item .lang-en {
    font-size: 13px;
    color: #888;
}

.language-item.active .lang-native {
    color: #fff;
}

.language-item.active::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 14px;
    color: var(--primary-color);
    margin-left: 10px;
}
