/* GW BP GeoSearch - Main Styles */

.gw-bp-geosearch-wrapper {
    position: relative;
    margin-bottom: 20px;
}

/* Add more specific styles for map, list, controls, filters, spinner, etc. */

.gw-bp-geosearch-spinner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    z-index: 1000; /* Ensure it's above map/list */
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
}

.gw-bp-geosearch-spinner.is-active {
    display: flex;
}

.gw-bp-geosearch-map {
    height: 400px; /* Default height, can be overridden */
    width: 100%;
}

.gw-bp-geosearch-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.gw-bp-geosearch-search-filter {
    display: flex;
    gap: 5px;
}

#gw-bp-geosearch-toggle-filters .dashicons {
    vertical-align: middle;
    transition: transform 0.3s ease;
}

#gw-bp-geosearch-toggle-filters.open .dashicons {
    transform: rotate(180deg);
}

/* Updated styling for filter panel */
.gw-bp-geosearch-filter-panel {
    border: 1px solid #ccc;
    padding: 15px;
    margin-bottom: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
}

.gw-bp-geosearch-filter-panel h4 {
    margin-top: 0;
    margin-bottom: 10px;
}

#gw-bp-geosearch-filter-form .filter-field {
    margin-bottom: 20px;
}

#gw-bp-geosearch-filter-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

#gw-bp-geosearch-filter-form input[type="text"],
#gw-bp-geosearch-filter-form select {
    width: 100%;
    max-width: 300px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Checkbox group styling */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 5px;
}

.checkbox-option {
    display: flex;
    align-items: center;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px 10px;
    transition: background-color 0.2s;
}

.checkbox-option:hover {
    background-color: #e8e8e8;
}

.checkbox-option input[type="checkbox"] {
    margin-right: 6px;
}

.checkbox-option label {
    margin: 0 !important;
    font-weight: normal !important;
    cursor: pointer;
    font-size: 0.9em;
}

/* Responsive adjustments for checkbox options */
@media (max-width: 480px) {
    .checkbox-option {
        flex-basis: 100%; /* Full width on very small screens */
    }
}

.filter-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

/* Additional responsive adjustments */
@media (max-width: 600px) {
    .checkbox-group {
        gap: 8px;
    }
    
    .checkbox-option {
        padding: 4px 8px;
        min-width: 45%; /* Two columns on small screens */
    }
}

@media (min-width: 601px) and (max-width: 900px) {
    .checkbox-option {
        min-width: 30%; /* Three columns on medium screens */
    }
}

@media (min-width: 901px) {
    .checkbox-option {
        min-width: 22%; /* Four columns on large screens */
    }
}

.gw-bp-geosearch-list-results ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.gw-bp-geosearch-list-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.gw-bp-geosearch-list-item:last-child {
    border-bottom: none;
}

.gw-bp-geosearch-list-item img.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-right: 15px;
}

.gw-bp-geosearch-list-item-details h5 {
    margin: 0 0 5px 0;
}

.gw-bp-geosearch-list-item-details a {
    text-decoration: none;
}

.gw-bp-geosearch-list-item-location {
    font-size: 0.9em;
    color: #666;
}

.gw-bp-geosearch-pagination {
    margin-top: 15px;
    text-align: center;
}

.gw-bp-geosearch-pagination .page-numbers {
    display: inline-block;
    padding: 5px 10px;
    margin: 0 2px;
    border: 1px solid #ccc;
    text-decoration: none;
    color: #0073aa;
}

.gw-bp-geosearch-pagination .page-numbers.current {
    font-weight: bold;
    background-color: #f0f0f0;
    color: #333;
}

.gw-bp-geosearch-pagination .page-numbers:hover {
    background-color: #e0e0e0;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .gw-bp-geosearch-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .gw-bp-geosearch-search-filter {
        width: 100%;
        justify-content: space-between;
    }
    #gw-bp-geosearch-term {
        flex-grow: 1;
    }
}

/* Leaflet Popup Customization */
.gw-bp-geosearch-popup .avatar {
    float: left;
    margin-right: 10px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.gw-bp-geosearch-popup h5 {
    margin: 0 0 5px 0;
    font-size: 1.1em;
}

.gw-bp-geosearch-popup p {
    margin: 0 0 5px 0;
    font-size: 0.9em;
    line-height: 1.3;
    clear: both; /* Clear float if text is short */
}

.gw-bp-geosearch-popup a.button {
    display: inline-block;
    margin-top: 5px;
    padding: 3px 8px;
    font-size: 0.9em;
    text-decoration: none;
    background-color: #0073aa;
    color: white;
    border-radius: 3px;
}

.gw-bp-geosearch-popup a.button:hover {
    background-color: #005177;
}

/* Layout containers */
.gw-bp-geosearch-results-wrapper {
    display: flex;
    gap: 20px;
    margin-top: 15px;
}

.gw-bp-geosearch-view {
    flex: 1;
    min-width: 0; /* Prevents flex items from overflowing */
}

/* Make sure list view is visible by default on desktop */
#gw-bp-geosearch-list-container {
    display: block; /* Show by default */
}

#gw-bp-geosearch-map-container {
    position: sticky;
    top: 20px; /* Adjust based on your header height */
    height: calc(100vh - 100px); /* Adjust based on your layout */
}

.gw-bp-geosearch-map {
    height: 100%;
    min-height: 400px;
    width: 100%;
}

/* Mobile styles */
@media (max-width: 768px) {
    .gw-bp-geosearch-results-wrapper {
        flex-direction: column;
    }

    .gw-bp-geosearch-view {
        width: 100%;
    }

    #gw-bp-geosearch-map-container {
        position: relative;
        top: 0;
        height: 400px; /* Fixed height on mobile */
    }

    /* Show/hide based on selected view */
    .view-map #gw-bp-geosearch-list-container,
    .view-list #gw-bp-geosearch-map-container {
        display: none;
    }
}


/**
 * GW BP GeoSearch - Avatar Markers Styling
 */

 .gw-bp-geosearch-avatar-marker {
    background: none;
    border: none;
}

.avatar-marker {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #fff;
    box-shadow: 0 1px 5px rgba(0,0,0,0.4);
    background-color: #f1f1f1;
    transition: transform 0.2s ease;
}

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

.avatar-marker img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Adjust popup styles */
.gw-bp-geosearch-popup {
    text-align: center;
    padding: 5px;
}

.gw-bp-geosearch-popup .avatar {
    margin-bottom: 10px;
}

.leaflet-popup-content {
    margin: 10px;
}

.gw-bp-geosearch-list-item.highlight {
    background-color: #f0f7ff;
    border-left: 3px solid #007bff;
    transition: background-color 0.3s ease;
}
