/* ============================================
   CSS VARIABLES - WILDERNESS INVESTIGATION THEME
   ============================================ */
:root {
    /* Colors - Light Theme - Forest & Parchment */
    --primary: #2d5a27;
    /* Deep Forest Green */
    --primary-dark: #1e3d1a;
    --primary-light: rgba(45, 90, 39, 0.1);
    --primary-border: rgba(45, 90, 39, 0.25);
    --accent: #d45a00;
    /* Hunter Orange */
    --accent-light: rgba(212, 90, 0, 0.1);
    --danger: #b91c1c;
    /* Alert Red */

    --bg-primary: #f5f0e6;
    /* Parchment */
    --bg-secondary: #ebe5d9;
    /* Aged Paper */
    --bg-tertiary: #e0d9cb;
    --bg-surface: rgba(245, 240, 230, 0.85);
    --bg-panel: rgba(235, 229, 217, 0.92);
    --bg-canvas: #f9f5ed;

    --text-primary: #1a1a18;
    --text-main: #2c2c28;
    --text-secondary: #4a4a44;
    --text-tertiary: #6b6b62;
    --text-muted: #8a8a7f;
    --text-inverse: #f5f0e6;

    --border-color: rgba(45, 45, 40, 0.15);
    --border-light: rgba(45, 45, 40, 0.08);
    --border-subtle: rgba(45, 45, 40, 0.05);

    --shadow-sm: 0 1px 3px rgba(30, 30, 25, 0.1);
    --shadow-md: 0 4px 8px -1px rgba(30, 30, 25, 0.15);
    --shadow-lg: 0 10px 20px -3px rgba(30, 30, 25, 0.2);
    --shadow-xl: 0 20px 30px -5px rgba(30, 30, 25, 0.25);

    --map-bg: #d4cfc2;
    --scrollbar-thumb: rgba(45, 90, 39, 0.3);
    --scrollbar-thumb-hover: rgba(45, 90, 39, 0.5);
    --overlay-blur: 12px;

    /* Layout */
    --panel-width: 380px;
    --transition-speed: 0.3s;

    /* Design System */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
}

[data-theme="dark"] {
    /* Colors - Dark Theme - Deep Woods & Mystery */
    --primary: #4ade80;
    /* Bright Forest Green */
    --primary-dark: #22c55e;
    --primary-light: rgba(74, 222, 128, 0.12);
    --primary-border: rgba(74, 222, 128, 0.25);
    --accent: #f97316;
    /* Bright Orange */
    --accent-light: rgba(249, 115, 22, 0.12);
    --danger: #ef4444;

    --bg-primary: #1a2f1a;
    /* Deep Forest */
    --bg-secondary: #0f1f0f;
    /* Darker Forest */
    --bg-tertiary: #263826;
    --bg-surface: rgba(26, 47, 26, 0.85);
    --bg-panel: rgba(15, 31, 15, 0.92);
    --bg-canvas: #0a150a;

    --text-primary: #e8f0e8;
    --text-main: #d4e0d4;
    --text-secondary: #a8c0a8;
    --text-tertiary: #7a9a7a;
    --text-muted: #4d6b4d;
    --text-inverse: #0f1f0f;

    --border-color: rgba(74, 222, 128, 0.15);
    --border-light: rgba(74, 222, 128, 0.08);
    --border-subtle: rgba(74, 222, 128, 0.04);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 8px -1px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 20px -3px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 20px 30px -5px rgba(0, 0, 0, 0.7);

    --map-bg: #0a150a;
    --scrollbar-thumb: rgba(74, 222, 128, 0.25);
    --scrollbar-thumb-hover: rgba(74, 222, 128, 0.4);
}

/* ============================================
   BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    overflow: hidden;
    position: fixed;
    width: 100%;
    /* Typography Variables */
    --font-display: 'Black Ops One', cursive;
    --font-heading: 'Oswald', sans-serif;
    --font-body: 'Share Tech Mono', monospace;
    --font-typewriter: 'Special Elite', cursive;
}

body {
    font-family: var(--font-body);
    height: 100%;
    width: 100%;
    overflow: hidden;
    position: fixed;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: 0.3px;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

/* ============================================
   MAP
   ============================================ */
#map {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    background-color: var(--map-bg);
    z-index: 1;
}

/* Adjust map width on desktop when panel is open */
@media (min-width: 769px) {
    #map {
        right: var(--panel-width);
    }

    /* Full width when panel is collapsed */
    body.panel-collapsed #map {
        right: 0;
    }
}

/* Remove blue focus outline from map features */
#map *:focus,
.leaflet-interactive:focus,
svg.leaflet-zoom-animated path {
    outline: none !important;
}

/* Smooth transition for map features */
.leaflet-interactive {
    transition: fill 0.6s ease, stroke 0.6s ease, fill-opacity 0.6s ease;
}

/* ============================================
   CONTROL PANEL - Aged Paper/Field Notes Style
   ============================================ */
.control-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--panel-width);
    background: var(--bg-panel);
    backdrop-filter: blur(var(--overlay-blur));
    -webkit-backdrop-filter: blur(var(--overlay-blur));
    border-left: 1px solid var(--border-color);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    opacity: 0;
    animation: slideInRight 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.4s ease,
        background-color var(--transition-speed) ease;
}

/* Paper texture overlay */
.control-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        repeating-linear-gradient(0deg,
            transparent,
            transparent 24px,
            rgba(0, 0, 0, 0.02) 24px,
            rgba(0, 0, 0, 0.02) 25px),
        repeating-linear-gradient(90deg,
            transparent,
            transparent 100%);
    pointer-events: none;
    z-index: 0;
}

/* Subtle noise grain texture */
.control-panel::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: 0;
}

.control-panel>* {
    position: relative;
    z-index: 1;
}

.control-panel.collapsed {
    transform: translateX(var(--panel-width)) !important;
}

.control-panel::-webkit-scrollbar {
    width: 6px;
}

.control-panel::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}

.control-panel::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* ============================================
   TOGGLE BUTTON
   ============================================ */
.toggle-btn {
    position: fixed;
    top: 24px;
    right: var(--panel-width);
    width: 48px;
    height: 48px;
    background: var(--bg-surface);
    backdrop-filter: blur(var(--overlay-blur));
    -webkit-backdrop-filter: blur(var(--overlay-blur));
    border: 1px solid var(--border-color);
    border-right: none;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    box-shadow: -2px 4px 12px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

.toggle-btn:hover {
    background: var(--bg-primary);
    width: 52px;
}

.toggle-btn:active {
    transform: scale(0.98);
}

.control-panel.collapsed~.toggle-btn {
    right: 24px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

/* Hamburger icon */
.hamburger-line {
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-btn.open .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.toggle-btn.open .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

.toggle-btn.open .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ============================================
   PANEL SECTIONS
   ============================================ */
.info-section,
.search-section,
.controls-section {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

/* Collapsible Sections */
.collapsible .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    margin: 0;
    padding: 0;
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    user-select: none;
}

.collapsible .section-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.collapsible .section-title i {
    color: var(--accent);
    font-size: 14px;
}

.collapsible .section-header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.collapsible .section-chevron {
    font-size: 12px;
    transition: transform 0.3s ease;
    color: var(--text-tertiary);
}

.collapsible.collapsed .section-chevron {
    transform: rotate(-90deg);
}

/* Timeline play button in header */
.timeline-play-sm {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.timeline-play-sm:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.timeline-play-sm.playing {
    background: #dc2626;
}

.timeline-year-sm {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 75px;
    text-align: center;
}

.collapsible .section-content {
    margin-top: 16px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
    max-height: 500px;
    opacity: 1;
}

.collapsible.collapsed .section-content {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

/* Info Section */
.info-section h1 {
    font-family: var(--font-display);
    font-size: 28px;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-weight: 400;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
}

.info-section h1 .title-icon {
    font-size: 0.85em;
    color: var(--accent);
    filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.3));
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--danger);
    color: white;
    border: 2px solid currentColor;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.5px;
    margin-bottom: 16px;
    text-transform: uppercase;
    transform: rotate(-1deg);
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
}

.badge i {
    color: white;
}

.description {
    font-family: var(--font-typewriter);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Search Section */
.search-section label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-tertiary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.search-section label i {
    color: var(--primary);
}

.search-container {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 16px;
    pointer-events: none;
    transition: all 0.2s ease;
}

.search-input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.25s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.search-input::placeholder {
    color: var(--text-tertiary);
    font-family: var(--font-body);
}

.search-input:hover {
    background: var(--bg-primary);
    border-color: var(--primary);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.search-input:focus~.search-icon {
    color: var(--primary);
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    max-height: 240px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow-y: auto;
    z-index: 100;
    display: none;
    padding: 8px 0;
}

.search-dropdown.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

.search-item {
    padding: 10px 16px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.search-item:hover,
.search-item.selected {
    background: var(--bg-tertiary);
    color: var(--primary);
}

.search-item.selected::after {
    content: '✓';
    font-weight: bold;
}

/* Year Slider */
.slider-container {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.year-badge {
    background: var(--primary) !important;
    color: white !important;
    padding: 6px 16px !important;
    border-radius: var(--radius-full) !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    box-shadow: var(--shadow-md) !important;
    letter-spacing: 0.5px;
}

.play-button {
    background: var(--bg-primary);
    color: var(--primary);
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.play-button:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.play-button:active {
    transform: scale(0.95);
}

input[type=range] {
    width: 100%;
    -webkit-appearance: none;
    background: transparent;
    margin: 8px 0;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 24px;
    width: 24px;
    border-radius: var(--radius-full);
    background: var(--bg-primary);
    border: 2px solid var(--primary);
    cursor: pointer;
    margin-top: -10px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: var(--border-color);
    border-radius: 2px;
}

.year-range-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 500;
}

/* Hidden utility class */
.hidden {
    display: none !important;
}

/* Back to Search button */
.back-to-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: var(--primary);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 0;
    margin-bottom: 12px;
    transition: color 0.2s ease;
}

.back-to-search:hover {
    color: var(--primary-hover);
}

.back-to-search i {
    font-size: 12px;
}

/* Stats Section */
.stats-section {
    padding: var(--spacing-lg);
    border-top: 1px solid var(--border-light);
}

#kommune-details h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

#kommune-details h4 {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

/* CSS Bar Chart */
.chart-container {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 140px;
    margin-top: 24px;
    padding: 10px 0;
}

.chart-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    height: 100%;
    justify-content: flex-end;
}

.bar-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    background: var(--bg-tertiary);
    border-radius: 6px;
    position: relative;
}

.bar {
    width: 100%;
    background: var(--primary);
    transition: height 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-radius: 4px 4px 0 0;
}

.bar-label {
    font-size: 10px;
    color: var(--text-tertiary);
    transform: rotate(-45deg);
    transform-origin: center;
    margin-top: 4px;
    white-space: nowrap;
}

.bar-value {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 4px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    z-index: 5;
}

.panel-footer {
    position: sticky;
    bottom: 0;
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid var(--border-light);
    background: var(--bg-panel);
    backdrop-filter: blur(var(--overlay-blur));
    font-size: 12px;
    color: var(--text-tertiary);
    text-align: center;
    z-index: 100;
}

.panel-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

/* ============================================
   CUSTOM MAP TOOLTIP
   ============================================ */
.map-tooltip {
    position: absolute;
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    pointer-events: none;
    box-shadow: var(--shadow-xl);
    z-index: 950;
    opacity: 0;
    transform: translate(-50%, -120%);
    transition: opacity 0.2s ease, transform 0.2s ease;
    font-family: inherit;
    min-width: 240px;
    padding: 0;
    overflow: hidden;
}

.map-tooltip.visible {
    opacity: 1;
    transform: translate(-50%, -110%);
}

.tooltip-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.tooltip-icon {
    width: 36px;
    height: 36px;
    background: #ffffff;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    box-shadow: var(--shadow-sm);
}

.tooltip-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.tooltip-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.tooltip-content {
    padding: 16px;
    text-align: center;
}

.tooltip-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.tooltip-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* ============================================
   MAP LEGEND - Field Guide Style
   ============================================ */
.map-legend {
    position: fixed;
    bottom: 24px;
    right: calc(var(--panel-width) + 24px);
    padding: 14px 16px;
    background: var(--bg-surface);
    backdrop-filter: blur(var(--overlay-blur));
    -webkit-backdrop-filter: blur(var(--overlay-blur));
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 900;
    opacity: 0;
    animation: fadeIn 0.6s ease 0.6s forwards;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

body.panel-collapsed .map-legend {
    right: 24px;
}

.legend-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legend-title {
    font-family: var(--font-heading);
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 4px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-light);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-body);
    font-size: 11px;
    color: var(--text-secondary);
}

.legend-marker {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.legend-marker.class-a {
    background-color: #d45a00;
}

.legend-marker.class-b {
    background-color: #2563eb;
}

.legend-marker.class-c {
    background-color: #6b7280;
}

/* ============================================
   THEME TOGGLE & ZOOM
   ============================================ */
#theme-toggle {
    position: fixed;
    top: 24px;
    left: 24px;
    width: 48px;
    height: 48px;
    background: var(--bg-surface);
    backdrop-filter: blur(var(--overlay-blur));
    -webkit-backdrop-filter: blur(var(--overlay-blur));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    z-index: 1010;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    transition: all 0.2s ease;
    font-size: 20px;
    opacity: 0;
    animation: fadeIn 0.6s ease 0.6s forwards;
}

#theme-toggle:hover {
    transform: scale(1.1);
    background: var(--bg-primary);
}

.zoom-controls {
    position: fixed;
    bottom: 32px;
    left: 24px;
    padding: 6px;
    background: var(--bg-surface);
    backdrop-filter: blur(var(--overlay-blur));
    -webkit-backdrop-filter: blur(var(--overlay-blur));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 6px;
    opacity: 0;
    animation: fadeIn 0.6s ease 0.6s forwards;
}

.zoom-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.zoom-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.zoom-level {
    display: none;
}

/* ============================================
   LOADING POPUP
   ============================================ */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-surface);
    backdrop-filter: blur(var(--overlay-blur));
    -webkit-backdrop-filter: blur(var(--overlay-blur));
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 32px 48px;
    z-index: 10000;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.loading-content {
    text-align: center;
}

.loading-logo {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 400;
    margin-bottom: 12px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.loading-text {
    font-family: var(--font-display);
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    letter-spacing: 1px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 1s linear infinite;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {

    /* Map takes full width on mobile */
    #map {
        right: 0 !important;
    }

    .control-panel {
        width: 100%;
        max-width: 380px;
        border-left: 1px solid var(--border-color);
        border-right: none;
        transform: translateX(100%);
        left: auto;
        right: 0;
    }

    .control-panel.collapsed {
        transform: translateX(100%);
    }

    /* When panel is OPEN (not collapsed), show it */
    .control-panel:not(.collapsed) {
        transform: translateX(0);
    }

    .toggle-btn {
        left: auto;
        right: 20px !important;
        border-radius: var(--radius-lg);
        border: 1px solid var(--border-color);
        z-index: 2001 !important;
        background: var(--bg-surface);
    }

    .control-panel:not(.collapsed)~.toggle-btn {
        left: auto;
        right: 20px !important;
        z-index: 2001 !important;
    }

    /* Show controls on mobile, but position them nicely */
    .map-legend {
        bottom: 24px;
        right: 16px;
        left: auto;
        transform: scale(0.9);
        transform-origin: bottom right;
    }

    .zoom-controls {
        bottom: 24px;
        left: 16px;
    }

    #theme-toggle {
        top: 24px;
        left: 16px;
    }

    /* Hide controls when panel is open on mobile */
    .control-panel:not(.collapsed)~.map-legend,
    .control-panel:not(.collapsed)~.zoom-controls,
    .control-panel:not(.collapsed)~#theme-toggle {
        display: none;
    }

    .panel-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.3);
        /* backdrop-filter: blur(4px); */
        z-index: 999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s;
    }

    .panel-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }
}

/* ============================================
   CUSTOM MARKERS - Bigfoot Footprint Theme
   ============================================ */
.custom-marker {
    background: transparent;
    border: none;
}

.marker-pin {
    width: 32px;
    height: 32px;
    border-radius: 50% 50% 50% 0;
    position: relative;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4), 0 0 0 2px rgba(255, 255, 255, 0.8);
    border: 2px solid rgba(0, 0, 0, 0.2);
}

.marker-pin i,
.marker-pin .marker-icon {
    transform: rotate(45deg);
    color: white;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-pin .marker-icon svg {
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3));
}

.marker-pin.class-a-marker {
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
    }

    50% {
        box-shadow: 0 3px 20px rgba(220, 38, 38, 0.6);
    }
}

/* Marker Clusters - Radar Blip Style */
.marker-cluster-custom {
    background: transparent;
}

.cluster-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-family: var(--font-heading);
    color: white;
    background: rgba(212, 90, 0, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow:
        0 0 0 3px rgba(212, 90, 0, 0.3),
        0 0 15px rgba(212, 90, 0, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.3);
}

.cluster-marker .cluster-count {
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.cluster-marker .cluster-label {
    display: none;
}

.cluster-marker.cluster-high {
    background: rgba(220, 38, 38, 0.9);
    box-shadow:
        0 0 0 4px rgba(220, 38, 38, 0.3),
        0 0 20px rgba(220, 38, 38, 0.5),
        0 2px 8px rgba(0, 0, 0, 0.3);
}

.cluster-marker.cluster-med {
    background: rgba(212, 90, 0, 0.9);
    box-shadow:
        0 0 0 3px rgba(212, 90, 0, 0.3),
        0 0 15px rgba(212, 90, 0, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.3);
}

.cluster-marker.cluster-low {
    background: rgba(45, 90, 39, 0.9);
    box-shadow:
        0 0 0 2px rgba(45, 90, 39, 0.3),
        0 0 10px rgba(45, 90, 39, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .cluster-marker {
    border-color: rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] .cluster-marker.cluster-high {
    background: rgba(239, 68, 68, 0.9);
    box-shadow:
        0 0 0 4px rgba(239, 68, 68, 0.25),
        0 0 25px rgba(239, 68, 68, 0.5),
        0 2px 8px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .cluster-marker.cluster-med {
    background: rgba(249, 115, 22, 0.9);
    box-shadow:
        0 0 0 3px rgba(249, 115, 22, 0.25),
        0 0 20px rgba(249, 115, 22, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .cluster-marker.cluster-low {
    background: rgba(74, 222, 128, 0.85);
    box-shadow:
        0 0 0 2px rgba(74, 222, 128, 0.2),
        0 0 15px rgba(74, 222, 128, 0.35),
        0 2px 8px rgba(0, 0, 0, 0.4);
}

/* ============================================
   FILTER CONTROLS - Field Equipment Style
   ============================================ */
.filter-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-label {
    font-family: var(--font-heading);
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-btn {
    padding: 8px 14px;
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--primary);
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary-dark);
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.15);
}

/* ============================================
   SIGHTING DETAILS - Classified Report Style
   ============================================ */
#sighting-details {
    padding: 0;
    font-family: var(--font-typewriter);
}

.sighting-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.classification-badge {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transform: rotate(-1deg);
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
    border: 2px solid currentColor;
}

.sighting-date {
    font-family: var(--font-body);
    font-size: 11px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-tertiary);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}

.sighting-location {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sighting-location i {
    color: var(--accent);
    font-size: 16px;
}

.sighting-title {
    font-family: var(--font-typewriter);
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.sighting-meta {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border-color);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-body);
    font-size: 11px;
    color: var(--text-secondary);
}

.meta-item i {
    color: var(--primary);
}

.sighting-description,
.sighting-location-details,
.weather-info {
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

.sighting-description h4,
.sighting-location-details h4,
.weather-info h4 {
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sighting-description h4 i,
.sighting-location-details h4 i,
.weather-info h4 i {
    color: var(--primary);
}

.sighting-description p,
.sighting-location-details p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.weather-grid {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.weather-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-md);
}

.weather-item i {
    color: var(--primary);
}

/* Search count badge */
.search-count {
    font-size: 11px;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

/* ============================================
   TIMELINE (in panel)
   ============================================ */
.timeline-panel {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 16px;
    border: 1px solid var(--border-light);
}

.timeline-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.timeline-play,
.timeline-reset {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 12px;
    flex-shrink: 0;
}

.timeline-play:hover,
.timeline-reset:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.timeline-play.playing {
    background: #dc2626;
}

.timeline-all-btn {
    padding: 8px 16px;
    border: 2px solid var(--primary);
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.timeline-all-btn:hover {
    background: var(--primary);
    color: white;
}

.timeline-all-btn.active {
    background: var(--primary);
    color: white;
}

.timeline-info {
    flex: 1;
    min-width: 0;
}

.timeline-year {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    display: block;
}

.timeline-count {
    font-size: 11px;
    color: var(--text-tertiary);
    display: block;
}

.timeline-slider-wrap {
    margin-bottom: 6px;
}

.timeline-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    background: var(--bg-tertiary);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease;
}

.timeline-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.timeline-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-sm);
}

.timeline-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-tertiary);
}

/* Read More Link */
.read-more-link {
    color: var(--primary);
    cursor: pointer;
    font-weight: 600;
    margin-left: 4px;
    text-decoration: none;
    transition: color 0.2s ease;
}

.read-more-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Adaptive Icon for Light/Dark Theme */
.adaptive-icon {
    display: inline-block;
    width: 48px;
    height: 72px;
    background-image: url('assets/bigfoot_black.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    vertical-align: middle;
    margin-right: 10px;
}

[data-theme="dark"] .adaptive-icon {
    background-image: url('assets/bigfoot_white.png');
}