/* Base styles */
html,
body {
    height: 100%;
    margin: 0;
    overflow: hidden;
    /* Prevent page scrolling */
    font-family: 'Inter', 'Noto Sans TC', 'Noto Sans JP', sans-serif;
}

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

/* Custom Leaflet popup styles */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    background-color: #fff;
}

.leaflet-popup-content {
    font-size: 14px;
    margin: 0;
    padding: 12px;
}

.popup-content a {
    color: #2563eb;
    text-decoration: none;
}

.popup-content a:hover {
    text-decoration: underline;
}

/* Custom DivIcon styles */
.svg-icon {
    background: transparent;
    border: none;
}

/* Category filter (legend) styles */
.category-filter-container {
    max-width: 280px;
}

.category-filter {
    max-height: 60vh;
    overflow-y: auto;
    background-color: rgba(255, 255, 255, 0.9);
    line-height: 1.5;
}

.filter-toggle-btn {
    transition: all 0.2s ease-in-out;
    border: 1px solid #d1d5db;
}

.filter-toggle-btn:hover {
    background-color: #f3f4f6 !important;
}

.filter-toggle-btn:active {
    transform: scale(0.98);
}

/* Mobile specific filter styles */
@media (max-width: 767px) {
    .category-filter-container {
        max-width: 200px;
    }
    
    .category-filter {
        max-height: 40vh;
    }
    
    .filter-toggle-btn {
        font-size: 12px;
        padding: 6px 8px;
    }
}

.category-filter-item {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

.category-filter-item input {
    margin-right: 8px;
}

.category-filter-item .color-box {
    width: 15px;
    height: 15px;
    margin-right: 8px;
    border: 1px solid #ccc;
    flex-shrink: 0;
}

.highlight {
    background-color: #dbeafe !important;
    border: 2px solid #3b82f6;
}

/* Loading Spinner */
.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Mobile responsive styles */
@media (max-width: 767px) {
    html, body {
        overflow: auto; /* Allow scrolling on mobile */
    }
    
    #app {
        height: 100vh;
    }
    
    #sidebar {
        height: calc(100vh - 60px); /* Account for toggle buttons */
    }
    
    #map-container {
        height: calc(100vh - 60px); /* Account for toggle buttons */
    }
    
    #mobile-filter-container {
        height: calc(100vh - 60px); /* Account for toggle buttons */
    }
    
    #map {
        height: 100%;
        width: 100%;
    }
    
    /* Hide desktop filter on mobile */
    .leaflet-bottom.leaflet-right {
        display: none !important;
    }
}

/* Mobile filter styles */
.mobile-filter-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background-color: #f9fafb;
    transition: background-color 0.2s ease-in-out;
}

.mobile-filter-item:hover {
    background-color: #f3f4f6;
}

.mobile-filter-item input[type="checkbox"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
}

.mobile-filter-item .color-box {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    flex-shrink: 0;
}

.mobile-filter-item label {
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    flex-grow: 1;
}

/* Ensure buttons are properly styled on mobile */
.mobile-toggle-btn {
    transition: all 0.2s ease-in-out;
}

.mobile-toggle-btn:active {
    transform: scale(0.98);
}