/* Enhanced Search Interface Styling */
.search-box {
    background: linear-gradient(135deg, #f8fffe 0%, #eef7ee 100%);
    border: 1px solid #d4edda;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(56, 122, 41, 0.1);
    position: relative;
    overflow: hidden;
}

.search-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #387a29, #28a745, #387a29);
    background-size: 200% 100%;
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { background-position: -200% 0; }
    50% { background-position: 200% 0; }
}

/* Enhanced input group styling */
.input-group-enhanced {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    background: white;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.input-group-enhanced:focus-within {
    border-color: #387a29;
    box-shadow: 0 4px 12px rgba(56, 122, 41, 0.15);
    transform: translateY(-1px);
}

.input-group-enhanced .input-group-text {
    background: linear-gradient(135deg, #387a29, #28a745);
    border: none;
    color: white;
    font-weight: 500;
    padding: 15px 20px;
}

.input-group-enhanced .form-control {
    border: none;
    padding: 15px 20px;
    font-size: 16px;
    background: white;
    transition: all 0.2s ease;
}

.input-group-enhanced .form-control:focus {
    box-shadow: none;
    background: #fafffe;
}

.input-group-enhanced .form-select {
    border: none;
    border-left: 1px solid #e9ecef;
    padding: 15px;
    background: #f8f9fa;
    font-weight: 500;
}

/* Enhanced button styling */
.btn-search-enhanced {
    background: linear-gradient(135deg, #387a29, #28a745);
    border: none;
    color: white;
    font-weight: 600;
    padding: 15px 30px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(56, 122, 41, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-search-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-search-enhanced:hover::before {
    left: 100%;
}

.btn-search-enhanced:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(56, 122, 41, 0.4);
    background: linear-gradient(135deg, #2d6320, #1e5f1e);
}

/* Mobile optimizations */
@media (max-width: 767.98px) {
    .search-box {
        margin-bottom: 25px !important;
        padding: 20px 15px !important;
    }

    .input-group-enhanced {
        flex-direction: column;
        gap: 15px;
        border-radius: 12px;
    }

    .input-group-enhanced .input-group-text,
    .input-group-enhanced .form-control,
    .input-group-enhanced .form-select {
        border-radius: 10px !important;
        border: 1px solid #e9ecef !important;
        height: auto !important;
        min-height: 54px;
        width: 100%; /* Ensure elements take full width in the column layout */
    }

    .input-group-enhanced .input-group-text {
        text-align: center;
        justify-content: center;
    }

    .btn-search-enhanced {
        width: 100%;
        margin-top: 15px;
        height: 54px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
    }

    /* Location input specific mobile styles */
    .location-input-mobile {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .location-input-mobile .form-control,
    .location-input-mobile .form-select,
    .location-input-mobile .btn {
        border-radius: 10px;
        height: 54px;
        border: 1px solid #e9ecef;
    }

    /* Stack filter pills on mobile */
    .filter-types-container {
        margin-top: 25px !important;
        text-align: center;
    }

    .filter-types-container .d-inline-flex {
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    .filter-pill {
        padding: 10px 16px;
        font-size: 14px;
        border-radius: 25px;
        font-weight: 500;
        transition: all 0.2s ease;
    }

    .filter-pill:hover {
        transform: scale(1.05);
    }
}

/* Enhanced filter pills */
.filter-pill {
    background: white;
    border: 2px solid #e9ecef;
    color: #495057;
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.filter-pill:hover {
    border-color: #387a29;
    color: #387a29;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(56, 122, 41, 0.15);
}

.filter-pill.bg-primary {
    background: linear-gradient(135deg, #387a29, #28a745) !important;
    border-color: #387a29 !important;
    color: white !important;
    box-shadow: 0 4px 8px rgba(56, 122, 41, 0.3);
}

/* 
  NEW STYLES - 2023-10-27 
  - Geolocation icon color
  - Branded "Detect Location" button
  - Map toggle button
*/

/* Style for the geolocation icon in the input group */
.input-group-text .bi-geo-alt {
    color: #387a29; /* Use brand's primary green for high contrast */
    transition: transform 0.3s ease;
}

.input-group-text:hover .bi-geo-alt {
    transform: scale(1.1);
}

/* Branded "Detect Location" button */
.location-detect-btn {
    background: linear-gradient(135deg, #28a745, #387a29); /* Primary green gradient */
    border: none;
    color: white;
    font-weight: 500;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(56, 122, 41, 0.2);
    transition: all 0.3s ease;
}

.location-detect-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(56, 122, 41, 0.3);
    background: linear-gradient(135deg, #1e5f1e, #2d6320); /* Darken on hover */
    color: white; /* Ensure text remains white */
}

/* Map Toggle Button */
.btn-map-toggle {
    color: #387a29;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-map-toggle:hover {
    color: #2d6320;
    text-decoration: underline;
}

/* Header enhancements */
.page-header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
}

.page-header h1 {
    background: linear-gradient(135deg, #387a29, #28a745);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.page-header .lead {
    color: #6c757d;
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Enhanced pagination */
.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, #387a29, #28a745);
    border-color: #387a29;
    box-shadow: 0 2px 4px rgba(56, 122, 41, 0.3);
}

.pagination .page-link {
    color: #387a29;
    border-radius: 8px;
    margin: 0 2px;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.pagination .page-link:hover {
    color: white;
    background: linear-gradient(135deg, #387a29, #28a745);
    border-color: #387a29;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(56, 122, 41, 0.2);
}

/* Location detection button enhancement */
.location-detect-btn {
    background: linear-gradient(135deg, #387a29, #20ff027f);
    border: none;
    color: white;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(23, 162, 184, 0.3);
}

.location-detect-btn:hover {
    background: linear-gradient(135deg, #357527, #18c4027f);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(23, 162, 184, 0.4);
}

/* Enhanced form labels */
.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-label small {
    font-weight: 400;
    font-size: 0.875rem;
}

/* Loading state enhancements */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    z-index: 10;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e9ecef;
    border-top: 3px solid #387a29;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive design improvements */
@media (min-width: 768px) {
    .search-box {
        padding: 30px;
    }
    
    .input-group-enhanced {
        flex-direction: row;
    }
    
    .btn-search-enhanced {
        width: auto;
        margin-top: 0;
    }
}

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* Focus indicators */
.form-control:focus,
.form-select:focus,
.btn:focus {
    outline: 2px solid #387a29;
    outline-offset: 2px;
}

/* Map Modal Specific Styles */
#mapSelectionModal .modal-dialog {
    max-width: 800px;
}

#modalMap {
    min-height: 400px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

/* Ensure Mapbox controls are properly styled in modal */
#modalMap .mapboxgl-ctrl-group {
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#modalMap .mapboxgl-ctrl-group button {
    background: white;
    border: none;
    color: #495057;
}

#modalMap .mapboxgl-ctrl-group button:hover {
    background: #f8f9fa;
    color: #387a29;
}

/* Modal coordinate display styling */
#modalLatDisplay,
#modalLngDisplay {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    background-color: #f8f9fa;
}

/* Map marker styling for better visibility */
.mapboxgl-marker {
    cursor: pointer;
}

/* Responsive modal adjustments */
@media (max-width: 767.98px) {
    #mapSelectionModal .modal-dialog {
        margin: 0.5rem;
        max-width: none;
    }

    #modalMap {
        height: 300px;
        min-height: 300px;
    }

    #mapSelectionModal .modal-body {
        padding: 1rem;
    }

    #mapSelectionModal .row.g-3 {
        --bs-gutter-x: 0.75rem;
    }

    #mapSelectionModal .col-md-6 {
        margin-bottom: 1rem;
    }
}

/* Compact Search Form Layout */
.input-group-compact {
    height: 42px;
}

.input-group-compact .form-control,
.input-group-compact .form-select,
.input-group-compact .input-group-text {
    height: 42px;
    min-height: 42px;
    border-radius: 6px;
}

.input-group-compact .input-group-text {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group-compact .form-control {
    border-radius: 0;
}

.input-group-compact .form-select {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Search button to match input height */
.btn-search-enhanced {
    height: 42px;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Form labels compact styling */
.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Mobile form controls */
.location-input-mobile .form-control,
.location-input-mobile .form-select {
    height: 42px;
    min-height: 42px;
}

/* Button column spacing */
.col-lg-2 .mb-2 {
    margin-bottom: 8px !important;
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
    .input-group-compact,
    .input-group-compact .form-control,
    .input-group-compact .form-select,
    .input-group-compact .input-group-text,
    .btn-search-enhanced,
    .location-input-mobile .form-control,
    .location-input-mobile .form-select {
        height: 40px;
        min-height: 40px;
    }
}

/* Additional mobile fix for tablets and smaller screens */
@media (max-width: 991.98px) and (min-width: 768px) {
    /* Hide the magnifying glass icon container on tablets to prevent green bar overlap */
    .input-group-compact .input-group-text {
        display: none !important;
    }

    /* Adjust the search input to take full width when icon is hidden */
    .input-group-compact .form-control {
        border-radius: 6px !important;
        border-top-left-radius: 6px !important;
        border-bottom-left-radius: 6px !important;
    }
}

@media (max-width: 767.98px) {
    .input-group-compact,
    .input-group-compact .form-control,
    .input-group-compact .form-select,
    .input-group-compact .input-group-text,
    .btn-search-enhanced,
    .location-input-mobile .form-control,
    .location-input-mobile .form-select {
        height: 38px;
        min-height: 38px;
    }

    /* Hide the magnifying glass icon container on mobile to prevent green bar overlap */
    .input-group-compact .input-group-text {
        display: none !important;
    }

    /* Adjust the search input to take full width when icon is hidden */
    .input-group-compact .form-control {
        border-radius: 6px !important;
        border-top-left-radius: 6px !important;
        border-bottom-left-radius: 6px !important;
    }

    .form-label {
        margin-bottom: 6px;
    }

    .col-lg-2 .mb-2 {
        margin-bottom: 6px !important;
    }
}

/* Empty State Message Centering - Desktop Only */
@media (min-width: 1024px) {
    /* Only center empty state cards, not the entire product grid */
    .col-12 .card.custom-green-bg-light {
        max-width: 600px;
        margin: 2rem auto;
    }
}