/* Base styles - Horizon Design System */
:root {
    /* Horizon Colors */
    --horizon-primary: #0074ff;
    --horizon-legacy: #0857c3;
    --horizon-green: #34a853;
    --horizon-red: #e04b4b;
    --horizon-bg-black: #000000;
    --horizon-text-primary: #e8eaed;
    --horizon-text-secondary: #9aa0a6;
    --horizon-text-tertiary: #5f6368;
    
    /* Glassmorphism */
    --glass-bg: rgba(30, 30, 30, 0.59);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-blur: 10px;
    
    /* Spacing (4px grid) */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 16px;
    --spacing-xl: 20px;
    --spacing-2xl: 24px;
    --spacing-3xl: 32px;
    --spacing-4xl: 48px;
    
    /* Typography */
    --font-primary: 'Asta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    /* Transitions */
    --transition-fast: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    margin: 0;
    overflow: hidden;
    height: 100vh;
    font-family: var(--font-primary);
    background: var(--horizon-bg-black);
    color: var(--horizon-text-primary);
}

/* Prevent double-tap zoom */
* {
    touch-action: manipulation;
}

span, text {
    font-family: var(--font-primary);
    line-height: 1;
}

/* Invisible label markers for click interaction */
.invisible-label-marker {
  opacity: 0 !important;
  pointer-events: auto;
  cursor: pointer;
}

/* SVG label markers */
.svg-label-marker {
  background: none !important;
  border: none !important;
  pointer-events: auto;
}

.svg-label-marker svg {
  pointer-events: auto;
  cursor: default;
}

.svg-label-marker svg text {
  fill: currentColor;
  paint-order: stroke fill;
  cursor: default;
}

.svg-label-marker svg text:hover {
  fill: #2b99ff;
  cursor: pointer;
  pointer-events: visiblePainted;
}

/* Ship icon styles */
.ship-icon {
    z-index: 1000 !important;
    pointer-events: none;
}

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

/* Measure Tool Styles - Horizon Update */
.tool-btn.active {
    background-color: rgba(0, 116, 255, 0.2) !important;
    color: var(--horizon-primary) !important;
    border-color: var(--horizon-primary) !important;
}

.measure-tooltip {
    background: none !important;
    border: none !important;
    z-index: 1000 !important;
}

.measure-tooltip-content {
    background: rgba(32, 33, 36, 0.9);
    backdrop-filter: blur(10px);
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
}

.measure-distance-label {
    background: none !important;
    border: none !important;
    z-index: 999 !important;
}

.measure-distance-label div {
    background: rgba(255, 255, 255, 0.95);
    color: #0074ff;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    white-space: nowrap;
}

.measure-instructions {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    animation: fadeIn 0.3s ease-out;
}

.measure-instructions-content {
    background: rgba(32, 33, 36, 0.95);
    backdrop-filter: blur(10px);
    color: #fff;
    padding: 16px 20px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
}

.measure-instructions-content strong {
    font-size: 14px;
    display: block;
    margin-bottom: 8px;
    color: #0074ff;
}

.measure-result {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    animation: slideUp 0.3s ease-out;
}

.measure-result-content {
    background: rgba(32, 33, 36, 0.95);
    backdrop-filter: blur(10px);
    color: #fff;
    padding: 16px 24px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
}

.measure-result-content strong {
    display: block;
    font-size: 12px;
    color: #9aa0a6;
    margin-bottom: 8px;
}

.measure-result-distance {
    font-size: 24px;
    font-weight: 500;
    color: #0074ff;
    margin-bottom: 12px;
}

.measure-clear-btn {
    background: rgba(0, 116, 255, 0.2);
    color: #0074ff;
    border: 1px solid #0074ff;
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.measure-clear-btn:hover {
    background: rgba(0, 116, 255, 0.3);
    transform: translateY(-1px);
}

/* Measure Controls */
.measure-mobile-controls {
    position: fixed;
    top: 80px;
    right: 16px;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: fadeInRight 0.3s ease-out;
}

.measure-mobile-finish-btn,
.measure-mobile-cancel-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(10px);
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: all 0.2s;
}

.measure-mobile-finish-btn {
    background: rgba(34, 197, 94, 0.9);
}

.measure-mobile-finish-btn:hover {
    background: rgba(22, 163, 74, 0.9);
    transform: scale(1.05);
}

.measure-mobile-cancel-btn {
    background: rgba(224, 75, 75, 0.9);
}

.measure-mobile-cancel-btn:hover {
    background: #e04b4b;
    transform: scale(1.05);
}

.measure-mobile-finish-btn svg,
.measure-mobile-cancel-btn svg {
    width: 20px;
    height: 20px;
}

/* Desktop layout - horizontal */
@media (min-width: 769px) {
    .measure-mobile-controls {
        flex-direction: row;
    }
}

/* Mobile styles for mode selector */
@media (max-width: 768px) {
    .measure-mode-selector-content {
        padding: 10px;
    }

    .measure-mobile-controls {
        right: 8px;
    }
    
    .measure-mode-btn {
        padding: 10px 16px;
        font-size: 12px;
        min-width: 50px;
    }
}

/* Measure Mode Selector */
.measure-mode-selector {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1002;
}

.measure-mode-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    animation: fadeInBackdrop 0.2s ease-out;
}

.measure-mode-selector-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 8px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.2);
    animation: fadeInScale 0.3s ease-out;
}

.measure-mode-buttons {
    display: flex;
    gap: 8px;
}

.measure-mode-btn {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 60px;
    text-align: center;
}

.measure-mode-btn:hover {
    background: rgba(0, 116, 255, 0.25);
    border-color: rgba(0, 116, 255, 0.5);
    transform: translateY(-1px);
}

.measure-mode-btn:active {
    transform: translateY(0);
}

/* Measure Area Label */
.measure-area-label {
    background: none !important;
    border: none !important;
    z-index: 999 !important;
}

.measure-area-label div {
    background: rgba(0, 116, 255, 0.95);
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    white-space: nowrap;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Search No Results */
.search-no-results {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    animation: slideDown 0.3s ease-out;
}

.search-no-results-content {
    background: rgba(30, 30, 30, 0.59);
    backdrop-filter: blur(10px);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid rgba(255,255,255,0.1);
    font-size: 14px;
}

.search-no-results-content button {
    background: none;
    border: none;
    color: #9aa0a6;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.search-no-results-content button:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

/* Removed slideDown animation to prevent positioning flash */

/* Google Earth Style Header - Dark Theme */
#main-header {
    background-color: none;
    height: 54px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 20px; /* Match viewport tools container padding */
    overflow: hidden;
    box-sizing: border-box;
}

/* Header Layout Sections */
.header-left {
    display: flex;
    align-items: center;
}

.header-center {
    display: flex;
    align-items: center;
    flex: 1;
    margin: 0 24px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

/* Map Icon Button */
.map-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(32, 33, 36, 0.59);
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

.map-icon-btn:hover {
    background-color: rgba(138, 180, 248, 0.1);
}

.map-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

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

/* Integrated Search + Tools Container - Horizon Update */
.search-tools-container {
    display: flex;
    align-items: center;
    height: 36px;
    background-color: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 0 var(--spacing-sm);
    gap: 0px;
    transition: var(--transition-fast);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-tools-container:hover {
    border-color: var(--horizon-text-tertiary);
    background-color: rgba(255, 255, 255, 0.05);
}

.search-tools-container:focus-within {
    border-color: var(--horizon-primary);
    background-color: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 2px rgba(0, 116, 255, 0.2);
}

/* Search Icon Button - Horizon Update */
.search-icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--horizon-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.search-icon-btn:hover {
    background-color: rgba(0, 116, 255, 0.08);
    color: var(--horizon-primary);
}

/* Search Input - Horizon Update */
.search-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--horizon-text-primary);
    font-size: 16px; /* 16px prevents zoom on iOS */
    width: 300px;
    padding: 0 var(--spacing-md);
    cursor: text;
    font-family: var(--font-primary);
    -webkit-text-size-adjust: 100%; /* Prevent font size adjustment */
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

.search-input::placeholder {
    color: var(--horizon-text-secondary);
}

/* Vertical Divider */
.search-divider {
    width: 1px;
    height: 24px;
    background-color: #5f6368;
    margin: 0 8px;
    flex-shrink: 0;
}

/* Tool Icons Container */
.tool-icons {
    display: flex;
    align-items: center;
    gap: 2px;
}


/* Tool Buttons */
.tool-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: #9aa0a6;
    padding: 0;
    flex-shrink: 0;
}

/* Hide all tool buttons except measure and layers */
#location-tool,
#keyboard-tool {
    display: none !important;
}

.tool-btn:hover {
    background-color: rgba(138, 180, 248, 0.08);
    color: #e8eaed;
}

.tool-btn:active {
    background-color: rgba(138, 180, 248, 0.12);
    transform: scale(0.95);
}

/* Account Button */
.account-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.2s, opacity 0.3s ease; /* Include opacity transition */
    padding: 0;
    z-index: 9999 !important;
}

/* Profile button loading state */
.account-btn.loading {
    opacity: 0;
}

.account-btn:hover {
    background-color: rgba(30, 30, 30, 0.59);
}

.account-btn svg {
    width: 36px;
    height: 36px;
}

/* Profile image styles */
.account-profile-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: none; /* Remove border */
    background: none; /* No background to prevent white circle */
    /* Smooth loading transition */
    transition: opacity 0.2s ease;
}

.account-profile-img:not([src]),
.account-profile-img[src=""] {
    opacity: 0;
}

/* User avatar image in dropdown */
.user-avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: none;
    background: none;
    transition: opacity 0.2s ease;
}

.user-avatar-img:not([src]),
.user-avatar-img[src=""] {
    opacity: 0;
}

/* Updated Language Selector for Earth Style */
.maps-header .language-selector-container {
    display: flex;
    align-items: center;
}

.maps-header .language-selector {
    background-color: rgba(30, 30, 30, 0.59);
    backdrop-filter: blur(5px);
    border: 1px solid #5f6368;
    border-radius: 4px;
    color: #9aa0a6;
    font-size: 12px;
    padding: 4px 8px;
    height: 28px;
    cursor: pointer;
    transition: all 0.2s;
}

.maps-header .language-selector:hover {
    border-color: #0074ff;
    color: #e8eaed;
    background-color: rgba(138, 180, 248, 0.08);
}

.maps-header .language-selector option {
    background-color: #303134;
    color: #e8eaed;
}

#map-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; /* Ensure map is below header/footer */
}

/* Viewport Tools Container - Systematic Grid System */
.viewport-tools-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 74px 20px 50px 20px; /* Header and footer clearance + standard padding */
    pointer-events: none; /* Allow map interaction */
    z-index: 900; /* Above map, below modals */
    display: flex;
    flex-direction: column;
}

/* Prevent transition animations during initial page load */
.no-transitions,
.no-transitions * {
    transition: none !important;
}

/* Hide elements that will be relocated to prevent flicker */
.leaflet-control-zoom:not(.positioned),
#layer-selector:not(.positioned),
#server-status:not(.positioned) {
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Show elements after relocation */
.leaflet-control-zoom.positioned,
#layer-selector.positioned,
#server-status.positioned {
    opacity: 1 !important;
    visibility: visible !important;
    transition: opacity 0.3s ease;
}

/* Tool zones within viewport - Grid layout */
.tools-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: auto;
}

.tools-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.tools-left {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
}

.tools-right {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-end;
}

/* Re-enable pointer events for actual tools */
.viewport-tools-container * {
    pointer-events: auto;
}

/* Standard tool styling */
.viewport-tool {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    transition: var(--transition-fast);
}

/* Mobile viewport tools - Responsive padding */
@media (max-width: 768px) {
    .viewport-tools-container {
        padding: 74px 16px 46px 16px; /* Smaller padding on mobile */
    }
    
    .tools-left,
    .tools-right {
        gap: 8px; /* Smaller gap on mobile */
    }
}

/* Tablet viewport tools */
@media (min-width: 769px) and (max-width: 1024px) {
    .viewport-tools-container {
        padding: 74px 24px 50px 24px; /* Medium padding on tablet */
    }
    
    #main-header {
        padding: 0 24px; /* Match viewport tools container tablet padding */
    }
}

#main-footer {
    background-color: rgba(30, 30, 30, 0.59);
    backdrop-filter: blur(5px);
    padding: 0;
    height: 28px;
    font-size: 12px;
    color: #e8eaed;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 100%;
}

.footer-logo-box {
    height: 100%;
    padding: 0 16px;
    display: flex;
    align-items: center;
}

.footer-logo-box img {
    height: 16px;
    width: auto;
}

.footer-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-xl);
    padding: 0 var(--spacing-lg);
    font-family: var(--font-primary);
    font-weight: 400;
}

.footer-info span {
    color: var(--horizon-text-primary);
    white-space: nowrap;
}

.footer-separator {
    color: var(--horizon-text-tertiary);
    margin: 0 var(--spacing-sm);
}

/* Responsive header */
@media (max-width: 768px) {
    #main-header {
        padding: 0 16px; /* Match viewport tools container mobile padding */
    }
    
    .header-center {
        margin: 0; /* Remove margin to align with grid */
        flex: 1;
    }
    
    /* Mobile search container behavior */
    .search-tools-container {
        position: relative;
        transition: all 0.3s ease;
        max-width: 100%;
    }
    
    /* Default state - show tool icons */
    .search-input {
        width: 0;
        padding: 0;
        opacity: 0;
        font-size: 16px; /* Prevent zoom on iOS */
        transition: all 0.3s ease;
    }
    
    .search-divider {
        display: none !important; /* Always hide on mobile */
    }
    
    .tool-icons {
        display: flex !important; /* Show tools by default on mobile */
    }
    
    /* When search is focused - expand search, hide tools */
    .search-tools-container:focus-within .search-input {
        width: 200px;
        padding: 0 12px;
        opacity: 1;
    }
    
    .search-tools-container:focus-within .tool-icons {
        display: none !important;
    }
    
    /* Mobile profile and language improvements */
    .header-right {
        margin-right: 0;
        gap: 8px;
    }
    
    /* Language selector on mobile - keep visible */
    .maps-header .language-selector-container {
        display: flex !important;
    }
    
    .maps-header .language-selector {
        display: block !important;
        width: auto;
        min-width: 45px;
        height: 28px;
        padding: 4px 6px;
        font-size: 12px;
        font-weight: 500;
        border-radius: 4px;
    }
    
    /* Hide map icon on very small screens */
    .map-icon-btn {
        display: none;
    }
}

/* Responsive footer */
@media (max-width: 768px) {
    .footer-logo-box {
        display: none;
    }
    
    .footer-content {
        justify-content: center;
    }
    
    .footer-info {
        gap: 12px;
        font-size: 12px;
        width: 100%;
        justify-content: center;
        padding: 0 12px;
    }
}

/* Search Results UI - Horizon Update */
.search-results {
    position: fixed;
    top: 64px; /* Below header */
    left: 0; /* Will be overridden by JavaScript */
    width: 100px; /* Will be overridden by JavaScript */
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 18px; /* Match search bar radius */
    z-index: 2000;
    max-height: 400px;
    overflow: hidden;
    opacity: 0; /* Start invisible until positioned */
    transition: opacity 0.2s ease; /* Only animate opacity */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* Removed slideDown animation to prevent positioning flash */

.search-results-content {
    max-height: 400px;
    overflow-y: auto;
}

.search-results-title {
    padding: 16px 24px;
    font-size: 13px;
    font-weight: 500;
    color: #ffffff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    letter-spacing: 0.01em;
}

.search-results-list {
    padding: 8px 0;
}

.search-result-item {
    padding: 14px 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 0;
}

.search-result-item:hover {
    background-color: rgba(0, 116, 255, 0.08);
}

.search-result-item.admin-result {
    background-color: rgba(0, 116, 255, 0.05);
}

.search-result-item.admin-result:hover {
    background-color: rgba(0, 116, 255, 0.12);
}

.search-result-item.marker-result {
    background-color: rgba(255, 107, 107, 0.05);
}

.search-result-item.marker-result:hover {
    background-color: rgba(255, 107, 107, 0.12);
}

.search-result-name {
    font-size: 14px;
    color: #ffffff;
    font-weight: 400;
    flex: 1;
}

.search-result-type {
    font-size: 12px;
    color: #ffffff;
    margin-left: 12px;
    white-space: nowrap;
}

/* Search Loading State - inherits from .search-results */

.search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #ffffff;
    font-size: 13px;
    padding: 24px;
    min-height: 60px;
}

.search-loading .spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Search Error State - inherits from .search-results */

.search-error {
    color: #ff6b6b;
    font-size: 13px;
    padding: 24px;
    text-align: center;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* No Results State - inherits from .search-results */

.search-no-results-content {
    color: #ffffff;
    font-size: 13px;
    padding: 24px;
    text-align: center;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* User Authentication Menu - www.playcity.kr style */
.user-menu {
    position: fixed;
    top: var(--menu-top, 50px);
    right: var(--menu-right, 8px);
    z-index: 3000;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    min-width: 200px;
    opacity: 1; /* Visible by default */
    transition: opacity 0.2s ease, transform 0.2s ease;
    animation: fadeInProfile 0.3s ease;
    font-family: var(--font-primary);
}

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

/* New dropdown content styles */
.user-dropdown-content {
    padding: 0;
    overflow: hidden;
    border-radius: 12px;
}

.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-dropdown-avatar {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.user-dropdown-greeting {
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
}

.user-dropdown-menu {
    padding: 8px 0;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #ffffff;
    text-decoration: none;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.user-dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.user-dropdown-item svg {
    flex-shrink: 0;
    opacity: 0.8;
}

.logout-item {
    color: #9aa0a6 !important;
}

.logout-item:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Old legacy styles removed to prevent conflicts with new dropdown design */

/* Profile button authenticated state */
.account-btn.authenticated {
    background: rgba(0, 116, 255, 0.1);
    border: 1px solid rgba(0, 116, 255, 0.3);
}

/* Authentication container */
#user-auth-container {
    position: relative;
    display: flex !important;
    align-items: center;
    gap: 4px;
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 9999 !important;
}

#user-auth-container.authenticated .account-btn {
    background: rgba(0, 116, 255, 0.1);
    border: 1px solid rgba(0, 116, 255, 0.3);
    border-radius: 50%;
}


/* Mobile adjustments for search results */
@media (max-width: 768px) {
    .search-results {
        top: 56px;
        left: 12px;
        right: 12px;
        transform: none;
        max-width: none;
        min-width: auto;
        border-radius: 16px;
    }
    
    .user-menu {
        right: 8px !important;
        min-width: 200px;
        border-radius: 12px;
    }
    
    .user-dropdown-content {
        border-radius: 12px;
    }
    
    .user-dropdown-header {
        padding: 12px;
    }
    
    .user-dropdown-item {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    /* Legacy styles removed */
    
    #main-footer {
        height: 28px;
    }
}

/* Leaflet map specific styles */
#map-container .leaflet-container {
    height: 100%;
    width: 100%;
}

/* Layer Selector Widget */
.layer-selector {
    position: relative !important; /* Override fixed positioning */
    bottom: auto !important;
    left: auto !important;
    z-index: 1000;
    font-family: 'Roboto', Arial, sans-serif;
    margin: 0; /* Ensure no extra margins */
}

.layer-selector-container {
    display: flex;
    align-items: center;
    gap: 2px;
}

.layer-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(32, 33, 36, 0.7);
    border: none;
    border-radius: 20px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 40px;
    white-space: nowrap;
    outline: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.layer-button:hover {
    background: rgba(60, 64, 67, 0.95);
}

.layer-button.active {
    background: rgba(26, 115, 232, 0.9);
}

.layer-button.active:hover {
    background: rgba(26, 115, 232, 1);
}

.layer-icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
    flex-shrink: 0;
}

.layer-label {
    display: inline-block;
}

/* Layer options (hidden by default) */
.layer-options {
    display: flex;
    gap: 2px;
    max-width: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Show options on hover or when expanded */
.layer-selector:hover .layer-options,
.layer-selector.expanded .layer-options {
    max-width: 500px;
    opacity: 1;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    /* Layer selector handled by grid container now */
    
    .layer-button {
        padding: 4px 12px;
        font-size: 12px;
        height: 36px;
    }
    
    .layer-icon {
        width: 16px;
        height: 16px;
    }
    
    /* Hide labels on mobile, show only icons */
    .layer-label {
        display: none;
    }
    
    .layer-button.active .layer-label {
        display: inline-block;
    }
}

/* Ensure layer selector is above Leaflet controls */
.leaflet-bottom.leaflet-left {
    bottom: 90px; /* Move Leaflet controls up to avoid overlap */
}

/* Legacy language selector removed - now part of Earth header */

/* Leaflet controls - Now managed by viewport tools container */
.leaflet-control-container {
    /* Reset default positioning since controls are moved to our grid */
    position: static !important;
}

/* Ensure zoom control works in new container */
#leaflet-control-zoom-container .leaflet-control-zoom {
    position: relative !important;
    margin: 0 !important;
}

/* Sidebar styling */
#sidebar {
    width: 100%;
    height: auto;
    padding: 0;
    box-sizing: border-box;
}

#sidebar.open {
    right: 0;
}

#sidebar h3 {
    margin-top: 0;
    color: #333;
}

#sidebar button {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

#sidebar button:hover {
    background-color: #0056b3;
}

/* Editor UI specific styles */
#editor-ui {
    position: absolute;
    top: 64px; /* Below header */
    right: 0;
    width: 340px;
    height: calc(100% - 64px - 24px);
    z-index: 1002;
    background-color: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    color: white;
    padding: 20px;
    border-radius: 5px 0 0 5px;
    box-shadow: -2px 0 5px rgba(0,0,0,0.2);
    overflow-y: auto;
    box-sizing: border-box;
}

/* Sidebar form styling */
#sidebar form {
  display: flex;
  flex-direction: column;
}

#sidebar label {
  margin-top: 12px;
  font-weight: bold;
}

#sidebar input[type="text"],
#sidebar input[type="number"],
#sidebar input[type="color"],
#sidebar select,
#sidebar textarea {
  width: 100%;
  padding: 6px 8px;
  margin-top: 4px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box;
  font-family: inherit;
}

#sidebar textarea {
  resize: vertical;
  min-height: 40px;
  max-height: 120px;
}

/* Save/Delete buttons */
#sidebar button {
  padding: 8px 12px;
  font-size: 14px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#saveFeature {
  background-color: #28a745;
  color: white;
}

#deleteFeature {
  background-color: #dc3545;
  color: white;
}

/* Toggle sidebar button */
#toggleSidebar {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid #ccc;
  border-radius: 4px;
  width: 32px;
  height: 32px;
  line-height: 28px;
  text-align: center;
  font-size: 18px;
  cursor: pointer;
}

/* Scrollable sidebar */
#sidebar {
  overflow-y: auto;
}

/* Input focus state */
#sidebar input:focus,
#sidebar select:focus,
#sidebar textarea:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 3px rgba(0,123,255,0.5);
}

.leaflet-control-label-tool {
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 6px;
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
}

.leaflet-label {
  pointer-events: none;
  background: transparent;
  border: none;
  color: white;
  text-shadow: 0 0 4px rgba(0,0,0,0.7);
}

/* 새로 추가된 feature-label 스타일 */
.feature-label {
  background: transparent;
  border: none;
  color: white;
  font-weight: bold;
  font-size: 14px;
  text-align: center;
  text-shadow: 0 0 5px black, 0 0 5px black; /* 가독성을 위한 텍스트 그림자 강화 */
  white-space: nowrap;
  /* 클릭 이벤트를 위해 pointer-events를 제거합니다. Leaflet이 마커를 처리합니다. */
}

.feature-label span {
  display: block; /* 줄바꿈(<br>)이 적용되도록 합니다. */
}

#editor-ui label {
  color: white;
}

#editor-ui input,
#editor-ui select,
#editor-ui textarea {
  background: rgba(255,255,255,0.1);
  color: white;
  border-color: rgba(255,255,255,0.3);
}

#editor-ui input:focus,
#editor-ui select:focus,
#editor-ui textarea:focus {
  outline: 2px solid white;
  box-shadow: 0 0 5px white;
}

.transport-hover-popup .leaflet-popup-content-wrapper {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.transport-hover-popup .leaflet-popup-tip {
  background: rgba(255, 255, 255, 0.95);
}

.transport-hover-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
}
.transport-hover-card img {
  max-width: 200px;
  max-height: 120px;
  width: auto;
  height: auto;
  border-radius: 4px;
  margin-bottom: 6px;
  object-fit: cover;
}
.transport-title {
  font-size: 14px;
  font-weight: bold;
  text-align: center;
  color: #333;
  margin: 0;
}

/* Styles for curved SVG labels on paths */
.curved-label-text {
  pointer-events: none; /* Allow clicks to pass through to the map */
  paint-order: stroke;  /* Render stroke behind fill for clean text outlines */
  stroke-linejoin: round;
  stroke-linecap: round;
  font-family: 'Asta Sans', Arial, sans-serif;
}
/* Google Maps 스타일 마커 + 라벨 */
.gm-div-icon {
  background: none;
  border: none;
}
.gm-marker-container {
  display: flex;
  align-items: center;
}
.gm-marker-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
}
.gm-default-icon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3388ff;
}
.gm-marker-label {
  margin-left: 4px;
  font-size: 12px;
  font-weight: 500;
  color: #333;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(255,255,255,0.8);
}

/* LILO Player Markers */
.lilo-player-icon {
  background: none !important;
  border: none !important;
}

.lilo-player-marker {
  background-color: rgba(32, 33, 36, 0.59);
  backdrop-filter: blur(10px);
  color: #fff;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  pointer-events: none;
  font-family: 'Asta Sans', Arial, sans-serif;
  position: relative;
  display: inline-block;
}

/* Active player pulse indicator - positioned on the left */
.lilo-player-marker::after {
  content: '';
  position: absolute;
  top: 50%;
  left: -10px;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background-color: #34a853;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8);
  animation: playerPulse 2s infinite;
}

/* Recently active (moved within 30 seconds) */
.lilo-player-marker.active::after {
  background-color: #34a853;
  animation: playerPulse 1.5s infinite;
}

/* Idle (no movement for 30-120 seconds) */
.lilo-player-marker.idle::after {
  background-color: #fbbc04;
  animation: playerPulse 2.5s infinite;
}

/* AFK (no movement for 120+ seconds) */
.lilo-player-marker.afk::after {
  background-color: #ea4335;
  animation: none;
  opacity: 0.7;
}

@keyframes playerPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(52, 168, 83, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.8);
  }
  50% {
    box-shadow: 0 0 0 3px rgba(52, 168, 83, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.8);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(52, 168, 83, 0), 0 0 0 1px rgba(255, 255, 255, 0.8);
  }
}

/* Server Status Indicator - Horizon Update */
.server-status {
  position: relative !important; /* Override fixed positioning */
  right: auto !important;
  bottom: auto !important;
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: 12px;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: 8px;
  font-family: var(--font-primary);
  transition: var(--transition-normal);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid;
  z-index: 1001; /* Above map but below other UI */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.server-status.online {
  border-color: var(--horizon-green);
  color: var(--horizon-green);
}

.server-status.offline {
  border-color: var(--horizon-red);
  color: var(--horizon-red);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.server-status.online .status-dot {
  background-color: #34a853;
  animation: pulse 2s infinite;
}

.server-status.offline .status-dot {
  background-color: #ea4335;
}

@keyframes pulse {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Layers Dropdown Container */
#layers-dropdown-container {
    position: relative;
    pointer-events: none; /* Allow clicks to pass through when dropdown is hidden */
}

#layers-dropdown-container .layers-dropdown {
    pointer-events: all; /* Re-enable clicks for the dropdown itself */
}

/* Layers Dropdown Styles (Google Earth/Maps style) */
.layers-dropdown {
    position: absolute;
    bottom: calc(40px + 16px); /* Above layer selector button: button height + gap */
    left: 0;
    z-index: 10000;
    font-family: var(--font-primary);
    animation: slideUp 0.2s ease-out;
}

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

.layers-dropdown-content {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    width: 280px; /* Reduced width for compact layout */
    max-width: calc(100vw - 2 * var(--spacing-md));
    max-height: calc(100vh - 120px); /* More vertical space */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    overscroll-behavior: contain; /* Prevent scroll chaining */
}

.layers-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px; /* Compact header padding */
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0; /* Prevent header from shrinking */
}

.layers-dropdown-header h3 {
    margin: 0;
    font-size: 16px; /* Smaller header font */
    font-weight: 600;
    color: #e8eaed;
    letter-spacing: -0.2px;
}

.layers-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px; /* Smaller close button */
    border-radius: 50%;
    color: #9aa0a6;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layers-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e8eaed;
}

.layers-dropdown-body {
    padding: 4px 0; /* Minimal vertical padding */
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    min-height: 0; /* Allow flex child to shrink below content size */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    overscroll-behavior: contain; /* Prevent scroll chaining to parent */
    /* Touch handling for better mobile scrolling */
    touch-action: pan-y;
    /* Prevent accidental parent scroll on mobile */
    position: relative;
    z-index: 1;
}

/* Custom scrollbar for layers dropdown */
.layers-dropdown-body::-webkit-scrollbar {
    width: 6px; /* Thinner scrollbar */
}

.layers-dropdown-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.layers-dropdown-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.layers-dropdown-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.layers-section {
    padding: 8px 16px; /* Compact section padding */
}

.layers-section + .layers-section {
    /* Remove section borders for more compact look */
    margin-top: 4px; /* Small gap instead of border */
}

.layers-section h4 {
    margin: 0 0 8px 0; /* Reduced bottom margin */
    padding: 4px 8px; /* Add padding for section header */
    font-size: 12px; /* Smaller section font */
    font-weight: 600;
    color: #9aa0a6;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: rgba(255, 255, 255, 0.03); /* Subtle background */
    border-radius: 4px;
    border-left: 3px solid rgba(0, 116, 255, 0.3); /* Visual hierarchy */
}

.layers-option-group {
    display: flex;
    flex-direction: column;
    gap: 2px; /* Minimal gap between options */
}

.layer-radio-option,
.layer-checkbox-option {
    display: block;
    cursor: pointer;
    padding: 8px 12px; /* Compact option padding */
    border-radius: 6px;
    transition: background 0.15s ease;
}

.layer-radio-option:hover,
.layer-checkbox-option:hover {
    background: rgba(255, 255, 255, 0.04); /* More subtle hover */
}

.layer-radio-option input[type="radio"],
.layer-checkbox-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
}

.layer-option-content {
    display: flex;
    align-items: center;
    gap: 10px; /* Reduced gap */
    color: #e8eaed;
    font-size: 14px; /* Explicit font size */
    line-height: 1.3;
}

.layer-option-icon {
    width: 18px; /* Smaller icons */
    height: 18px;
    fill: currentColor;
    opacity: 0.85;
    flex-shrink: 0;
}

/* Radio button styling */
.layer-radio-option input[type="radio"] + .layer-option-content::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #5f6368;
    border-radius: 50%;
    display: inline-block;
    margin-right: 12px;
    transition: all 0.2s ease;
}

.layer-radio-option input[type="radio"]:checked + .layer-option-content::before {
    border-color: #0074ff;
    background: radial-gradient(circle, #0074ff 40%, transparent 40%);
}

/* Checkbox styling */
.layer-checkbox-option {
    position: relative;
    padding-left: 36px; /* Reduced left padding for checkbox */
}

.layer-checkbox-option input[type="checkbox"] + .layer-option-content::before {
    content: '';
    position: absolute;
    left: 12px; /* Adjusted position */
    width: 16px; /* Smaller checkbox */
    height: 16px;
    border: 2px solid #5f6368;
    border-radius: 3px;
    transition: all 0.15s ease;
}

.layer-checkbox-option input[type="checkbox"]:checked + .layer-option-content::before {
    border-color: #0074ff;
    background: #0074ff;
}

.layer-checkbox-option input[type="checkbox"]:checked + .layer-option-content::after {
    content: '';
    position: absolute;
    left: 20px; /* Adjusted for smaller checkbox */
    top: 50%;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: translate(-50%, -55%) rotate(45deg);
}

/* Disabled state */
.layer-radio-option input[type="radio"]:disabled + .layer-option-content,
.layer-checkbox-option input[type="checkbox"]:disabled + .layer-option-content {
    opacity: 0.4;
    cursor: not-allowed;
}

.layers-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 2px; /* Minimal gap for high density */
}

/* Additional compact styling for professional look */
.layers-dropdown-body > .layers-section:first-child {
    padding-top: 6px; /* Slightly less padding for first section */
}

.layers-dropdown-body > .layers-section:last-child {
    padding-bottom: 8px; /* Slightly more padding for last section */
}

/* More compact spacing for disabled items */
.layer-radio-option input[type="radio"]:disabled + .layer-option-content,
.layer-checkbox-option input[type="checkbox"]:disabled + .layer-option-content {
    opacity: 0.5; /* Slightly more visible */
    padding-top: 6px;
    padding-bottom: 6px;
}

/* Selected state enhancement */
.layer-checkbox-option input[type="checkbox"]:checked + .layer-option-content {
    font-weight: 500; /* Slightly bolder when selected */
}

/* Active checkbox state */
.layer-checkbox-option input[type="checkbox"]:checked + .layer-option-content .layer-option-icon {
    color: #0074ff; /* Blue icon when checked */
    opacity: 1;
}

/* Compact PRO pill styling */
#heatmap-pro-pill {
    padding: 1px 6px !important; /* More compact pill */
    font-size: 9px !important;
    margin-left: 4px !important;
}

/* Optimize section header clickability */
.layers-section h4 {
    user-select: none; /* Prevent text selection */
    cursor: default;
}

/* Add subtle divider between major sections */
.layers-section:nth-child(3) {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 12px;
    margin-top: 8px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .layers-dropdown {
        bottom: calc(36px + 16px); /* Above layer selector button: button height + gap */
        left: 0;
    }
    
    .layers-dropdown-content {
        width: 260px; /* Compact on mobile too */
        max-height: calc(100vh - 120px); /* More space on mobile */
    }
    
    .layers-dropdown-header {
        padding: 12px 16px; /* Keep compact on mobile */
    }
    
    .layers-section {
        padding: 8px 16px; /* Keep compact on mobile */
    }
}

/* Leaflet Zoom Controls - Horizon Design System */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

.leaflet-control-zoom a {
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    text-align: center !important;
    background: var(--glass-bg) !important;
    backdrop-filter: blur(var(--glass-blur)) !important;
    -webkit-backdrop-filter: blur(var(--glass-blur)) !important;
    color: var(--horizon-text-primary) !important;
    font-size: 18px !important;
    font-weight: 300 !important;
    border-radius: 8px !important;
    border: 1px solid var(--glass-border) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    margin: 0 !important;
    transition: var(--transition-fast) !important;
    font-family: var(--font-primary) !important;
    display: block !important;
    text-decoration: none !important;
}

.leaflet-control-zoom a:first-child {
    border-radius: 8px 8px 0 0 !important;
    border-bottom: none !important;
}

.leaflet-control-zoom a:last-child {
    border-radius: 0 0 8px 8px !important;
    margin-top: -1px !important;
}

.leaflet-control-zoom a:only-child {
    border-radius: 8px !important;
    border: 1px solid var(--glass-border) !important;
}

.leaflet-control-zoom a:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: var(--horizon-primary) !important;
    border-color: var(--horizon-primary) !important;
    transform: scale(1.05) !important;
    z-index: 1 !important;
    position: relative !important;
}

.leaflet-control-zoom a:active {
    transform: scale(0.95) !important;
    background: rgba(0, 116, 255, 0.2) !important;
}

.leaflet-control-zoom a.leaflet-disabled {
    color: var(--horizon-text-tertiary) !important;
    background: rgba(255, 255, 255, 0.02) !important;
    cursor: not-allowed !important;
    opacity: 0.5 !important;
}

.leaflet-control-zoom a.leaflet-disabled:hover {
    transform: none !important;
    background: rgba(255, 255, 255, 0.02) !important;
    color: var(--horizon-text-tertiary) !important;
    border-color: var(--glass-border) !important;
}

/* Ensure proper stacking */
.leaflet-control-zoom {
    margin: var(--spacing-md) !important;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .leaflet-control-zoom a {
        width: 44px !important;
        height: 44px !important;
        line-height: 44px !important;
        font-size: 20px !important;
    }
}

/* Region Grid View Styles */
.region-number-label {
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
    font-family: var(--font-primary);
    user-select: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.region-number-label:hover {
    color: #0074ff;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 1);
    transform: scale(1.1);
}

/* Region highlight with hatching pattern */
.region-highlight-selected {
    background-image: repeating-linear-gradient(
        45deg,
        rgba(0, 116, 255, 0.1),
        rgba(0, 116, 255, 0.1) 10px,
        rgba(0, 116, 255, 0.3) 10px,
        rgba(0, 116, 255, 0.3) 20px
    );
    animation: hatch-animate 2s linear infinite;
}

@keyframes hatch-animate {
    0% {
        background-position: 0px 0px;
    }
    100% {
        background-position: 28px 28px;
    }
}

/* Region coordinate labels at corners */
.region-coordinate-label {
    pointer-events: none;
    z-index: 1000;
}

.region-coordinate-label .coord-text {
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-primary);
    white-space: nowrap;
    user-select: none;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Corner-specific positioning adjustments */
.region-coordinate-label.top-left .coord-text {
    justify-content: flex-start;
    align-items: flex-start;
}

.region-coordinate-label.top-right .coord-text {
    justify-content: flex-end;
    align-items: flex-start;
}

.region-coordinate-label.bottom-left .coord-text {
    justify-content: flex-start;
    align-items: flex-end;
}

.region-coordinate-label.bottom-right .coord-text {
    justify-content: flex-end;
    align-items: flex-end;
}

/* Mobile responsive for region labels */
@media (max-width: 768px) {
    .region-number-label {
        font-size: 10px;
        padding: 3px 6px;
    }
    
    .region-coordinate-label .coord-text {
        font-size: 11px;
        padding: 4px 8px;
    }
}

/* Layer control scrolling fix */
.leaflet-control-layers {
    max-height: 80vh !important;
    overflow-y: auto !important;
}

.leaflet-control-layers-expanded {
    max-height: 80vh !important;
    overflow-y: auto !important;
}

/* Smooth scrolling */
.leaflet-control-layers-list {
    max-height: 70vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* Custom scrollbar for webkit browsers */
.leaflet-control-layers-list::-webkit-scrollbar {
    width: 6px;
}

.leaflet-control-layers-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.leaflet-control-layers-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.leaflet-control-layers-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Mobile layer control optimizations */
@media (max-width: 768px) {
    .leaflet-control-layers {
        max-height: 60vh !important;
    }
    
    .leaflet-control-layers-list {
        max-height: 50vh !important;
    }
}

/* Additional utility classes for removing hardcoded styles */

/* Debug info styling */
#lilo-debug-info {
    display: none;
    position: fixed;
    top: 60px;
    left: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px;
    font-size: 12px;
    z-index: 1000;
    border-radius: 5px;
}

/* Tool panel base styles */
.tool-panel {
    display: none;
}

/* Heatmap legend dots */
.legend-dot-red { background: #ff0000; }
.legend-dot-orange { background: #ff6600; }
.legend-dot-yellow-orange { background: #ffaa00; }
.legend-dot-yellow { background: #ffff00; }

/* Pro controls */
.pro-controls {
    display: none;
}

/* Layers dropdown */
.layers-dropdown {
    display: none;
}

/* Heatmap PRO pill */
#heatmap-pro-pill {
    display: none;
    margin-left: 6px;
    padding: 2px 8px;
    background: linear-gradient(135deg, #0074ff 0%, #00a8ff 100%);
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
}

/* Editor UI */
#editor-ui {
    display: none;
}

/* Hidden containers */
.hidden-container {
    display: none;
}

/* Geometry editor containers */
#geometry-editor-container,
#point-editor,
#line-editor,
#style-selector-container,
#icon-selector-container {
    display: none;
}

/* SVG gradient stop classes */
.gradient-stop-red { stop-color: #ff0000; stop-opacity: 1; }
.gradient-stop-yellow { stop-color: #ffff00; stop-opacity: 1; }
.gradient-stop-green { stop-color: #00ff00; stop-opacity: 1; }
.gradient-stop-blue { stop-color: #3b82f6; stop-opacity: 1; }
.gradient-stop-teal { stop-color: #10b981; stop-opacity: 1; }
.gradient-stop-amber { stop-color: #f59e0b; stop-opacity: 1; }

/* Travel Routes Overlay and Tooltips */
.travel-routes-overlay {
    pointer-events: none;
    z-index: 500;
}

.travel-routes-canvas {
    pointer-events: auto !important;
}

.travel-route-tooltip {
    position: absolute;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px;
    font-family: var(--font-system);
    font-size: 13px;
    color: #e8eaed;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 1000;
    min-width: 200px;
}

.route-tooltip-content h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.02em;
}

.route-stats {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.route-stats > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #9aa0a6;
    font-size: 12px;
}

.route-stats > div:first-child {
    color: #e8eaed;
    font-weight: 500;
}

/* Animation for travel route particles */
@keyframes travelParticle {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.5);
    }
}

.travel-particle {
    animation: travelParticle 2s ease-in-out infinite;
}

/* Travel routes layer icon animation */
#toggle-travel-routes:checked + .layer-option-content .travel-particle {
    animation: travelParticle 1s ease-in-out infinite;
}

/* Travel Routes Canvas Styles */
.travel-routes-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
    z-index: 500;
}

/* Feature Tooltip Styles */
.feature-tooltip {
    position: absolute;
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    width: 300px;
    z-index: 1500;
    pointer-events: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.feature-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}


/* Tooltip content styles */
.tooltip-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
    line-height: 1.4;
}

.tooltip-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    color: #666;
}

.tooltip-stars {
    color: #ffa500;
    font-size: 16px;
}

.tooltip-review-count {
    color: #666;
}

.tooltip-category {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.tooltip-hours {
    font-size: 14px;
    color: #333;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
}

.tooltip-hours-label {
    font-weight: 500;
    margin-bottom: 4px;
}

.tooltip-hours-text {
    color: #666;
}

/* Travel Route Tooltip Styles */
.travel-route-tooltip {
    position: absolute;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 12px 16px;
    color: #e8eaed;
    font-size: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 1000;
    min-width: 200px;
}

.route-tooltip-content h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #3b82f6;
    font-weight: 600;
}

.route-stats {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.route-stats > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #9aa0a6;
}

.route-stats > div span {
    color: #e8eaed;
    font-weight: 500;
    margin-left: 8px;
}