/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0a0a0a;
    color: #ffffff;
    overflow: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

body.light-theme {
    background: #f5f5f5;
    color: #1a1a1a;
}

.app-page {
    display: none;
}

.app-page.active {
    display: block;
}

/* Full-Screen Map */
#map {
    position: absolute;
    top: 80px; /* Account for top panel */
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: calc(100vh - 80px);
    z-index: 0;
}

/* Top Horizontal Panel */
#top-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
    padding: 0 32px;
    transition: background 0.3s ease, border-color 0.3s ease;
}

body.light-theme #top-panel {
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.top-panel-content {
    max-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 48px;
    padding-bottom: 12px;
}

.top-panel-header h1 {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, #C939A3 0%, #51A2B6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2px;
    white-space: nowrap;
}

.top-panel-subtitle {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    transition: color 0.3s ease;
}

body.light-theme .top-panel-subtitle {
    color: rgba(0, 0, 0, 0.6);
}

.top-panel-controls {
    display: flex;
    gap: 24px;
    align-items: center;
    flex: 1;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 200px;
}

.control-group label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

body.light-theme .control-group label {
    color: rgba(0, 0, 0, 0.7);
}

.control-group .filter-select {
    padding: 8px 12px;
    font-size: 13px;
}

body.light-theme .control-group .filter-select {
    padding: 8px 12px;
    font-size: 13px;
}

/* Theme Toggle in Top Panel */
#theme-toggle {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-size: 24px;
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
    margin-left: auto;
    align-self: center;
}

#theme-toggle:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(201, 57, 163, 0.4);
    border-color: rgba(201, 57, 163, 0.5);
    background: rgba(255, 255, 255, 0.12);
}

#theme-toggle:active {
    transform: translateY(0) scale(0.98);
}

#theme-icon {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

body.light-theme #theme-toggle {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.15);
}

body.light-theme #theme-toggle:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(201, 57, 163, 0.5);
}


/* Left Sidebar (Filters Only) */
#sidebar {
    position: fixed;
    left: 0;
    top: 80px; /* Below top panel */
    bottom: 0;
    width: 380px;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 999;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 0 24px 0;
    transition: transform 0.3s ease, background 0.3s ease, border-color 0.3s ease;
    transform: translateX(0);
}

body.light-theme #sidebar {
    background: rgba(255, 255, 255, 0.95);
    border-right: 1px solid rgba(0, 0, 0, 0.1);
}


#sidebar::-webkit-scrollbar {
    width: 6px;
}

#sidebar::-webkit-scrollbar-track {
    background: transparent;
}

#sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

#sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.filter-section {
    padding: 16px 20px 0;
    margin-bottom: 24px;
}

/* Collapsible filter category sections */
.filter-group-section {
    margin-bottom: 4px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.07);
}

.filter-group-section-header {
    list-style: none;
    cursor: pointer;
    padding: 9px 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.55);
    background: rgba(255,255,255,0.04);
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
    outline: none;
    transition: background 0.15s;
}

.filter-group-section-header::-webkit-details-marker { display: none; }
.filter-group-section-header::marker { display: none; }

.filter-group-section-header::before {
    content: '▶';
    font-size: 7px;
    opacity: 0.5;
    transition: transform 0.18s;
    flex-shrink: 0;
}

.filter-group-section[open] > .filter-group-section-header::before {
    transform: rotate(90deg);
}

.filter-group-section-header:hover {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.8);
}

.filter-group-section-body {
    padding: 10px 12px 4px;
}

/* Sub-scores collapsible inside Scores section */
.sub-scores-details {
    margin-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 6px;
}
.sub-scores-summary {
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
    padding: 4px 0;
    list-style: none;
    user-select: none;
}
.sub-scores-summary::-webkit-details-marker { display: none; }
.sub-scores-summary::marker { display: none; }
.sub-scores-summary::before {
    content: '▸';
    display: inline-block;
    margin-right: 6px;
    font-size: 10px;
    transition: transform 0.15s ease;
}
.sub-scores-details[open] > .sub-scores-summary::before {
    transform: rotate(90deg);
}
.sub-scores-body {
    padding-left: 8px;
}
body.light-theme .sub-scores-details {
    border-top-color: rgba(0,0,0,0.1);
}
body.light-theme .sub-scores-summary {
    color: rgba(0,0,0,0.45);
}

body.light-theme .filter-group-section {
    border-color: rgba(0,0,0,0.1);
}

body.light-theme .filter-group-section-header {
    background: rgba(0,0,0,0.04);
    color: rgba(0,0,0,0.55);
}

body.light-theme .filter-group-section-header:hover {
    background: rgba(0,0,0,0.08);
    color: rgba(0,0,0,0.8);
}

.filters-collapsible {
    max-height: none;
    overflow: visible;
    transition: opacity 0.3s ease;
    opacity: 1;
}

.filters-collapsible.collapsed {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
}

.filter-group {
    margin-bottom: 10px;
}

.filter-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
    transition: color 0.3s ease;
}

.filter-label-row {
    display: flex;
    align-items: center;
    gap: 0;
}

.filter-label-row .selected-value-indicator {
    display: inline-flex;
    align-items: center;
    font-weight: 600;
    color: #FF4444;
    font-size: 13px;
    white-space: nowrap;
    transition: opacity 0.2s ease;
}

.filter-label-row .selected-value-indicator:empty {
    display: none;
}

.filter-info-icon {
    display: inline-block;
    margin-left: 6px;
    font-size: 14px;
    opacity: 0.5;
    cursor: help;
    transition: opacity 0.2s ease, transform 0.2s ease;
    user-select: none;
}

.filter-info-icon:hover {
    opacity: 1;
    transform: scale(1.15);
}

.filter-tooltip {
    position: fixed;
    background: rgba(20, 20, 20, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
    max-width: 320px;
    font-size: 13px;
    line-height: 1.5;
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    animation: tooltipFadeIn 0.2s ease;
}

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

.filter-tooltip .tooltip-title {
    font-weight: 600;
    color: #51A2B6;
    margin-bottom: 6px;
    font-size: 14px;
}

.filter-tooltip .tooltip-description {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 8px;
}

.filter-tooltip .tooltip-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.filter-tooltip .tooltip-meta-item {
    display: flex;
    gap: 6px;
}

.filter-tooltip .tooltip-meta-label {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
}

body.light-theme .filter-tooltip {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

body.light-theme .filter-tooltip .tooltip-title {
    color: #C939A3;
}

body.light-theme .filter-tooltip .tooltip-description {
    color: rgba(0, 0, 0, 0.9);
}

body.light-theme .filter-tooltip .tooltip-meta {
    color: rgba(0, 0, 0, 0.6);
}

body.light-theme .filter-tooltip .tooltip-meta-label {
    color: rgba(0, 0, 0, 0.5);
}

.value-separator {
    margin: 0 6px;
    color: #FF0000;
    font-weight: 300;
    font-size: 14px;
}

body.light-theme .filter-label-row .selected-value-indicator {
    color: #D32F2F;
}

body.light-theme .value-separator {
    color: #D32F2F;
}

body.light-theme .filter-group label {
    color: rgba(0, 0, 0, 0.8);
}

.filter-select {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-select:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(201, 57, 163, 0.4);
}

.filter-select:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.12);
    border-color: #C939A3;
    box-shadow: 0 0 0 3px rgba(201, 57, 163, 0.2);
}

.filter-select option {
    background: #1a1a1a;
    color: #ffffff;
}

body.light-theme .filter-select {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.15);
    color: #1a1a1a;
}

body.light-theme .filter-select:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(201, 57, 163, 0.4);
}

body.light-theme .filter-select:focus {
    background: rgba(0, 0, 0, 0.08);
}

body.light-theme .filter-select option {
    background: #ffffff;
    color: #1a1a1a;
}

/* Histogram */
.histogram-container {
    height: 40px;
    width: 100%;
    margin-bottom: 4px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    padding: 6px 4px 2px;
    transition: background 0.3s ease;
    overflow: visible;
}

body.light-theme .histogram-container {
    background: rgba(0, 0, 0, 0.03);
}

/* Viewport stats span */
.histogram-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    margin: 2px 0 1px;
    gap: 6px;
}

.viewport-stats {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.55);
    text-align: right;
    min-height: 14px;
    letter-spacing: 0.3px;
}

body.light-theme .viewport-stats {
    color: rgba(0, 0, 0, 0.45);
}

/* Range Slider */
.range-slider {
    margin: 6px 0 4px;
}

.noUi-target {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 4px;
    box-shadow: none;
    height: 4px;
}

.noUi-connect {
    background: linear-gradient(90deg, #51A2B6 0%, #8B5FA8 50%, #C939A3 100%);
}

.noUi-handle,
.noUi-horizontal .noUi-handle {
    background: #ffffff;
    border: 1px solid #C939A3;
    border-radius: 50% !important;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
    right: -2px !important;
    top: -1px !important;
    width: 4px !important;
    height: 4px !important;
    cursor: grab;
    transition: all 0.15s ease;
}

.noUi-handle:hover {
    box-shadow: 0 3px 12px rgba(201, 57, 163, 0.5);
    transform: scale(1.1);
}

.noUi-handle:active {
    cursor: grabbing;
    transform: scale(0.95);
}

.noUi-handle::before,
.noUi-handle::after {
    display: none;
}

.range-values {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-top: 4px;
}

.range-input {
    flex: 1;
    padding: 3px 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #ffffff;
    font-size: 11px;
    font-weight: 500;
    font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
    text-align: center;
    transition: all 0.2s ease;
}

.range-input:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(201, 57, 163, 0.3);
}

.range-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.12);
    border-color: #C939A3;
    box-shadow: 0 0 0 2px rgba(201, 57, 163, 0.2);
}

/* Remove spinner buttons from number inputs */
.range-input::-webkit-inner-spin-button,
.range-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.range-input {
    -moz-appearance: textfield;
}

body.light-theme .range-input {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.15);
    color: #1a1a1a;
}

body.light-theme .range-input:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(201, 57, 163, 0.3);
}

body.light-theme .range-input:focus {
    background: rgba(0, 0, 0, 0.08);
    border-color: #C939A3;
}

/* Buttons */
button {
    padding: 7px 14px;
    background: rgba(255, 255, 255, 0.08);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: all 0.2s ease;
    box-shadow: none;
}

button:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(201, 57, 163, 0.5);
    transform: none;
}

button:active {
    transform: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

.sidebar-footer {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#reset-filters {
    width: 100%;
}

/* AI Analysis Button (in top panel) */
.btn-analysis {
    align-self: center;
    padding: 7px 14px;
    background: rgba(81, 162, 182, 0.15);
    border: 1px solid rgba(81, 162, 182, 0.4);
    border-radius: 8px;
    font-weight: 600;
    font-size: 12px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-analysis:hover:not(:disabled) {
    background: rgba(81, 162, 182, 0.3);
    border-color: rgba(81, 162, 182, 0.7);
    transform: none;
}

.btn-analysis:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

body.light-theme .btn-analysis {
    background: rgba(81, 162, 182, 0.08);
    border: 1px solid rgba(81, 162, 182, 0.3);
    color: #1a1a1a;
}

body.light-theme .btn-analysis:hover:not(:disabled) {
    background: rgba(81, 162, 182, 0.15);
    border-color: rgba(81, 162, 182, 0.5);
}

.btn-ai-analysis {
    align-self: center;
    padding: 7px 14px;
    background: rgba(201, 57, 163, 0.15);
    border: 1px solid rgba(201, 57, 163, 0.4);
    border-radius: 8px;
    font-weight: 600;
    font-size: 12px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-ai-analysis:hover:not(:disabled) {
    background: rgba(201, 57, 163, 0.3);
    border-color: rgba(201, 57, 163, 0.7);
}

.btn-ai-analysis:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.btn-ai-analysis.loading {
    pointer-events: none;
    opacity: 0.6;
}

body.light-theme .btn-ai-analysis {
    background: rgba(201, 57, 163, 0.08);
    border: 1px solid rgba(201, 57, 163, 0.3);
    color: #1a1a1a;
}

body.light-theme .btn-ai-analysis:hover:not(:disabled) {
    background: rgba(201, 57, 163, 0.15);
    border-color: rgba(201, 57, 163, 0.5);
}

.city-selection-wrapper {
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.city-selection-wrapper h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.75);
}

.city-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.city-actions button {
    padding: 5px 10px;
    font-size: 11px;
    border-radius: 8px;
    background: rgba(81, 162, 182, 0.1);
    border: 1px solid rgba(81, 162, 182, 0.3);
    color: rgba(255, 255, 255, 0.8);
}

.city-actions button:hover {
    background: rgba(81, 162, 182, 0.2);
    border-color: rgba(81, 162, 182, 0.5);
}

.city-selection-list {
    max-height: 220px;
    overflow-y: auto;
}

.city-group {
    margin-bottom: 10px;
}

.city-group summary {
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.82);
    margin-bottom: 6px;
    list-style: none;
    display: flex;
    align-items: center;
}

.city-group summary::before {
    content: '▸';
    display: inline-block;
    margin-right: 4px;
    font-size: 10px;
    transition: transform 0.15s ease;
}

.city-group[open] > summary::before {
    transform: rotate(90deg);
}

.city-group summary::-webkit-details-marker {
    display: none;
}

.district-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

.district-label input[type="checkbox"] {
    cursor: pointer;
    accent-color: #C939A3;
}

.district-count {
    font-weight: 400;
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
}

.city-option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    margin-bottom: 5px;
    color: rgba(255, 255, 255, 0.75);
}

.city-selected-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.city-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: rgba(201, 57, 163, 0.15);
    border: 1px solid rgba(201, 57, 163, 0.35);
    border-radius: 999px;
    font-size: 11px;
    color: #fff;
}

.city-chip button {
    background: transparent;
    border: none;
    color: inherit;
    padding: 0;
    font-size: 12px;
    box-shadow: none;
    line-height: 1;
}

#page-analysis {
    position: absolute;
    top: 80px;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 16px;
    z-index: 2;
}

.analysis-layout {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 0;
    height: 100%;
}

.analysis-map-card,
.analysis-panel-card {
    background: rgba(10, 10, 10, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 14px;
}

.analysis-map-card {
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.analysis-panel-card {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.analysis-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.btn-analysis-back {
    padding: 7px 14px;
    font-size: 12px;
}

#analysis-map {
    width: 100%;
    height: 320px;
    border-radius: 10px;
    overflow: hidden;
}

.analysis-location-meta {
    margin-top: 10px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
}

.hex-id-label {
    font-size: 10px;
    opacity: 0.45;
    margin-top: 2px;
    font-family: monospace;
}

.hex-coords {
    font-size: 11px;
    margin-top: 5px;
    color: rgba(255, 255, 255, 0.8);
}

.gmaps-link {
    color: #51A2B6;
    text-decoration: none;
    font-size: 11px;
}

.gmaps-link:hover {
    text-decoration: underline;
}

.hex-geocode {
    font-size: 10.5px;
    opacity: 0.5;
    margin-top: 3px;
    font-style: italic;
}

.analysis-parameters-placeholder {
    margin-top: 8px;
    padding: 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.75);
    font-size: 13px;
}

.analysis-controls {
    margin-top: 10px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.analysis-control-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.analysis-control-row label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.analysis-layer-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.analysis-layer-controls label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.78);
}

.analysis-layer-controls input[type="checkbox"] {
    accent-color: #51A2B6;
}

.analysis-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.analysis-bar-row {
    display: grid;
    grid-template-columns: 180px 1fr auto;
    align-items: center;
    gap: 10px;
}

.analysis-bar-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.analysis-bar-track {
    height: 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    position: relative;
}

.analysis-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #51A2B6 0%, #8B5FA8 50%, #C939A3 100%);
    border-radius: 999px;
}

.analysis-bar-value {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    min-width: 56px;
    text-align: right;
}

.analysis-baseline-text {
    margin-top: 10px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.68);
}

/* ─── Analysis panel compact metrics ─── */
.analysis-panel-card {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.analysis-panel-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    margin-bottom: 10px;
}

.analysis-panel-topbar h3 {
    margin: 0;
    font-size: 16px;
    white-space: nowrap;
}

.analysis-biz-ctrl {
    flex: 1;
    min-width: 180px;
}

.analysis-biz-ctrl .filter-select {
    width: 100%;
    max-width: none;
}

.analysis-topbar-controls {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.analysis-ctrl-sm {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.analysis-ctrl-sm label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255,255,255,0.45);
}

.filter-select-sm {
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.18);
    color: #fff;
    max-width: 160px;
}

.analysis-check-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    padding-bottom: 2px;
}

.analysis-check-label input[type="checkbox"] {
    accent-color: #51A2B6;
}

#analysis-parameters {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.analysis-section {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
}

.analysis-section:last-child {
    margin-bottom: 0;
}

.analysis-section-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.45);
    margin-bottom: 8px;
}

.baseline-note {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    font-size: 10px;
    color: rgba(255,255,255,0.3);
}

.metrics-compact-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Two-column layout for census / transport / POI sections */
.metrics-compact-grid.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 14px;
}

/* Row with percentile mini-bar (for scores) */
.metric-row {
    display: grid;
    grid-template-columns: 1fr 44px 56px;
    align-items: center;
    gap: 6px;
}

/* Row with just value (for census/transport/poi) */
.metric-row-simple {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 1px 0;
}

.metric-name {
    font-size: 14px;
    color: rgba(255,255,255,0.65);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 3px;
}

.metric-val {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    text-align: right;
    white-space: nowrap;
}

.metric-unit {
    font-size: 9px;
    font-weight: 400;
    color: rgba(255,255,255,0.35);
}

/* Total Score collapsible — triangle left of the row */
.total-score-details {
    margin: 0;
}

.total-score-details > summary {
    list-style: none;
    cursor: pointer;
    display: grid;
    grid-template-columns: 14px 1fr 44px 56px;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
    user-select: none;
    outline: none;
}

.total-score-details > summary::-webkit-details-marker { display: none; }
.total-score-details > summary::marker { display: none; }

.total-score-details > summary::before {
    content: '▶';
    font-size: 8px;
    color: rgba(255,255,255,0.4);
    transition: transform 0.18s;
    display: inline-block;
    text-align: center;
}

.total-score-details[open] > summary::before {
    transform: rotate(90deg);
}

.total-score-details > summary:hover::before {
    color: rgba(255,255,255,0.75);
}

.score-details-body {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.07);
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-left: 20px;
}

/* gradient bar fill specifically for scores section */
.scores-fill {
    background: linear-gradient(90deg, #51A2B6 0%, #8B5FA8 50%, #C939A3 100%);
}

/* Favicon logo used as info icon inside metric rows */
.metric-info-logo {
    width: 12px;
    height: 12px;
    opacity: 0.35;
    cursor: pointer;
    flex-shrink: 0;
    vertical-align: middle;
    border-radius: 2px;
    filter: brightness(0) invert(1);
}

.metric-info-logo:hover {
    opacity: 0.8;
}

/* Small info icon inside analysis metric rows */
.analysis-metric-info {
    font-size: 10px;
    opacity: 0.5;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
}

.analysis-metric-info:hover {
    opacity: 0.9;
}

.metric-bar {
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
}

.metric-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, rgba(81,162,182,0.7), rgb(81,162,182));
    border-radius: 2px;
    transition: width 0.3s;
}

.scores-section .metric-bar-fill {
    background: linear-gradient(90deg, #51A2B6 0%, #8B5FA8 50%, #C939A3 100%);
}

.analysis-empty {
    font-size: 11px;
    color: rgba(255,255,255,0.35);
    font-style: italic;
    padding: 4px 0;
}

/* light theme overrides */
body.light-theme .filter-select-sm {
    background: rgba(0,0,0,0.06);
    border-color: rgba(0,0,0,0.2);
    color: #333;
}

body.light-theme .analysis-section {
    background: rgba(0,0,0,0.03);
    border-color: rgba(0,0,0,0.07);
}

body.light-theme .total-score-details > summary::before {
    color: rgba(0,0,0,0.35);
}

body.light-theme .total-score-details > summary:hover::before {
    color: rgba(0,0,0,0.7);
}

body.light-theme .metric-info-logo {
    filter: brightness(0);
}

body.light-theme .analysis-section-title,
body.light-theme .analysis-ctrl-sm label {
    color: rgba(0,0,0,0.45);
}

body.light-theme .metric-name {
    color: rgba(0,0,0,0.65);
}

body.light-theme .metric-val {
    color: rgba(0,0,0,0.9);
}

body.light-theme .analysis-check-label {
    color: rgba(0,0,0,0.6);
}

body.light-theme .analysis-panel-topbar {
    border-bottom-color: rgba(0,0,0,0.08);
}


body.light-theme .analysis-panel-card,
body.light-theme .analysis-map-card {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.12);
}

body.light-theme .analysis-map-card {
    border-right-color: rgba(0, 0, 0, 0.12);
}

body.light-theme .analysis-map-card .analysis-card-header h3 {
    color: rgba(0, 0, 0, 0.85);
}

body.light-theme .metric-bar {
    background: rgba(0, 0, 0, 0.08);
}

body.light-theme .baseline-note {
    color: rgba(0, 0, 0, 0.45);
}

body.light-theme .hex-coords {
    color: rgba(0, 0, 0, 0.75);
}

body.light-theme .hex-id-label,
body.light-theme .hex-geocode {
    color: rgba(0, 0, 0, 0.45);
}

body.light-theme .gmaps-link {
    color: #0066cc;
}

body.light-theme .city-selection-wrapper {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .city-selection-wrapper h4,
body.light-theme .city-group summary,
body.light-theme .city-option,
body.light-theme .district-label span,
body.light-theme .analysis-location-meta,
body.light-theme .analysis-parameters-placeholder {
    color: rgba(0, 0, 0, 0.75);
}

body.light-theme .analysis-control-row label,
body.light-theme .analysis-layer-controls label,
body.light-theme .analysis-bar-label,
body.light-theme .analysis-bar-value,
body.light-theme .analysis-baseline-text {
    color: rgba(0, 0, 0, 0.75);
}

body.light-theme .analysis-bar-track {
    background: rgba(0, 0, 0, 0.08);
}

/* AI Description Panel (overlay) */
#ai-description-panel {
    position: fixed;
    right: 20px;
    top: 96px;
    width: 380px;
    max-height: calc(100vh - 116px);
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    z-index: 998;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transform: translateX(440px);
    transition: transform 0.3s ease, background 0.3s ease, border-color 0.3s ease;
    color: #ffffff;
}

body.light-theme #ai-description-panel {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    color: #1a1a1a;
}

#ai-description-panel.active {
    transform: translateX(0);
}

#ai-description-panel::-webkit-scrollbar {
    width: 6px;
}

#ai-description-panel::-webkit-scrollbar-track {
    background: transparent;
}

#ai-description-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

body.light-theme #ai-description-panel::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}

.ai-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 12px 12px 0 0;
    z-index: 1;
}

body.light-theme .ai-panel-header {
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.ai-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
}

body.light-theme .ai-panel-title {
    color: #1a1a1a;
}

.ai-panel-icon {
    font-size: 18px;
}

#ai-panel-coords {
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

body.light-theme #ai-panel-coords {
    color: #555;
}

.ai-panel-header .close-btn {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    flex-shrink: 0;
}

.ai-panel-header .close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

body.light-theme .ai-panel-header .close-btn {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.6);
}

body.light-theme .ai-panel-header .close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #1a1a1a;
}

.btn-google-maps {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-google-maps:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
}

body.light-theme .btn-google-maps {
    color: #555;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.12);
}

body.light-theme .btn-google-maps:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #1a1a1a;
    border-color: rgba(0, 0, 0, 0.25);
}

#ai-panel-content {
    padding: 20px;
}

#ai-panel-content .info-placeholder {
    color: rgba(255, 255, 255, 0.4);
}

body.light-theme #ai-panel-content .info-placeholder {
    color: rgba(0, 0, 0, 0.4);
}

.close-btn {
    position: relative;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.7);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}



.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    transform: none;
}

body.light-theme .close-btn {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.7);
}

body.light-theme .close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #1a1a1a;
}



.info-item {
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

.info-value {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    transition: color 0.3s ease;
}

body.light-theme .info-label {
    color: rgba(0, 0, 0, 0.5);
}

body.light-theme .info-value {
    color: #1a1a1a;
}

.info-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px solid #C939A3;
}

.info-section strong {
    display: block;
    font-size: 14px;
    color: #C939A3;
    margin-bottom: 8px;
}

.info-placeholder {
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
    font-size: 14px;
    transition: color 0.3s ease;
}

body.light-theme .info-placeholder {
    color: rgba(0, 0, 0, 0.4);
}

/* Analysis Results */
.analysis-result {
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
    transition: color 0.3s ease;
}

body.light-theme .analysis-result {
    color: #1a1a1a;
}

.analysis-summary {
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(201, 57, 163, 0.1);
    border-left: 3px solid #C939A3;
    border-radius: 6px;
    font-size: 14px;
}

.analysis-section {
    margin-top: 16px;
}

.analysis-section ul {
    list-style: none;
    padding: 0;
    margin: 8px 0 0 0;
}

.analysis-section li {
    padding: 8px 0 8px 24px;
    position: relative;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
    transition: color 0.3s ease;
}

body.light-theme .analysis-section li {
    color: #333;
}

.analysis-section li:before {
    content: "•";
    position: absolute;
    left: 8px;
    color: #51A2B6;
    font-size: 18px;
}

/* Loading Overlay */
#loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 32px 48px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    font-weight: 500;
    color: #ffffff;
    font-size: 16px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #top-panel {
        padding: 0 16px;
    }

    .top-panel-content {
        gap: 16px;
    }

    .top-panel-header h1 {
        font-size: 20px;
    }

    .top-panel-subtitle {
        display: none;
    }

    .control-group {
        min-width: 150px;
    }

    #sidebar {
        width: 320px;
    }

    #ai-description-panel {
        width: calc(100% - 40px);
        max-width: 380px;
        top: 100px; /* Below top panel */
    }
}

@media (max-width: 480px) {
    #top-panel {
        height: auto;
        padding: 12px;
    }

    .top-panel-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 8px 0;
    }

    .top-panel-controls {
        flex-direction: column;
        width: 100%;
        gap: 12px;
    }

    .control-group {
        width: 100%;
        min-width: 0;
    }

    #map {
        top: 160px; /* Taller panel on mobile */
        height: calc(100vh - 160px);
    }

    #filters-toggle-btn {
        display: none;
    }

    #sidebar {
        width: 100%;
        padding: 0 0 20px 0;
        top: 160px;
    }

    #ai-description-panel {
        top: 170px;
        width: calc(100% - 20px);
        max-width: none;
    }
}

/* Map Loading Overlay */
.map-loading-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.25);
    z-index: 600;
    pointer-events: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
}
.map-loading-overlay.active {
    display: flex;
}
.map-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #51a2b6;
    border-radius: 50%;
    animation: map-spin 0.8s linear infinite;
}
@keyframes map-spin {
    to { transform: rotate(360deg); }
}
.map-loading-text {
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Viewport Loading Indicator */
.viewport-indicator {
    display: none;
    position: absolute;
    top: 96px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    z-index: 500;
    font-size: 14px;
    pointer-events: none;
}

.viewport-coverage-badge {
    background: rgba(81, 162, 182, 0.15);
    color: rgba(81, 162, 182, 1);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

body.light-theme .viewport-coverage-badge {
    background: rgba(81, 162, 182, 0.12);
    color: #3a8a9a;
}

/* Error Messages */
.info-error {
    padding: 12px;
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 8px;
    color: #ffc107;
    font-size: 13px;
}

body.light-theme .info-error {
    background: rgba(220, 53, 69, 0.08);
    border-color: rgba(220, 53, 69, 0.3);
    color: #dc3545;
}

.info-error strong {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
}

.info-error p {
    margin: 0;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.7);
}

body.light-theme .info-error p {
    color: #555;
}

/* Welcome Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(18px) saturate(1.2);
    z-index: 3000;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: rgba(10, 10, 10, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 48px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

.modal-close {
    position: absolute;
    right: 20px;
    top: 20px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.7);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    transform: rotate(90deg);
}

.modal-content h2 {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, #C939A3 0%, #51A2B6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
}

.modal-content > p {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 32px;
    line-height: 1.6;
}

.modal-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.feature {
    text-align: center;
}

.feature-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 12px;
}

.feature h3 {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 8px;
}

.feature p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
}

.btn-primary {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #C939A3 0%, #51A2B6 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(201, 57, 163, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(201, 57, 163, 0.4);
}

.modal-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
}

.modal-checkbox input {
    margin-right: 8px;
    cursor: pointer;
}

.btn-text {
    background: none;
    border: none;
    color: #51A2B6;
    font-size: 13px;
    padding: 8px 0;
    cursor: pointer;
    text-decoration: underline;
    box-shadow: none;
    width: 100%;
    text-align: center;
}

.btn-text:hover {
    color: #C939A3;
    transform: none;
}

.filter-group.hidden {
    display: none;
}

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* MapLibre Controls - Transparent Background */
.maplibregl-ctrl-group,
.mapboxgl-ctrl-group {
    background: rgba(10, 10, 10, 0.7) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

.maplibregl-ctrl-group button,
.mapboxgl-ctrl-group button {
    background: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.maplibregl-ctrl-group button:hover,
.mapboxgl-ctrl-group button:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

.maplibregl-ctrl-group button:last-child,
.mapboxgl-ctrl-group button:last-child {
    border-bottom: none !important;
}

.maplibregl-ctrl-icon,
.mapboxgl-ctrl-icon {
    filter: invert(1) brightness(1.2);
    transition: filter 0.3s ease;
}

body.light-theme .maplibregl-ctrl-group,
body.light-theme .mapboxgl-ctrl-group {
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(0, 0, 0, 0.15) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

body.light-theme .maplibregl-ctrl-group button,
body.light-theme .mapboxgl-ctrl-group button {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
}

body.light-theme .maplibregl-ctrl-group button:hover,
body.light-theme .mapboxgl-ctrl-group button:hover {
    background: rgba(0, 0, 0, 0.05) !important;
}

body.light-theme .maplibregl-ctrl-icon,
body.light-theme .mapboxgl-ctrl-icon {
    filter: invert(0) brightness(0.3);
}

/* Multi-Select Dropdown (Landuse Filter) */
.landuse-filter-wrapper {
    margin-bottom: 16px;
}

.landuse-filter {
    margin-bottom: 0 !important;
}

.multi-select-dropdown {
    position: relative;
    width: 100%;
}

.multi-select-selected {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 13px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.multi-select-selected:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(201, 57, 163, 0.5);
}

.multi-select-selected::after {
    content: '▼';
    font-size: 10px;
    opacity: 0.6;
}

.multi-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(20, 20, 20, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    margin-top: 4px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.multi-select-actions {
    display: flex;
    gap: 8px;
    padding: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.multi-select-actions button {
    flex: 1;
    padding: 6px 12px;
    background: rgba(201, 57, 163, 0.2);
    border: 1px solid rgba(201, 57, 163, 0.4);
    border-radius: 4px;
    color: #fff;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.multi-select-actions button:hover {
    background: rgba(201, 57, 163, 0.4);
}

.multi-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s ease;
}

.multi-select-option:hover {
    background: rgba(255, 255, 255, 0.05);
}

.multi-select-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #C939A3;
    cursor: pointer;
}

/* POI Filters Section */
.poi-biz-select-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.poi-biz-label {
    font-size: 12px;
    white-space: nowrap;
    color: rgba(255,255,255,0.7);
}
body.light-theme .poi-biz-label {
    color: rgba(0,0,0,0.6);
}
.poi-biz-select-wrap select {
    flex: 1;
    min-width: 0;
}
.poi-filters-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.poi-filters-header h4 {
    font-size: 13px;
    font-weight: 600;
    color: #C939A3;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.poi-filter {
    background: rgba(201, 57, 163, 0.05);
    border-left: 3px solid #C939A3;
    padding-left: 12px !important;
    margin-left: 0 !important;
}

/* Light theme overrides for multi-select */
body.light-theme .multi-select-selected {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.15);
    color: #1a1a1a;
}

body.light-theme .multi-select-selected:hover {
    background: rgba(0, 0, 0, 0.08);
}

body.light-theme .multi-select-options {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

body.light-theme .multi-select-actions {
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .multi-select-option {
    color: #1a1a1a;
}

body.light-theme .multi-select-option:hover {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .poi-filters-section {
    border-top-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .poi-filter {
    background: rgba(201, 57, 163, 0.08);
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    background: inherit;
    z-index: 10;
}

.sidebar-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255, 255, 255, 0.7);
}

body.light-theme .sidebar-title {
    color: rgba(0, 0, 0, 0.6);
}

.sidebar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-header .close-btn {
    display: none;
}

.btn-reset {
    padding: 7px 14px;
    background: rgba(201, 57, 163, 0.15);
    border: 1px solid rgba(201, 57, 163, 0.4);
    border-radius: 8px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-reset:hover {
    background: rgba(201, 57, 163, 0.3);
    border-color: rgba(201, 57, 163, 0.7);
}

body.light-theme .sidebar-header {
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .sidebar-header .close-btn {
    background: rgba(0, 0, 0, 0.08);
    color: #1a1a1a;
}

body.light-theme .sidebar-header .close-btn:hover {
    background: rgba(0, 0, 0, 0.15);
}

body.light-theme .btn-reset {
    background: rgba(201, 57, 163, 0.1);
    color: #1a1a1a;
}

/* Business Welcome Modal & Survey */
.modal-business-title {
    font-size: 22px;
    font-weight: 600;
    color: #fff;
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.3;
}

.modal-business-steps {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.feature.step {
    background: rgba(255,255,255,0.07);
    border-radius: 16px;
    padding: 20px 10px;
    text-align: center;
    border: 1.5px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 170px;
}

.feature.step h3 {
    font-size: 14px;
    font-weight: 700;
    color: #C939A3;
    margin: 8px 0 4px;
}

.feature.step p {
    font-size: 12px;
    color: rgba(255,255,255,0.75);
    margin: 0;
    line-height: 1.3;
}

.feature.step .feature-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Survey Step Styles */
.survey-header {
    margin-bottom: 18px;
}

.survey-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 6px;
}

.survey-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #51A2B6, #C939A3);
    border-radius: 2px;
    transition: width 0.35s ease;
    min-width: 4px;
}

.survey-step-info {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    text-align: right;
}

.survey-question-text {
    font-size: 19px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 10px;
    line-height: 1.35;
}

.survey-disclaimer {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 14px;
    line-height: 1.4;
    padding: 8px 12px;
    background: rgba(201,57,163,0.07);
    border-left: 2px solid #C939A3;
    border-radius: 0 6px 6px 0;
}

.survey-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.survey-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 14px 8px;
    background: rgba(255,255,255,0.04);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    color: #fff;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    min-height: 80px;
}

.survey-option:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(201,57,163,0.5);
}

.survey-option.selected {
    background: rgba(201,57,163,0.14);
    border-color: #C939A3;
    box-shadow: 0 0 0 2px rgba(201,57,163,0.25);
}

.survey-option-icon { font-size: 22px; line-height: 1; }
.survey-option-label { font-size: 12px; font-weight: 500; line-height: 1.3; }

.survey-nav {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 14px;
}

.btn-survey-nav {
    padding: 8px 14px;
    border: 1px solid rgba(201,57,163,0.4);
    border-radius: 8px;
    background: rgba(201,57,163,0.1);
    color: rgba(255,255,255,0.85);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-survey-nav:hover {
    background: rgba(201,57,163,0.25);
    border-color: rgba(201,57,163,0.7);
    color: #fff;
}

.btn-survey-skip { margin-right: auto; }

.survey-next-btn { flex: 1; max-width: 160px; }

/* Live hex count in survey nav */
.survey-hex-count {
    font-size: 12px;
    font-weight: 600;
    color: rgba(81, 162, 182, 1);
    margin-left: auto;
    white-space: nowrap;
    padding: 4px 10px;
    background: rgba(81, 162, 182, 0.12);
    border-radius: 6px;
    transition: color 0.2s ease;
}

.survey-hex-count:empty {
    display: none;
}

.survey-hex-count-low {
    color: #e67e22;
    background: rgba(230, 126, 34, 0.12);
}

.survey-next-disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* Business Criteria (Biz Focus) Section */
.biz-focus-section {
    padding: 10px 14px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.analysis-biz-focus {
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 0;
}

.biz-focus-section-inner {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.biz-focus-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255,255,255,0.45);
}

.biz-focus-edit {
    background: none;
    border: none;
    color: #51A2B6;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s ease;
}

.biz-focus-edit:hover { background: rgba(81,162,182,0.15); }

.biz-focus-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.biz-focus-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px 4px 8px;
    background: rgba(201,57,163,0.1);
    border: 1px solid rgba(201,57,163,0.32);
    border-radius: 20px;
    font-size: 11px;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s ease;
}

.biz-focus-chip:hover { background: rgba(201,57,163,0.2); }

.biz-focus-chip-remove {
    background: none;
    border: none;
    color: rgba(255,255,255,0.45);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin-left: 2px;
}

.biz-focus-chip-remove:hover { color: #fff; }

.biz-focus-empty {
    font-size: 11px;
    color: rgba(255,255,255,0.28);
    font-style: italic;
}

/* Raw / Advanced Filters Collapsible Toggle */
.raw-filters-toggle > summary {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 14px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: rgba(255,255,255,0.38);
    cursor: pointer;
    list-style: none;
    transition: color 0.15s ease;
    user-select: none;
}

.raw-filters-toggle > summary::-webkit-details-marker { display: none; }

.raw-filters-toggle > summary:hover { color: rgba(255,255,255,0.75); }

.raw-filters-toggle > summary::before {
    content: '▶';
    font-size: 8px;
    transition: transform 0.2s ease;
}

.raw-filters-toggle[open] > summary::before { transform: rotate(90deg); }

/* Light theme overrides */
body.light-theme .modal-business-title { color: #1a1a1a; }
body.light-theme .feature.step { background: #f7f7fa; border-color: #e0e0e0; }
body.light-theme .feature.step p { color: rgba(0,0,0,0.6); }
body.light-theme .survey-question-text { color: #1a1a1a; }
body.light-theme .survey-step-info { color: rgba(0,0,0,0.38); }
body.light-theme .survey-disclaimer { color: rgba(0,0,0,0.5); background: rgba(201,57,163,0.05); }
body.light-theme .survey-option { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.12); color: #1a1a1a; }
body.light-theme .survey-option:hover { background: rgba(0,0,0,0.06); }
body.light-theme .btn-survey-nav { color: rgba(0,0,0,0.6); border-color: rgba(0,0,0,0.15); background: rgba(0,0,0,0.04); }
body.light-theme .btn-survey-nav:hover { background: rgba(0,0,0,0.08); color: #1a1a1a; }
body.light-theme .biz-focus-section { border-bottom-color: rgba(0,0,0,0.08); }
body.light-theme .biz-focus-title { color: rgba(0,0,0,0.45); }
body.light-theme .biz-focus-chip { color: #1a1a1a; background: rgba(201,57,163,0.08); }
body.light-theme .biz-focus-empty { color: rgba(0,0,0,0.3); }
body.light-theme .raw-filters-toggle > summary { color: rgba(0,0,0,0.38); }
body.light-theme .raw-filters-toggle > summary:hover { color: rgba(0,0,0,0.75); }

/* Biz Focus Rows (full question + answer) */
.biz-focus-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.biz-focus-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 10px;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.07);
}

.biz-focus-row-q {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    line-height: 1.3;
}

.biz-focus-row-a {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.biz-focus-answer-val {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    flex: 1;
}

.biz-focus-change {
    background: none;
    border: 1px solid rgba(81,162,182,0.4);
    color: #51A2B6;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.biz-focus-change:hover {
    background: rgba(81,162,182,0.15);
    border-color: #51A2B6;
}

/* Business Type Picker in Survey */
.survey-biz-picker {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}
.survey-biz-selected {
    font-size: 14px;
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(201, 57, 163, 0.1);
    border: 1px solid rgba(201, 57, 163, 0.3);
}
.survey-biz-list {
    max-height: 45vh;
    overflow-y: auto;
    scrollbar-width: thin;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.survey-biz-type-group {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
}
.survey-biz-type-header {
    font-size: 13px;
    font-weight: 600;
    padding: 6px 10px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
}
.survey-biz-type-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 8px;
}
.survey-biz-option {
    font-size: 12px;
    padding: 4px 10px !important;
    min-width: unset !important;
}

/* City Picker in Survey */
.survey-city-picker {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.survey-city-selected {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 28px;
    padding: 4px 0;
}

.survey-city-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(201,57,163,0.15);
    border: 1px solid rgba(201,57,163,0.4);
    border-radius: 20px;
    font-size: 11px;
    color: #fff;
}

.survey-city-chip button {
    background: none;
    border: none;
    color: rgba(255,255,255,0.55);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.survey-city-chip button:hover { color: #fff; }

.survey-city-none {
    font-size: 11px;
    color: rgba(255,255,255,0.3);
    font-style: italic;
    padding: 4px 0;
}

.survey-city-search {
    width: 100%;
    padding: 8px 12px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
}

.survey-city-search:focus { border-color: rgba(81,162,182,0.6); }

.survey-city-list {
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 4px;
}

.survey-city-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    color: rgba(255,255,255,0.75);
    transition: background 0.12s ease;
}

.survey-city-option:hover { background: rgba(255,255,255,0.06); }

.survey-city-option.selected {
    background: rgba(201,57,163,0.12);
    color: #fff;
}

.survey-city-option input[type=checkbox] {
    accent-color: #C939A3;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Light theme overrides for new components */
body.light-theme .biz-focus-row { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.08); }
body.light-theme .biz-focus-row-q { color: rgba(0,0,0,0.45); }
body.light-theme .biz-focus-answer-val { color: #1a1a1a; }
body.light-theme .survey-city-chip { color: #1a1a1a; }
body.light-theme .survey-city-search { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.15); color: #1a1a1a; }
body.light-theme .survey-city-option { color: rgba(0,0,0,0.7); }
body.light-theme .survey-city-option:hover { background: rgba(0,0,0,0.05); }
body.light-theme .survey-city-option.selected { background: rgba(201,57,163,0.08); color: #1a1a1a; }
body.light-theme .survey-city-list { border-color: rgba(0,0,0,0.1); }

/* Multi-select hint & edit mode badge */
.survey-multi-hint {
    font-size: 11px;
    font-weight: 400;
    color: rgba(255,255,255,0.4);
    margin-left: 4px;
}

.survey-edit-mode {
    color: #C939A3;
    font-weight: 600;
}

/* City hierarchy in survey modal */
.survey-city-district {
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 2px;
}

.survey-city-district > summary {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 7px 8px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.survey-city-district > summary::-webkit-details-marker { display: none; }

.survey-city-district > summary::before {
    content: '▶';
    font-size: 7px;
    transition: transform 0.15s ease;
    color: rgba(255,255,255,0.3);
}

.survey-city-district[open] > summary::before { transform: rotate(90deg); }

.survey-city-district-count {
    font-size: 10px;
    color: rgba(255,255,255,0.3);
    font-weight: 400;
}

.survey-city-district-inner {
    padding: 0 4px 6px 16px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.survey-district-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    flex: 1;
}
.survey-district-toggle input[type="checkbox"] {
    accent-color: #ffc107;
    cursor: pointer;
}

.survey-city-all-israel {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 4px;
    padding: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

body.light-theme .survey-city-all-israel {
    border-bottom-color: rgba(0,0,0,0.08);
}

body.light-theme .survey-multi-hint { color: rgba(0,0,0,0.38); }
body.light-theme .survey-city-district > summary { color: rgba(0,0,0,0.6); }
body.light-theme .survey-city-district { border-bottom-color: rgba(0,0,0,0.06); }

/* ── Color Legend ── */
.color-legend {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 400;
    background: rgba(30, 30, 40, 0.88);
    backdrop-filter: blur(8px);
    border-radius: 10px;
    padding: 8px 16px 6px;
    min-width: 180px;
    max-width: 260px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
    pointer-events: auto;
}
.color-legend-title {
    font-size: 11px;
    font-weight: 600;
    color: #e0e0e0;
    text-align: center;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.color-legend-bar {
    height: 12px;
    border-radius: 6px;
    width: 100%;
}
.color-legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #b0b0b0;
    margin-top: 3px;
}

body.light-theme .color-legend {
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}
body.light-theme .color-legend-title { color: #333; }
body.light-theme .color-legend-labels { color: #666; }

/* ── Hex Value Tooltip ── */
.hex-value-tooltip {
    position: fixed;
    z-index: 500;
    background: rgba(20, 20, 30, 0.92);
    backdrop-filter: blur(6px);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 8px;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

body.light-theme .hex-value-tooltip {
    background: rgba(255, 255, 255, 0.95);
    color: #222;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

