/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Full-screen map */
#map {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

/* Legend panel */
#legend {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    min-width: 200px;
    max-width: 280px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

#legend h3 {
    margin-bottom: 12px;
    font-size: 16px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

/* Search section */
#search-section {
    margin-bottom: 12px;
}

#search-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    color: #333;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#search-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

#search-input::placeholder {
    color: #999;
}

/* Filter controls */
#filter-controls {
    margin-bottom: 8px;
}

.filter-row {
    margin-bottom: 8px;
}

.filter-row label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
    font-weight: 500;
}

.filter-row select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    color: #333;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.filter-row select:focus {
    outline: none;
    border-color: #3498db;
}

.filter-row.filter-checkbox {
    padding: 6px 0;
}

.filter-row.filter-checkbox label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 13px;
    font-weight: normal;
    margin-bottom: 0;
}

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

.clear-filters-btn {
    width: 100%;
    margin-top: 8px;
    padding: 8px;
    background: #95a5a6;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.clear-filters-btn:hover {
    background: #7f8c8d;
}

.clear-filters-btn.hidden {
    display: none;
}

/* Overlay controls */
#overlay-controls {
    margin-bottom: 8px;
}

.overlay-item {
    padding: 6px 0;
}

.overlay-item label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 13px;
}

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

.overlay-label {
    color: #444;
}

.legend-divider {
    border: none;
    border-top: 1px solid #ddd;
    margin: 10px 0;
}

.legend-section-title {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    font-weight: 600;
}

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

/* Legend item row */
.legend-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
    user-select: none;
}

.legend-item:hover {
    background-color: #f5f5f5;
}

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

.legend-item.disabled:hover {
    background-color: #fafafa;
}

/* Color dot indicator */
.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
    border: 2px solid rgba(0, 0, 0, 0.1);
}

/* Legend item name */
.legend-name {
    flex: 1;
    font-size: 14px;
    color: #333;
}

/* Legend item count */
.legend-count {
    font-size: 12px;
    color: #888;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
}

/* Show All button */
.show-all-btn {
    width: 100%;
    margin-top: 12px;
    padding: 10px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.show-all-btn:hover {
    background: #2980b9;
}

.show-all-btn.hidden {
    display: none;
}

/* Custom marker styles */
.custom-marker {
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Popup styles */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    padding: 0;
}

.leaflet-popup-content {
    margin: 0;
    min-width: 200px;
    max-width: 300px;
}

.popup-content {
    padding: 15px;
}

.popup-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    line-height: 1.3;
}

.popup-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

/* Status badge colors */
.popup-status.status-planned {
    background-color: #f39c12;
    color: white;
}

.popup-status.status-in-progress {
    background-color: #3498db;
    color: white;
}

.popup-status.status-completed {
    background-color: #27ae60;
    color: white;
}

.popup-type {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.popup-type-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* Location info in popup */
.popup-location {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.popup-location-item {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.popup-location-item.in-city {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.popup-location-item.unincorporated {
    background-color: #fafafa;
    color: #666;
    border: 1px solid #ddd;
}

.popup-location-item.district {
    background-color: #fff;
    border: 2px solid;
    font-weight: 600;
}

.popup-description {
    font-size: 13px;
    color: #555;
    line-height: 1.5;
    margin-bottom: 10px;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.popup-dates {
    font-size: 12px;
    color: #888;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.popup-date-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.popup-date-row:last-child {
    margin-bottom: 0;
}

.popup-date-label {
    font-weight: 500;
    color: #666;
}

/* Loading indicator */
.loading {
    text-align: center;
    padding: 20px;
    color: #888;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 20px;
    color: #888;
    font-size: 14px;
}

/* Mobile responsive adjustments */
@media (max-width: 480px) {
    #legend {
        top: auto;
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        max-height: 40vh;
    }

    #legend h3 {
        font-size: 14px;
    }

    .legend-item {
        padding: 6px 8px;
    }

    .legend-name {
        font-size: 13px;
    }
}
