/*
 * QSO Log Map - Premium Dark Theme
 * Radio equipment aesthetics meets modern glassmorphism
 */

:root {
    /* Core palette - deeper, richer blacks */
    --bg-primary: #050507;
    --bg-secondary: rgba(12, 12, 15, 0.85);
    --bg-tertiary: rgba(22, 22, 28, 0.7);
    --bg-elevated: rgba(30, 30, 38, 0.6);
    --bg-hover: rgba(45, 45, 55, 0.5);
    --bg-glass: rgba(15, 15, 20, 0.75);

    /* Text - warmer whites */
    --text-primary: #f0f0f2;
    --text-secondary: #9898a4;
    --text-muted: #5a5a68;

    /* Accent - warm amber/gold (vintage radio dial) */
    --accent: #f0b429;
    --accent-secondary: #22d3ee;
    --accent-dim: #c9930a;
    --accent-glow: rgba(240, 180, 41, 0.12);
    --accent-glow-strong: rgba(240, 180, 41, 0.25);

    /* Band colors - slightly desaturated for elegance */
    --band-160m: #e25555;
    --band-80m: #e8803a;
    --band-60m: #d4a832;
    --band-40m: #7ab82e;
    --band-30m: #2eb87a;
    --band-20m: #2eb8a8;
    --band-17m: #2ea8d4;
    --band-15m: #4a8be8;
    --band-12m: #8a6ae8;
    --band-10m: #c84adf;
    --band-6m: #df4a8a;
    --band-2m: #e85a6a;
    --band-70cm: #e87a8a;
    --band-unknown: #6a6a78;

    /* Borders - subtle glass edges */
    --border-subtle: rgba(255, 255, 255, 0.04);
    --border-default: rgba(255, 255, 255, 0.08);
    --border-accent: rgba(240, 180, 41, 0.25);
    --border-glass: rgba(255, 255, 255, 0.06);

    /* Shadows - deeper, more dramatic */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.03);
    --shadow-glow: 0 0 30px var(--accent-glow);

    /* Spacing */
    --sidebar-width: 300px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Transitions */
    --transition-fast: 120ms cubic-bezier(0.25, 0.1, 0.25, 1);
    --transition-normal: 200ms cubic-bezier(0.25, 0.1, 0.25, 1);
    --transition-slow: 350ms cubic-bezier(0.25, 0.1, 0.25, 1);

    /* Blur */
    --blur-sm: 8px;
    --blur-md: 16px;
    --blur-lg: 24px;

    /* Map tile filter */
    --map-filter: none;
    --map-tiles: 'dark';
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f3f5;
    --bg-elevated: #ffffff;
    --bg-hover: rgba(0, 0, 0, 0.05);
    --bg-glass: rgba(255, 255, 255, 0.95);

    --text-primary: #212529;
    --text-secondary: #495057;
    --text-muted: #868e96;

    --accent: #e67e00;
    --accent-secondary: #0c8599;
    --accent-dim: #d9730d;
    --accent-glow: rgba(230, 126, 0, 0.12);
    --accent-glow-strong: rgba(230, 126, 0, 0.2);

    --border-subtle: rgba(0, 0, 0, 0.08);
    --border-default: rgba(0, 0, 0, 0.12);
    --border-accent: rgba(230, 126, 0, 0.4);
    --border-glass: rgba(0, 0, 0, 0.1);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 1);

    --map-filter: none;
    --map-tiles: 'light';
}

/* Hidden attribute override */
[hidden] {
    display: none !important;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* App Container */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    background:
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(240, 180, 41, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 60%, rgba(34, 211, 238, 0.02) 0%, transparent 50%),
        var(--bg-primary);
}

/* ========================================
   SIDEBAR - Glassmorphism
   ======================================== */

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100%;
    background: var(--bg-glass);
    backdrop-filter: blur(var(--blur-lg));
    -webkit-backdrop-filter: blur(var(--blur-lg));
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: var(--shadow-inset), 4px 0 24px rgba(0, 0, 0, 0.3);
}

/* Sidebar Header */
.sidebar-header {
    padding: 20px 18px;
    border-bottom: 1px solid var(--border-subtle);
    background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, transparent 100%);
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-glow) 0%, transparent 100%);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-md);
    color: var(--accent);
    position: relative;
    overflow: hidden;
}

.logo-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 40%, rgba(240, 180, 41, 0.1) 100%);
}

.logo-icon svg {
    width: 22px;
    height: 22px;
    position: relative;
    z-index: 1;
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.logo-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-subtitle {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
}

/* Sidebar Content */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-content::-webkit-scrollbar {
    width: 5px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

/* ========================================
   PANELS - Glass Cards
   ======================================== */

.panel {
    background: var(--bg-tertiary);
    backdrop-filter: blur(var(--blur-sm));
    -webkit-backdrop-filter: blur(var(--blur-sm));
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 14px;
    box-shadow: var(--shadow-inset), var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-subtle);
}

.panel-title svg {
    width: 14px;
    height: 14px;
    opacity: 0.6;
}

/* Upload Panel */
.upload-zone {
    position: relative;
    border: 1px dashed var(--border-default);
    border-radius: var(--radius-md);
    padding: 24px 14px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    overflow: hidden;
    background: linear-gradient(180deg, rgba(255,255,255,0.01) 0%, transparent 100%);
}

.upload-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 0%, var(--accent-glow) 0%, transparent 70%);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.upload-zone:hover::before,
.upload-zone.drag-over::before {
    opacity: 1;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--accent);
    border-style: solid;
}

.upload-zone.drag-over {
    transform: scale(1.01);
}

.upload-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 10px;
    color: var(--text-muted);
    transition: all var(--transition-normal);
    position: relative;
    z-index: 1;
}

.upload-zone:hover .upload-icon {
    color: var(--accent);
    transform: translateY(-2px);
}

.upload-icon svg {
    width: 100%;
    height: 100%;
}

.upload-text {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-size: 13px;
    position: relative;
    z-index: 1;
}

.upload-hint {
    font-size: 11px;
    color: var(--text-muted);
    position: relative;
    z-index: 1;
}

.upload-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--bg-primary);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.upload-progress.active {
    opacity: 1;
}

.upload-progress .progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
    transition: width var(--transition-normal);
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding: 8px 10px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    border: 1px solid var(--border-subtle);
}

.file-name {
    color: var(--accent);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: all var(--transition-fast);
    border-radius: 4px;
}

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

/* Stats Panel */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.stat-card {
    background: linear-gradient(135deg, var(--bg-elevated) 0%, rgba(30, 30, 38, 0.3) 100%);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-fast);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.stat-card:hover::before {
    opacity: 0.5;
}

.stat-card:hover {
    border-color: var(--border-default);
    transform: translateY(-1px);
}

.stat-value {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 20px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.stat-label {
    display: block;
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 4px;
    font-weight: 500;
}

/* Filter Groups */
.filter-group {
    margin-bottom: 14px;
}

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

.filter-label {
    display: block;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

/* Filter Chips */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
}

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

.filter-chip.active {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
}

.filter-chip .count {
    font-size: 9px;
    opacity: 0.5;
}

.filter-chip .color-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Filter Input */
.filter-input,
.filter-select {
    width: 100%;
    padding: 9px 11px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.filter-input::placeholder {
    color: var(--text-muted);
}

/* Field hint for required state */
.field-hint {
    display: none;
    font-size: 9px;
    margin-top: 4px;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.filter-group.needs-attention .field-hint {
    display: block;
    color: var(--accent);
}

.filter-group.needs-attention .filter-input {
    border-color: var(--border-accent);
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.filter-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%235a5a68' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

/* Reset Button */
.btn-reset {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 9px;
    margin-top: 14px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.btn-reset svg {
    width: 12px;
    height: 12px;
}

/* Toggle Group */
.toggle-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.toggle input {
    display: none;
}

.toggle-slider {
    width: 32px;
    height: 18px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 9px;
    position: relative;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--text-muted);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: all var(--transition-fast);
}

.toggle input:checked + .toggle-slider {
    background: var(--accent-glow-strong);
    border-color: var(--accent);
}

.toggle input:checked + .toggle-slider::after {
    background: var(--accent);
    transform: translateX(14px);
}

.toggle-disabled {
    opacity: 0.35;
    pointer-events: none;
}

.toggle-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ========================================
   MAIN CONTENT
   ======================================== */

.main-content {
    flex: 1;
    position: relative;
    background: var(--bg-primary);
}

#map {
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
}

#globe {
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
}

/* View Toggle Button (2D/3D) */
.view-toggle {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 100000;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-glass);
    backdrop-filter: blur(var(--blur-sm));
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-md);
}

.view-toggle:hover {
    color: var(--accent);
    border-color: var(--border-accent);
    box-shadow: var(--shadow-md), 0 0 12px var(--accent-glow);
}

.view-toggle.active {
    color: var(--accent);
    border-color: var(--accent-dim);
    background: var(--accent-glow);
}

.view-toggle svg {
    width: 16px;
    height: 16px;
}

/* Dark map tiles */
.leaflet-container {
    background: var(--bg-primary);
    font-family: 'Outfit', sans-serif;
}

.leaflet-control-zoom {
    border: none !important;
    box-shadow: var(--shadow-md) !important;
    border-radius: var(--radius-sm) !important;
    overflow: hidden;
}

.leaflet-control-zoom a {
    background: var(--bg-glass) !important;
    backdrop-filter: blur(var(--blur-sm)) !important;
    color: var(--text-primary) !important;
    border: none !important;
    border-bottom: 1px solid var(--border-subtle) !important;
    width: 30px !important;
    height: 30px !important;
    line-height: 30px !important;
    font-size: 14px !important;
}

.leaflet-control-zoom a:last-child {
    border-bottom: none !important;
}

.leaflet-control-zoom a:hover {
    background: var(--bg-hover) !important;
    color: var(--accent) !important;
}

.leaflet-control-zoom-in {
    border-radius: 0 !important;
}

.leaflet-control-zoom-out {
    border-radius: 0 !important;
}

.leaflet-control-attribution {
    background: var(--bg-glass) !important;
    backdrop-filter: blur(var(--blur-sm)) !important;
    color: var(--text-muted) !important;
    font-size: 9px !important;
    padding: 3px 8px !important;
    border-radius: var(--radius-sm) 0 0 0 !important;
}

.leaflet-control-attribution a {
    color: var(--text-secondary) !important;
}

/* Custom markers - Dot style (default) */
.qso-marker {
    background: var(--accent);
    border: 2px solid rgba(5, 5, 7, 0.8);
    border-radius: 50%;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        0 0 20px var(--accent-glow);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.qso-marker:hover {
    transform: scale(1.4);
    z-index: 1000 !important;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.6),
        0 0 0 2px rgba(255, 255, 255, 0.15),
        0 0 30px var(--accent-glow-strong);
}

/* Custom markers - Pin style */
.qso-marker-pin {
    width: 20px !important;
    height: 28px !important;
    background: transparent !important;
    border: none !important;
    position: relative;
    transition: transform var(--transition-fast);
    --pin-color: var(--accent);
}

.qso-marker-pin .pin-shape {
    position: absolute;
    top: 0;
    left: 50%;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(5, 5, 7, 0.8);
    border-radius: 50% 50% 50% 0;
    transform: translateX(-50%) rotate(-45deg);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        0 0 15px rgba(240, 180, 41, 0.12);
    transition: box-shadow var(--transition-fast);
}

.qso-marker-pin .pin-highlight {
    position: absolute;
    top: 4px;
    left: 50%;
    width: 7px;
    height: 7px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 50% 50% 50% 0;
    transform: translateX(-50%) rotate(-45deg);
    pointer-events: none;
}

.qso-marker-pin:hover {
    transform: scale(1.3) translateY(-3px);
    z-index: 1000 !important;
}

.qso-marker-pin:hover .pin-shape {
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.6),
        0 0 0 2px rgba(255, 255, 255, 0.15),
        0 0 25px rgba(240, 180, 41, 0.25);
}

[data-theme="light"] .qso-marker-pin .pin-shape {
    border-color: rgba(255, 255, 255, 0.9);
}

/* Cluster markers */
.marker-cluster-custom {
    background: transparent !important;
}

.marker-cluster-custom .cluster-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-glass);
    backdrop-filter: blur(var(--blur-sm));
    border: 1px solid var(--accent);
    border-radius: 50%;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.4),
        0 0 20px var(--accent-glow);
}

.marker-cluster {
    background: var(--accent-glow-strong) !important;
    border: 2px solid var(--accent) !important;
}

.marker-cluster div {
    background: var(--bg-elevated) !important;
    color: var(--accent) !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-weight: 600 !important;
}

/* Popup styling */
.leaflet-popup-content-wrapper {
    background: var(--bg-glass) !important;
    backdrop-filter: blur(var(--blur-md)) !important;
    -webkit-backdrop-filter: blur(var(--blur-md)) !important;
    border: 1px solid var(--border-glass) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
    padding: 0 !important;
}

.leaflet-popup-content {
    margin: 0 !important;
    font-family: 'Outfit', sans-serif !important;
}

.leaflet-popup-tip {
    background: var(--bg-glass) !important;
    border: 1px solid var(--border-glass) !important;
    box-shadow: none !important;
}

.leaflet-popup-close-button {
    color: var(--text-muted) !important;
    font-size: 18px !important;
    padding: 6px 8px !important;
    transition: color var(--transition-fast) !important;
}

.leaflet-popup-close-button:hover {
    color: var(--text-primary) !important;
}

/* Popup content */
.qso-popup {
    padding: 14px;
    min-width: 180px;
}

.qso-popup-call {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    letter-spacing: 0.02em;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.qso-popup-call::after {
    content: ' ↗';
    font-size: 12px;
    opacity: 0.5;
}

.qso-popup-call:hover {
    filter: brightness(1.2);
    text-decoration: underline;
    text-decoration-color: var(--accent);
}

.qso-popup-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.qso-popup-item {
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    min-width: 60px;
    border: 1px solid var(--border-subtle);
}

.qso-popup-label {
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.qso-popup-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-primary);
}

/* ========================================
   INFO PANEL
   ======================================== */

.info-panel {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 280px;
    background: var(--bg-glass);
    backdrop-filter: blur(var(--blur-lg));
    -webkit-backdrop-filter: blur(var(--blur-lg));
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    overflow: hidden;
}

.info-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-subtle);
    background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, transparent 100%);
}

.info-title {
    font-weight: 500;
    font-size: 13px;
    color: var(--text-primary);
}

.info-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color var(--transition-fast);
}

.info-close:hover {
    color: var(--text-primary);
}

.info-content {
    padding: 14px;
    max-height: 350px;
    overflow-y: auto;
}

/* ========================================
   LEGEND
   ======================================== */

.legend {
    position: absolute;
    bottom: 24px;
    right: 16px;
    background: var(--bg-glass);
    backdrop-filter: blur(var(--blur-md));
    -webkit-backdrop-filter: blur(var(--blur-md));
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 12px;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}

.legend-title {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-subtle);
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--text-secondary);
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* ========================================
   LOADING & EMPTY STATES
   ======================================== */

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(5, 5, 7, 0.9);
    backdrop-filter: blur(var(--blur-sm));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.spinner-ring {
    width: 44px;
    height: 44px;
    border: 2px solid var(--bg-elevated);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    font-size: 13px;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
    z-index: 10;
    pointer-events: none;
}

.empty-icon {
    width: 70px;
    height: 70px;
    color: var(--text-muted);
    opacity: 0.2;
    margin-bottom: 20px;
}

.empty-icon svg {
    width: 100%;
    height: 100%;
}

.empty-title {
    font-size: 22px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.empty-text {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 260px;
    line-height: 1.6;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform var(--transition-slow);
        z-index: 200;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        width: 100%;
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */

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

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.panel {
    animation: slideUp 0.25s ease-out;
}

.stat-card {
    animation: fadeIn 0.3s ease-out;
    animation-fill-mode: both;
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }

.filter-chip {
    animation: fadeIn 0.15s ease-out;
    animation-fill-mode: both;
}

/* Subtle noise texture overlay */
.app-container::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.015;
    pointer-events: none;
    z-index: 9999;
}

/* ========================================
   TAB NAVIGATION
   ======================================== */

.tab-nav {
    display: flex;
    border-bottom: 1px solid var(--border-subtle);
    background: linear-gradient(180deg, rgba(255,255,255,0.015) 0%, transparent 100%);
}

.tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.tab-btn svg {
    width: 18px;
    height: 18px;
    transition: all var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-secondary);
    background: rgba(255,255,255,0.02);
}

.tab-btn.active {
    color: var(--accent);
}

.tab-btn.active svg {
    color: var(--accent);
}

.tab-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--accent);
    opacity: 0;
    transform: scaleX(0);
    transition: all var(--transition-fast);
}

.tab-btn.active::after {
    opacity: 1;
    transform: scaleX(1);
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ========================================
   STATS DETAIL PANEL
   ======================================== */

.stats-detail-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.stat-row-label {
    font-size: 11px;
    color: var(--text-secondary);
}

.stat-row-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
}

/* ========================================
   CHARTS
   ======================================== */

.chart-panel {
    padding-bottom: 10px;
}

.chart-container {
    height: 140px;
    position: relative;
}

.chart-container-wide {
    height: 100px;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ========================================
   TOP LIST
   ======================================== */

.top-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
}

.top-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.top-list-rank {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--text-muted);
    width: 18px;
    text-align: center;
}

.top-list-name {
    flex: 1;
    font-size: 12px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-list-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--accent);
}

/* ========================================
   EXPORT BUTTONS
   ======================================== */

.export-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-export {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-export svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

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

.btn-export:hover svg {
    color: var(--accent);
}

/* ========================================
   PROGRESS BARS
   ======================================== */

.progress-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.progress-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
}

.progress-header span:last-child {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent);
}

.progress-bar-container {
    height: 6px;
    background: var(--bg-elevated);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
    border-radius: 3px;
    transition: width var(--transition-slow);
}

/* ========================================
   CONTINENT GRID
   ======================================== */

.continent-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.continent-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.continent-item.worked {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.continent-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.continent-item.worked .continent-code {
    color: var(--accent);
}

.continent-status {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

.continent-item.worked .continent-status {
    color: var(--text-secondary);
}

/* ========================================
   ZONES GRID
   ======================================== */

.zones-info {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-bottom: 10px;
}

.zones-worked {
    font-family: 'JetBrains Mono', monospace;
    font-size: 20px;
    font-weight: 600;
    color: var(--accent);
}

.zones-total {
    font-size: 12px;
    color: var(--text-muted);
}

.zones-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}

.zone-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.zone-item.worked {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
}

/* ========================================
   MODAL
   ======================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease-out;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-description {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.screenshot-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
}

.checkbox-option input {
    display: none;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 1px solid var(--border-default);
    border-radius: 4px;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.checkbox-custom::after {
    content: '✓';
    font-size: 11px;
    color: var(--accent);
    opacity: 0;
    transform: scale(0);
    transition: all var(--transition-fast);
}

.checkbox-option input:checked + .checkbox-custom {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.checkbox-option input:checked + .checkbox-custom::after {
    opacity: 1;
    transform: scale(1);
}

.screenshot-options .filter-input {
    margin-left: 28px;
    width: calc(100% - 28px);
    margin-top: -4px;
    margin-bottom: 6px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-subtle);
    justify-content: flex-end;
}

.btn-modal {
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-cancel {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

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

.btn-primary {
    background: var(--accent);
    border: 1px solid var(--accent);
    color: #000;
}

.btn-primary:hover {
    background: var(--accent-dim);
    border-color: var(--accent-dim);
}

/* ========================================
   THEME TOGGLE
   ======================================== */

.theme-toggle {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--border-default);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.theme-toggle:hover svg {
    color: var(--accent);
}

/* Show/hide icons based on theme */
.theme-toggle .icon-sun {
    display: none;
}

.theme-toggle .icon-moon {
    display: block;
}

[data-theme="light"] .theme-toggle .icon-sun {
    display: block;
}

[data-theme="light"] .theme-toggle .icon-moon {
    display: none;
}

/* Adjust sidebar header for toggle */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Light theme specific overrides */
[data-theme="light"] .app-container {
    background:
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(212, 148, 10, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 60%, rgba(8, 145, 178, 0.03) 0%, transparent 50%),
        var(--bg-primary);
}

[data-theme="light"] .app-container::after {
    opacity: 0.02;
}

[data-theme="light"] .stat-value {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="light"] .logo-title {
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="light"] .qso-popup-call {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Light theme leaflet adjustments */
[data-theme="light"] .leaflet-control-zoom a {
    background: var(--bg-glass) !important;
    color: var(--text-primary) !important;
}

[data-theme="light"] .leaflet-control-attribution {
    background: var(--bg-glass) !important;
    color: var(--text-muted) !important;
}

[data-theme="light"] .qso-marker {
    border-color: rgba(255, 255, 255, 0.9);
}

[data-theme="light"] .leaflet-popup-content-wrapper {
    background: var(--bg-glass) !important;
    border-color: var(--border-glass) !important;
}

[data-theme="light"] .leaflet-popup-tip {
    background: #ffffff !important;
    border: none !important;
}

/* Light theme - better stat cards */
[data-theme="light"] .stat-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .stat-value {
    background: linear-gradient(135deg, #e67e00 0%, #0c8599 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Light theme - better panels */
[data-theme="light"] .panel {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Light theme - better popups */
[data-theme="light"] .leaflet-popup-content-wrapper {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15) !important;
}

[data-theme="light"] .qso-popup-call {
    background: linear-gradient(135deg, #e67e00 0%, #0c8599 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="light"] .qso-popup-item {
    background: #f1f3f5;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Light theme - better filter chips */
[data-theme="light"] .filter-chip {
    background: #f8f9fa;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .filter-chip:hover {
    background: #f1f3f5;
}

[data-theme="light"] .filter-chip.active {
    background: rgba(230, 126, 0, 0.1);
    border-color: #e67e00;
    color: #d9730d;
}

/* Light theme - better inputs */
[data-theme="light"] .filter-input,
[data-theme="light"] .filter-select {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .filter-input:focus,
[data-theme="light"] .filter-select:focus {
    border-color: #e67e00;
    box-shadow: 0 0 0 3px rgba(230, 126, 0, 0.15);
}

/* Light theme - sidebar */
[data-theme="light"] .sidebar {
    background: #ffffff;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.04);
}

/* Light theme - upload zone */
[data-theme="light"] .upload-zone {
    background: #f8f9fa;
    border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .upload-zone:hover {
    background: rgba(230, 126, 0, 0.05);
    border-color: #e67e00;
}

/* Light theme - legend */
[data-theme="light"] .legend {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* Light theme - buttons */
[data-theme="light"] .btn-export {
    background: #f8f9fa;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .btn-export:hover {
    background: #f1f3f5;
}

/* Light theme - toggles */
[data-theme="light"] .toggle-slider {
    background: #e9ecef;
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .toggle input:checked + .toggle-slider {
    background: rgba(230, 126, 0, 0.2);
    border-color: #e67e00;
}

[data-theme="light"] .toggle input:checked + .toggle-slider::after {
    background: #e67e00;
}
