/**
 * Leaflet-based Mapy.cz Styles with Marker Clustering
 * Styles for the Leaflet implementation with clustering support
 */

.mapy-leaflet-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #f5f5f5;
}

.mapy-leaflet-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

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

/* Custom marker styling */
.leaflet-marker-icon {
    transition: transform 0.2s ease;
}

.leaflet-marker-icon:hover {
    transform: scale(1.1);
    z-index: 1000 !important;
}

/* Custom marker cluster styling */
.marker-cluster {
    background-clip: padding-box;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.marker-cluster:hover {
    transform: scale(1.1);
    z-index: 1001 !important;
}

.marker-cluster > div {
    width: 40px;
    height: 40px;
    margin-left: -20px;
    margin-top: -20px;
    text-align: center;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.marker-cluster-small > div {
    background-color: #4CAF50;
    border: 2px solid #45a049;
}

.marker-cluster-medium > div {
    background-color: #FF9800;
    border: 2px solid #f57c00;
}

.marker-cluster-large > div {
    background-color: #F44336;
    border: 2px solid #d32f2f;
}

.marker-cluster:hover > div {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Cluster animation */
.marker-cluster-anim {
    animation: clusterPulse 0.6s ease-out;
}

@keyframes clusterPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Custom popup styling */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
    margin: 8px 12px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
}

.leaflet-popup-tip {
    background: white;
}

/* Loading state */
.mapy-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 30;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.mapy-loading::after {
    content: '';
    display: block;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* Error state */
.mapy-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 30;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 300px;
}

.mapy-error h3 {
    margin: 0 0 10px 0;
    color: #d63638;
}

.mapy-error p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Leaflet controls customization */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

.leaflet-control-zoom a {
    background: white !important;
    color: #333 !important;
    border: none !important;
    border-radius: 4px !important;
    margin: 2px !important;
    transition: all 0.2s ease !important;
}

.leaflet-control-zoom a:hover {
    background: #f8f8f8 !important;
    color: #000 !important;
}

.leaflet-control-zoom a:active {
    transform: scale(0.95) !important;
}

/* Attribution styling */
.leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.8) !important;
    font-size: 11px !important;
    padding: 4px 8px !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .leaflet-control-zoom {
        transform: scale(0.9);
    }
    
    .leaflet-control-attribution {
        font-size: 10px !important;
    }
    
    .marker-cluster > div {
        width: 36px;
        height: 36px;
        margin-left: -18px;
        margin-top: -18px;
        font-size: 12px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .leaflet-marker-icon {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .leaflet-control-zoom a {
        background: #333 !important;
        color: #fff !important;
    }
    
    .leaflet-control-zoom a:hover {
        background: #444 !important;
    }
    
    .mapy-loading {
        background: rgba(0, 0, 0, 0.9);
        color: #fff;
    }
    
    .mapy-error {
        background: #333;
        color: #fff;
    }
    
    .mapy-error h3 {
        color: #ff6b6b;
    }
    
    .mapy-error p {
        color: #ccc;
    }
    
    .leaflet-control-attribution {
        background: rgba(0, 0, 0, 0.8) !important;
        color: #ccc !important;
    }
    
    /* Dark mode cluster colors */
    .marker-cluster-small > div {
        background-color: #2E7D32;
        border-color: #1B5E20;
    }
    
    .marker-cluster-medium > div {
        background-color: #E65100;
        border-color: #BF360C;
    }
    
    .marker-cluster-large > div {
        background-color: #C62828;
        border-color: #B71C1C;
    }
}

/* Custom marker animations */
@keyframes markerBounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.leaflet-marker-icon.animated {
    animation: markerBounce 1s ease-in-out;
}

/* Map container focus styles */
.mapy-leaflet-wrapper:focus-within {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Accessibility improvements */
.leaflet-control-zoom a:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .leaflet-control-zoom,
    .leaflet-control-attribution {
        display: none !important;
    }
    
    .marker-cluster {
        display: none !important;
    }
}

/* Cluster coverage area (optional) */
.marker-cluster-small {
    background-color: rgba(76, 175, 80, 0.2);
}

.marker-cluster-medium {
    background-color: rgba(255, 152, 0, 0.2);
}

.marker-cluster-large {
    background-color: rgba(244, 67, 54, 0.2);
} 