/* Hierarchical Cluster Styles */

.leaflet-hierarchical-cluster {
    background: transparent !important;
    border: none !important;
}

.hierarchical-cluster {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.hierarchical-cluster:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    z-index: 1000 !important;
}

/* Country cluster with flag */
.country-cluster {
    animation: pulse 2s infinite;
}

.country-cluster .cluster-flag {
    font-size: 24px;
    line-height: 1;
    margin-bottom: 2px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Diocese cluster */
.diocese-cluster .cluster-emoji {
    font-size: 20px;
    line-height: 1;
    margin-bottom: 2px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Cluster count */
.cluster-count {
    color: white;
    font-weight: bold;
    font-size: 12px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    line-height: 1;
}

/* Large clusters get bigger text */
.hierarchical-cluster[style*="width: 60"] .cluster-count,
.hierarchical-cluster[style*="width: 70"] .cluster-count,
.hierarchical-cluster[style*="width: 80"] .cluster-count {
    font-size: 14px;
}

/* Animation for country clusters */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    }
}

/* Cluster Legend */
.cluster-legend {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    min-width: 180px;
}

.cluster-legend h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #ddd;
    padding-bottom: 4px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin: 4px 0;
    font-size: 12px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 8px;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.legend-label {
    color: #555;
    white-space: nowrap;
}

/* Dark mode support */
.dark-mode .cluster-legend {
    background: rgba(30, 30, 30, 0.95);
    color: #fff;
}

.dark-mode .cluster-legend h4 {
    color: #fff;
    border-bottom-color: #444;
}

.dark-mode .legend-label {
    color: #ccc;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .cluster-legend {
        min-width: 150px;
        padding: 8px;
    }

    .cluster-legend h4 {
        font-size: 12px;
    }

    .legend-item {
        font-size: 11px;
    }

    .legend-color {
        width: 16px;
        height: 16px;
    }

    .hierarchical-cluster {
        border-width: 2px;
    }

    .country-cluster .cluster-flag {
        font-size: 20px;
    }

    .diocese-cluster .cluster-emoji {
        font-size: 16px;
    }
}

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

/* Tooltip styles for clusters */
.leaflet-tooltip.cluster-tooltip {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.cluster-tooltip strong {
    color: #fbbf24;
    font-size: 13px;
}