/**
 * PMTiles Viewer - Styles
 * 
 * This file contains styles for the PMTiles viewer interface.
 * Critical styles are included inline in the HTML template.
 * This file contains additional styling for a better user experience.
 */

/* Base styles */
body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #333;
}

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

/* Map overlay panels */
.map-overlay {
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    padding: 12px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
    z-index: 1;
    transition: all 0.3s ease;
}

.map-overlay h3 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

/* Layer controls */
#layer-controls {
    top: 10px;
    right: 10px;
    max-width: 300px;
    max-height: calc(100% - 20px);
    overflow-y: auto;
}

/* Layer toggle items */
.layer-toggle {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.layer-toggle input[type="checkbox"] {
    margin-right: 8px;
}

.layer-toggle label {
    cursor: pointer;
    user-select: none;
}

/* Search container */
.search-container {
    margin-top: 15px;
    margin-bottom: 15px;
}

.search-container input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.search-container input:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

/* Map info section */
#map-info {
    margin-top: 15px;
    font-size: 12px;
    color: #666;
}

#map-info p {
    margin: 5px 0;
}

/* Custom MapLibre controls styling */
.maplibregl-ctrl-group {
    border-radius: 4px;
    overflow: hidden;
}

.maplibregl-ctrl button {
    width: 30px;
    height: 30px;
}

/* Attribution styling */
.maplibregl-ctrl-attrib {
    font-size: 11px;
    border-radius: 4px 0 0 0;
}

/* Fullscreen control */
.maplibregl-ctrl-fullscreen {
    background-image: url('data:image/svg+xml;charset=utf-8,%3Csvg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath d="M1 1v6h2V3h4V1H1zm16 0h-6v2h4v4h2V1zm0 16v-6h-2v4h-4v2h6zm-16 0h6v-2H3v-4H1v6z"/%3E%3C/svg%3E');
}

/* Loading indicator */
.map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.8);
    padding: 10px 20px;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
    z-index: 2;
    display: none;
}

.map-loading.active {
    display: block;
}

/* Responsive design */
@media (max-width: 768px) {
    #layer-controls {
        max-width: 250px;
    }
    
    .maplibregl-ctrl button {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 600px) {
    #layer-controls {
        max-width: calc(100% - 40px);
        left: 10px;
        right: 10px;
        max-height: 200px;
    }
    
    .map-overlay h3 {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    .layer-toggle {
        margin-bottom: 6px;
    }
    
    .search-container {
        margin-top: 10px;
        margin-bottom: 10px;
    }
}

/* Print styles */
@media print {
    .map-overlay,
    .maplibregl-ctrl {
        display: none !important;
    }
    
    #map {
        height: 100vh;
        width: 100vw;
    }
}