/* CleverTech Telecom Dashboard - Ubiquiti / Apple-Inspired Theme */

/* ── Design Tokens (Dark Mode Default) ── */
:root {
    --bg-base: #111113;
    --bg-panel: #1c1c1e;
    --bg-elevated: #2c2c2e;
    --bg-surface: #3a3a3c;
    --bg-panel-translucent: rgba(28,28,30,0.85);
    --bg-base-overlay: rgba(17,17,19,0.80);
    --border-color: rgba(255,255,255,0.08);
    --border-active: rgba(255,255,255,0.16);
    --text-primary: #f5f5f7;
    --text-secondary: #a1a1a6;
    --text-tertiary: #6e6e73;
    --accent: #714a8b;
    --accent-hover: #a57bc2;
    --accent-subtle: rgba(113,74,139,0.10);
    --success: #30d158;
    --warning: #ff9f0a;
    --error: #ff453a;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.35);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --transition-fast: 150ms ease;
    --transition-normal: 200ms ease;
}

/* ── Light Mode Overrides ── */
[data-theme="light"] {
    --bg-base: #f5f5f7;
    --bg-panel: #ffffff;
    --bg-elevated: #f0f0f2;
    --bg-surface: #e5e5ea;
    --bg-panel-translucent: rgba(255,255,255,0.85);
    --bg-base-overlay: rgba(245,245,247,0.80);
    --border-color: rgba(0,0,0,0.08);
    --border-active: rgba(0,0,0,0.16);
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-tertiary: #a1a1a6;
    --accent: #714a8b;
    --accent-hover: #4a2c5f;
    --accent-subtle: rgba(113,74,139,0.08);
    --success: #28a745;
    --warning: #e67e00;
    --error: #e6362e;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

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

/* ── Base ── */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text',
                 'Segoe UI', system-ui, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ── Focus Visible ── */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ── Color Scheme (system UI elements) ── */
select, input {
    color-scheme: dark;
}
[data-theme="light"] select,
[data-theme="light"] input {
    color-scheme: light;
}

/* ══════════════════════════════════════════
   Header
   ══════════════════════════════════════════ */
.header {
    background: var(--bg-panel);
    color: var(--text-primary);
    padding: 0 var(--space-4);
    height: 48px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    position: relative;
    flex-shrink: 0;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-content {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
    text-decoration: none;
    color: inherit;
    transition: opacity var(--transition-fast);
}

.logo:hover {
    opacity: 0.85;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.logo-img {
    display: block;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.logo h1 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--text-primary);
}

.logo .subtitle {
    font-weight: 400;
    font-size: 11px;
    line-height: 1.2;
    color: var(--text-tertiary);
    display: block;
    letter-spacing: 0;
}

.header-stats {
    display: flex;
    gap: var(--space-6);
    margin-left: auto;
}

.stat-item {
    text-align: center;
}

.stat-item .stat-value {
    display: block;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.1;
    color: var(--accent);
}

.stat-item .stat-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1;
    color: var(--text-tertiary);
}

/* ── Theme Toggle ── */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: background-color var(--transition-fast),
                color var(--transition-fast),
                border-color var(--transition-fast);
    flex-shrink: 0;
    margin-left: var(--space-4);
}

.theme-toggle:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border-active);
}

.theme-icon--light { display: block; }
.theme-icon--dark  { display: none; }

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

/* ── Mobile Menu Button ── */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    margin-left: var(--space-2);
}

.mobile-menu-btn span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 1px;
    transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}
.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ══════════════════════════════════════════
   Layout
   ══════════════════════════════════════════ */
.main-container {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

/* ══════════════════════════════════════════
   Sidebar
   ══════════════════════════════════════════ */
.sidebar {
    width: 280px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: var(--space-4);
    flex-shrink: 0;
    transition: transform 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-surface) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
    background: var(--bg-surface);
    border-radius: 3px;
}

.sidebar-section {
    margin-bottom: var(--space-5);
}

.sidebar-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1;
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.sidebar-title svg {
    flex-shrink: 0;
}

/* ── Coordinate Form ── */
.coord-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.coord-form:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-subtle);
}

.coord-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.coord-field label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: visible;
}

.coord-field input {
    height: 36px;
    padding: 0 var(--space-3);
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
    font-family: inherit;
    width: 100%;
    min-width: 0;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

.coord-field input::placeholder {
    color: var(--text-tertiary);
    font-size: 13px;
    opacity: 0.8;
}

.coord-field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-subtle);
    background: var(--bg-panel);
}

.coord-field input:hover:not(:focus) {
    border-color: var(--border-active);
}

.coord-field input.coord-input-error {
    border-color: var(--error);
    box-shadow: 0 0 0 2px rgba(255, 69, 58, 0.15);
}

.coord-error {
    font-size: 12px;
    color: var(--error);
    min-height: 0;
    overflow: hidden;
    transition: min-height var(--transition-fast), opacity var(--transition-fast);
    opacity: 0;
    line-height: 1.3;
}

.coord-error.visible {
    min-height: 18px;
    opacity: 1;
}

.coord-go-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    margin-top: var(--space-1);
    transition: background-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.coord-go-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 111, 255, 0.3);
}

.coord-go-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.coord-go-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── Radius group inside coord form ── */
.coord-radius-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid var(--border-color);
}

/* Screen reader only utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Filter Groups ── */
.filter-group {
    margin-bottom: var(--space-3);
}

.filter-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-1);
    letter-spacing: 0.01em;
    line-height: 1.3;
}

.filter-group select {
    width: 100%;
    height: 32px;
    padding: 0 var(--space-2);
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-primary);
    font-family: inherit;
    cursor: pointer;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.filter-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-subtle);
}

.filter-group select option {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

/* ── Buttons ── */
.btn {
    width: 100%;
    height: 32px;
    padding: 0 var(--space-3);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color var(--transition-fast),
                color var(--transition-fast),
                border-color var(--transition-fast);
    margin-bottom: var(--space-1);
    line-height: 1;
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
}

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

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

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

/* ── Carrier Legend ── */
.carrier-legend {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color var(--transition-fast),
                border-color var(--transition-fast),
                box-shadow var(--transition-fast),
                opacity var(--transition-fast);
    border: 1px solid transparent;
    user-select: none;
}

.legend-item:hover {
    background: var(--bg-elevated);
}

.legend-item.active {
    background: var(--accent-subtle);
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-subtle);
    font-weight: 600;
}

.legend-item.dimmed {
    opacity: 0.4;
}

.legend-item.dimmed .legend-color {
    filter: grayscale(60%);
}

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

/* ── Stats Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
}

.stat-box {
    background: var(--bg-elevated);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.stat-box .stat-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1;
    margin-bottom: var(--space-1);
}

.stat-box .stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--accent);
}

/* ── Export Buttons ── */
.export-buttons {
    display: flex;
    gap: var(--space-2);
}

.export-buttons .btn {
    width: 50%;
    margin-bottom: 0;
}

.export-info {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-bottom: var(--space-2);
    line-height: 1.4;
}

.export-mode-toggle {
    margin-bottom: var(--space-2);
}

.export-mode-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.export-mode-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ── Carrier Toggle Buttons ── */
.carrier-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
}

.carrier-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-tertiary);
    font-size: 11px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background-color var(--transition-fast),
                color var(--transition-fast),
                border-color var(--transition-fast),
                opacity var(--transition-fast);
    user-select: none;
    opacity: 0.6;
}

.carrier-toggle:hover {
    background: var(--bg-elevated);
    opacity: 0.85;
}

.carrier-toggle.active {
    background: var(--bg-elevated);
    border-color: var(--border-active);
    color: var(--text-primary);
    font-weight: 600;
    opacity: 1;
}

.carrier-toggle-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Inactive toggle dot is desaturated */
.carrier-toggle:not(.active) .carrier-toggle-dot {
    opacity: 0.4;
    filter: grayscale(60%);
}

/* ── Coordinate Paste Success Flash ── */
.coord-field input.coord-paste-success {
    border-color: var(--success);
    box-shadow: 0 0 0 2px rgba(48, 209, 88, 0.2);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ══════════════════════════════════════════
   Map Container
   ══════════════════════════════════════════ */
.map-container {
    flex: 1;
    position: relative;
    background: var(--bg-base);
    min-width: 0;
}

#map {
    width: 100%;
    height: 100%;
}

/* ── Loading Overlay ── */
.loading-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-base-overlay);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: var(--space-4);
    z-index: 999;
    backdrop-filter: blur(8px);
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-overlay p {
    font-size: 13px;
    color: var(--text-secondary);
}

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

/* ── Info Panel ── */
.info-panel {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: var(--bg-panel-translucent);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: var(--space-4);
    max-width: 300px;
    z-index: 999;
    display: none;
    color: var(--text-primary);
}

.info-panel.active {
    display: block;
}

.info-close {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-tertiary);
    transition: color var(--transition-fast);
    padding: 0;
}

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

.info-hint {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ── Tower Counter ── */
.tower-counter {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: var(--bg-panel-translucent);
    backdrop-filter: blur(8px);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    z-index: 500;
    letter-spacing: 0.02em;
    line-height: 1;
}

.limit-reached {
    color: var(--warning);
}

/* ══════════════════════════════════════════
   Leaflet Overrides
   ══════════════════════════════════════════ */

/* Popup */
.leaflet-popup-content-wrapper {
    background: var(--bg-panel) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-md) !important;
    border: 1px solid var(--border-color);
    padding: 0 !important;
}

.leaflet-popup-content {
    margin: 0 !important;
    font-size: 13px;
    line-height: 1.4;
}

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

.leaflet-popup-close-button {
    color: var(--text-tertiary) !important;
    font-size: 18px !important;
    width: 24px !important;
    height: 24px !important;
    top: 8px !important;
    right: 8px !important;
}

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

/* -- Popup Scroll Area -- */
.popup-scroll {
    max-height: min(50vh, 400px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-surface) transparent;
}

.popup-scroll::-webkit-scrollbar {
    width: 5px;
}

.popup-scroll::-webkit-scrollbar-track {
    background: transparent;
    margin: 4px 0;
}

.popup-scroll::-webkit-scrollbar-thumb {
    background: var(--bg-surface);
    border-radius: 3px;
}

.popup-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* -- Sector Polygon Popup -- */
.sector-popup {
    font-family: inherit;
    min-width: 220px;
    max-width: 340px;
    padding: 14px 16px;
}

.sector-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 8px;
    padding-right: 28px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-primary);
}

.sector-popup-badge {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary, var(--text-tertiary));
    background: var(--bg-surface);
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.sector-popup-body {
    max-height: min(40vh, 320px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-surface) transparent;
}

.sector-popup-body::-webkit-scrollbar {
    width: 5px;
}

.sector-popup-body::-webkit-scrollbar-track {
    background: transparent;
    margin: 4px 0;
}

.sector-popup-body::-webkit-scrollbar-thumb {
    background: var(--bg-surface);
    border-radius: 3px;
}

.sector-popup-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

.sector-popup-row {
    display: grid;
    grid-template-columns: 10px 1fr;
    gap: 0 8px;
    padding: 6px 4px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--text-primary);
    transition: background 0.15s;
}

.sector-popup-row:hover {
    background: rgba(128, 128, 128, 0.12);
}

.sector-popup-row + .sector-popup-row {
    border-top: 1px solid var(--border-color);
}

.sector-popup-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 3px;
}

.sector-popup-carrier {
    font-weight: 600;
    font-size: 13px;
}

.sector-popup-detail {
    grid-column: 2;
    font-size: 12px;
    color: var(--text-secondary, var(--text-tertiary));
    line-height: 1.4;
}

.sector-popup-id {
    grid-column: 2;
    font-size: 11px;
    color: var(--text-tertiary);
}

/* ── Cluster tiers  ── */
.ct-cluster {
    border-radius: 50%;
    text-align: center;
    transition: transform 0.25s ease, opacity 0.25s ease;
}
.ct-cluster div {
    width: 100%; height: 100%;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: inherit;
    font-weight: 700;
    color: #fff;
    transition: background-color 0.25s ease;
}
.ct-cluster span {
    line-height: 1;
}

/* Size tiers: small (< 25) */
.ct-cluster-small {
    background: rgba(113, 74, 139, 0.18);
}
.ct-cluster-small div {
    background: var(--accent);
    font-size: 12px;
}

/* medium (25-99) */
.ct-cluster-medium {
    background: rgba(113, 74, 139, 0.22);
}
.ct-cluster-medium div {
    background: #5a3b6f;
    font-size: 13px;
}

/* large (100-499) */
.ct-cluster-large {
    background: rgba(74, 44, 95, 0.25);
}
.ct-cluster-large div {
    background: #4a2c5f;
    font-size: 14px;
}

/* x-large (500+) */
.ct-cluster-x-large {
    background: rgba(74, 44, 95, 0.30);
}
.ct-cluster-x-large div {
    background: #3a1f4f;
    font-size: 15px;
}

/* Light mode adjustments for cluster rings */
[data-theme="light"] .ct-cluster-small  { background: rgba(113, 74, 139, 0.12); }
[data-theme="light"] .ct-cluster-medium { background: rgba(113, 74, 139, 0.16); }
[data-theme="light"] .ct-cluster-large  { background: rgba(74, 44, 95, 0.18); }
[data-theme="light"] .ct-cluster-x-large{ background: rgba(74, 44, 95, 0.22); }

/* Smooth cluster entrance via Leaflet's .leaflet-marker-icon */
.leaflet-cluster-anim .leaflet-marker-icon,
.leaflet-cluster-anim .leaflet-marker-shadow {
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

/* Legacy fallback (if default markercluster classes still appear) */
.marker-cluster div {
    background-color: var(--accent) !important;
    color: #ffffff !important;
    font-family: inherit;
    font-weight: 600;
}

.marker-cluster {
    background-color: var(--accent-subtle) !important;
}

/* Leaflet Controls */
.leaflet-control-zoom a {
    background-color: var(--bg-panel) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

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

.leaflet-control-attribution {
    background: var(--bg-panel-translucent) !important;
    color: var(--text-tertiary) !important;
    font-size: 10px !important;
}

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

/* ══════════════════════════════════════════
   Mobile Responsiveness (768px breakpoint)
   ══════════════════════════════════════════ */
@media (max-width: 768px) {
    .mobile-hide {
        display: none !important;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .sidebar {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        transform: translateX(-100%);
        z-index: 1001;
    }

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

    .header-stats {
        gap: var(--space-4);
    }

    .header {
        height: auto;
        min-height: 48px;
        padding: var(--space-2) var(--space-3);
    }
}


/* ─ GPS Lookup ─ */
.gps-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.gps-label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .5px; font-weight: 500; }
.gps-input { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-tertiary); color: var(--text-primary); font-family: inherit; font-size: 13px; }
.gps-input:focus { outline: none; border-color: var(--accent); }
.gps-slider { width: 100%; accent-color: var(--accent); cursor: pointer; }
.gps-slider-value { text-align: center; font-size: 12px; color: var(--text-secondary); margin-top: -4px; }
.gps-btn { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; padding: 8px; margin-top: 2px; }
.gps-results { border-top: 1px solid var(--border); padding-top: 10px; }
.gps-results-header { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; }
.btn-clear { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); padding: 3px 10px; border-radius: 6px; font-size: 11px; cursor: pointer; transition: all .2s; }
.btn-clear:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.gps-table-wrap { max-height: 320px; overflow-y: auto; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-tertiary); }
.gps-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.gps-table th { position: sticky; top: 0; background: var(--bg-tertiary); z-index: 2; padding: 6px 8px; text-align: left; font-weight: 600; color: var(--text-secondary); border-bottom: 1px solid var(--border); white-space: nowrap; }
.gps-table td { padding: 6px 8px; border-bottom: 1px solid var(--border-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.gps-table tr:last-child td { border-bottom: none; }
.gps-table tr { cursor: pointer; transition: background .15s; }
.gps-table tbody tr:hover { background: var(--accent-bg); }
.gps-table td:nth-child(1) { font-weight: 500; color: var(--accent); }
.gps-table td:nth-child(2) { font-variant-numeric: tabular-nums; }
.gps-table td:nth-child(3) { max-width: 100px; }
.gps-row-active { background: var(--accent-bg) !important; }
.gps-spinner { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

