/* Sticky Map Layout CSS for WP Location Mapper */

/* Fix block disappearing issue by allowing text selection */
.wp-location-mapper-block,
.wp-location-mapper-block *,
.location-map-container,
.location-list {
    user-select: text !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
}

/* Prevent map interference with text selection */
.wp-location-mapper-block {
    position: relative !important;
}

.wp-location-mapper-block:hover {
    outline: none !important;
}

/* Container for sticky layout - add this class to your Columns block */
.wp-location-mapper-sticky-layout {
    display: flex !important;
    align-items: flex-start !important;
    gap: 2rem !important;
}

/* Content column (left) - scrollable */
.wp-location-mapper-content-column {
    flex: 1 !important;
    min-width: 0 !important; /* Prevent flex overflow */
}

/* Map column (right) - sticky */
.wp-location-mapper-map-column {
    flex: 0 0 40% !important; /* Fixed width at 40% */
    position: sticky !important;
    top: 2rem !important; /* Distance from top when stuck */
    height: fit-content !important;
    max-height: calc(100vh - 4rem) !important; /* Don't exceed viewport */
    overflow: auto !important; /* Scroll if content is too tall */
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .wp-location-mapper-sticky-layout {
        flex-direction: column !important;
    }

    .wp-location-mapper-map-column {
        position: relative !important;
        flex: none !important;
        width: 100% !important;
        max-height: 400px !important;
    }
}

/* Alternative: Full-width sticky map */
.wp-location-mapper-fullwidth-sticky {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    width: 40% !important;
    height: 100vh !important;
    z-index: 999 !important;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1) !important;
}

.wp-location-mapper-fullwidth-sticky + .wp-location-mapper-content-column {
    margin-right: 42% !important; /* Make space for fixed map */
}

/* Smooth transitions */
.wp-location-mapper-map-column,
.wp-location-mapper-fullwidth-sticky {
    transition: all 0.3s ease !important;
}

/* Ensure map blocks work well in sticky context */
.wp-location-mapper-map-column .wp-location-mapper-block,
.wp-location-mapper-fullwidth-sticky .wp-location-mapper-block {
    height: 100% !important;
}

.wp-location-mapper-map-column .location-map-container,
.wp-location-mapper-fullwidth-sticky .location-map-container {
    height: 60vh !important;
    min-height: 400px !important;
}

/* Admin bar compensation */
.admin-bar .wp-location-mapper-fullwidth-sticky {
    top: 32px !important;
    height: calc(100vh - 32px) !important;
}

@media screen and (max-width: 782px) {
    .admin-bar .wp-location-mapper-fullwidth-sticky {
        top: 46px !important;
        height: calc(100vh - 46px) !important;
    }
}