/* Reset and base styles */
body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Map container */
#map {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
}

/* Loading overlay */
.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    margin: 0;
    color: #666;
    font-size: 16px;
}

/* Legend panel */
.legend {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 999;
    max-width: 280px;
}

.legend h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.legend-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.legend-section:last-child {
    border-bottom: none;
}

.legend h4 {
    margin: 0 0 10px 0;
    color: #555;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.filter-label {
    display: flex;
    align-items: center;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    margin-bottom: 8px;
}

.filter-label input[type="checkbox"] {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.distance-filters {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.distance-filter-item {
    display: flex;
    align-items: center;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    padding: 4px 0;
}

.distance-filter-item:hover {
    background-color: #f5f5f5;
    border-radius: 4px;
    padding: 4px 8px;
    margin: 0 -8px;
}

.distance-filter-item input[type="checkbox"] {
    margin-right: 8px;
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.filter-count {
    margin-left: auto;
    color: #888;
    font-size: 12px;
    font-weight: 500;
}

/* Style switcher */
.style-switcher {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.style-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #555;
    transition: all 0.2s ease;
}

.style-button:hover {
    background: #f5f5f5;
    border-color: #d0d0d0;
}

.style-button.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
    font-weight: 500;
}

.style-button span {
    font-size: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
}

.legend-item span:last-child {
    font-size: 14px;
    color: #555;
}

.legend-stats {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    font-size: 13px;
    color: #666;
}

.legend-stats p {
    margin: 5px 0;
}

/* Custom Popup (Dialog Box) Styling */
.maplibregl-popup-content {
    padding: 15px;
    border-radius: 10px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    max-width: 320px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.maplibregl-popup-content h3 {
    margin: 0 0 10px 0;
    color: #1e40af;
    font-size: 16px;
    font-weight: 600;
}

.maplibregl-popup-content p {
    margin: 8px 0;
    font-size: 14px;
    color: #374151;
    line-height: 1.5;
}

.maplibregl-popup-content p strong {
    color: #1f2937;
    font-weight: 600;
}

.maplibregl-popup-content hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 12px 0;
}

.maplibregl-popup-content em {
    color: #6b7280;
    font-style: italic;
}

/* Multi-entry popup styling */
.multi-entry-popup {
    padding: 0;
}

.popup-nav {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px 8px 0 0;
}

.nav-title {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.popup-nav-btn {
    padding: 6px 10px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #374151;
    transition: all 0.2s ease;
}

.popup-nav-btn:hover {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.popup-nav-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
    font-weight: 600;
}

.popup-divider {
    margin: 12px 0;
    border: none;
    border-top: 1px solid #e5e7eb;
}

.popup-content-wrapper {
    max-height: 400px;
    overflow-y: auto;
}

.entry-transition {
    transition: all 0.3s ease;
}

/* Map control button styling */
.maplibregl-ctrl-group {
    border-radius: 8px !important;
    overflow: hidden;
}

.maplibregl-ctrl-icon {
    padding: 8px !important;
}
