/* Leaflet customizations */
.leaflet-popup-content-wrapper {
    border-radius: var(--border-radius);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.leaflet-popup-content {
    margin: 13px 19px;
    line-height: 1.5;
}

.popup-content h3 {
    margin: 0 0 10px 0;
    color: var(--dark-color);
    font-size: 16px;
}

.popup-content p {
    margin: 5px 0;
    color: #666;
    font-size: 14px;
}

.popup-content .popup-meta {
    font-size: 12px;
    color: #999;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

/* Popup actions section */
.popup-content .popup-actions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.popup-content .popup-actions .btn {
    flex: 1;
    max-width: 120px;
}

/* Leaflet Circle Markers - Add this section */
.leaflet-marker-icon {
    background-color: transparent !important;
    border: none !important;
}

.leaflet-interactive {
    cursor: pointer;
}

/* Ensure circle markers are visible - but NOT cut polygons */
path.leaflet-interactive:not(.cut-polygon) {
    stroke: #fff;
    stroke-opacity: 1;
    stroke-width: 2;
    fill-opacity: 0.8;
}

/* Fix for marker z-index */
.leaflet-pane.leaflet-marker-pane {
    z-index: 600;
}

.leaflet-pane.leaflet-tooltip-pane {
    z-index: 650;
}

.leaflet-pane.leaflet-popup-pane {
    z-index: 700;
}

/* Ensure markers are above the map tiles */
.leaflet-marker-pane svg {
    position: relative;
    z-index: 1;
}

/* Force circle markers to be visible */
.leaflet-overlay-pane svg {
    z-index: 1;
}

.leaflet-overlay-pane svg path {
    cursor: pointer;
    pointer-events: auto;
}

/* Ensure SVG circle markers are rendered */
.location-marker {
    cursor: pointer !important;
}

/* Override any conflicting styles - but allow cuts to manage their own opacity */
.leaflet-container path.leaflet-interactive:not(.cut-polygon) {
    stroke: #ffffff !important;
    stroke-opacity: 1 !important;
    stroke-width: 2px !important;
    fill-opacity: 0.8 !important;
}

/* Cut polygons - allow dynamic opacity (higher specificity to override) */
.leaflet-container path.leaflet-interactive.cut-polygon {
    stroke-width: 2px !important;
    /* Allow JavaScript to control fill-opacity - explicitly do NOT override it */
    stroke: currentColor !important;
    stroke-opacity: 0.8 !important;
}

/* Additional specificity rule for cut polygons to ensure JS opacity takes precedence */
path.leaflet-interactive.cut-polygon {
    /* Do not set fill-opacity here - let JavaScript control it */
    stroke-width: 2px;
}

/* Marker being moved */
.location-marker.leaflet-drag-target {
    cursor: move !important;
}

/* Popup actions buttons spacing */
.popup-actions {
    display: flex;
    gap: 5px;
    margin-top: 10px;
}

/* Pulsing animation for marker being moved */
@keyframes pulse-marker {
    0% {
        transform: scale(1);
        opacity: 0.9;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0.9;
    }
}

/* Ensure marker animations work */
.leaflet-overlay-pane svg path {
    transform-origin: center;
}

/* Move confirmation popup styles */
.move-confirm-popup-wrapper .leaflet-popup-content-wrapper {
    background: white;
    border: 2px solid var(--primary-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.move-confirm-popup {
    text-align: center;
    padding: 10px;
}

.move-confirm-popup h3 {
    margin: 0 0 10px 0;
    color: var(--dark-color);
    font-size: 16px;
}

.move-confirm-popup p {
    margin: 0 0 15px 0;
    color: #666;
}

.move-confirm-popup .popup-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Cancel move button styles */
#cancel-move-btn,
#mobile-cancel-move-btn {
    background-color: var(--danger-color);
    color: white;
}

#cancel-move-btn:hover,
#mobile-cancel-move-btn:hover {
    background-color: #c0392b;
}

/* Ensure crosshairs are visible during move */
.crosshair {
    z-index: 1100;
}

/* 
 * Z-Index Hierarchy for Map Markers:
 * - Start Location Marker: zIndexOffset 1000 (highest - always on top)
 * - Temporary Location Markers: zIndexOffset 150 (during move operations)
 * - NocoDB Location Markers: zIndexOffset 100 (main database locations)
 * - Default: zIndexOffset 0 (cuts, other overlays)
 * - City Data Markers: zIndexOffset -100 (background - behind main locations)
 */
