/**
 * Search Map Styles
 * 
 * Styles for Cartographie tab with Leaflet map integration
 * Task 3167: Add map view to /recherche/offreurs/
 * 
 * @package theme/search
 * @since 1.0.0
 */

/* Tab Navigation - Sub-tabs only (Liste/Cartographie within Offreurs results) */
/* Scoped to .search-results-users to avoid affecting main tabs */
.search-results-users .search-tabs {
    margin-bottom: 24px;
}

.search-results-users .search-tabs .nav-tabs {
    position: relative;
    overflow: hidden;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.search-results-users .search-tabs .search-bar {
    display: flex;
    width: 100%;
    min-height: 70px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.search-results-users .search-tabs .search-page-nav-items {
    display: flex;
    flex: 1 1 0;
    min-height: 70px;
}

.search-results-users .search-tabs .search-tabs__tab {
    display: inline-flex;
    width: 100%;
    min-height: 70px;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border: 0;
    border-radius: 0;
    color: #0a0c0d;
    text-decoration: none;
    background: #fff;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.search-results-users .search-tabs .search-tabs__tab:hover {
    background-color: #f8fafb;
}

.search-results-users .search-tabs .search-tabs__tab.search-tabs__tab--list {
    border-bottom: 2px solid #dfe2e6;
}

.search-results-users .search-tabs .search-tabs__tab.search-tabs__tab--list.search-tabs__tab--active {
    color: #306e7b;
    border-bottom-color: #306e7b;
    font-weight: 700;
}

.search-results-users .search-tabs #map-result-tab {
    background-image: url('/assets/frontend/images/map/bg-map-tab.png'), linear-gradient(180deg, #f4f7f8 0%, #e9f0f2 100%);
    background-size: cover;
    background-position: center;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}

.search-results-users .search-tabs .search-tabs__map-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 138px;
    min-height: 44px;
    padding: 9px 22px;
    border: 2px solid #306e7b;
    border-radius: 24px;
    background: #fff;
    color: #306e7b;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.search-results-users .search-tabs .search-tabs__tab:focus-visible {
    outline: 6px solid #f6c344;
    outline-offset: 2px;
}

/* Tab Panels */
.search-results__tab-panel {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.search-results__tab-panel--active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Map Container Layout */
.search-results__map-container {
    display: flex;
    gap: 20px;
    align-items: stretch;
}

/* Offerers List in Map View */
.search-results__map-offerers {
    display: flex;
    flex-direction: column;
}

.search-results__map-offerers-list {
    flex: 1 1 auto;
    overflow-y: auto;
    max-height: 627px;
    border: 0;
    border-radius: 0;
    padding: 0;
    gap: 14px;
    display: flex;
    flex-direction: column;
}

@media (min-width: 1280px) {
    .search-results__map-offerer-card {
        min-width: 364px;
        max-width: 364px;
        margin-left: auto;
        margin-right: auto;
    }
}

.search-results__map-offerer-card {
    padding: 10px;
    border: 1px solid #eef2f4;
    border-radius: 16px;
    background: white;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
    box-shadow: 0 1px 8px rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

.search-results__map-offerer-card > .search-card {
    margin: 0;
    height: 100%;
}

.search-results__map-offerer-card .search-card__link {
    height: 100%;
}

.search-results__map-offerer-card .search-card__body {
    padding-top: 8px;
}

.search-results__map-offerer-card .search-card__footer {
    margin-top: auto;
}

.search-results__map-offerer-card .search-card__title {
    line-height: 1.25;
}

.search-results__map-offerer-card .search-card__badges {
    margin-bottom: 6px;
}

.search-results__map-offerer-card .search-card__excerpt {
    margin-bottom: 0;
}

.search-results__map-offerer-card:hover {
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.10);
    border-color: #306e7b;
}

.search-results__map-offerer-card.active {
    border-color: #306e7b;
    background: #f7fbfc;
}

/* Map Wrapper */
.search-results__map-wrapper {
    border: 1px solid #dde2e6;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.07);
    min-height: 728px;
}

.search-results__map-wrapper .leaflet-container {
    font-family: inherit;
    min-height: 728px;
}

.search-results__map-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.search-results__map-research-btn {
    background: #f3f4f6;
    border: 1px solid #dfe2e6;
    color: #6b7280;
    border-radius: 24px;
    padding: 11px 16px;
    font-size: 14px;
    cursor: not-allowed;
}

/* Left list + pagination structure parity */
#map-user-block-container {
    display: flex;
    flex-direction: column;
}

.map-user-block-pagination {
    height: 100px;
    align-items: center;
    border-top: 1px solid #dfe2e6;
    border-bottom: 1px solid #dfe2e6;
    padding: 0 2px;
}

/* Responsive Design */
@media (max-width: 1280px) {
    .search-results__map-container {
        display: flex;
        flex-direction: column-reverse;
        gap: 16px;
    }

    .search-results__map-offerers-list {
        max-height: none;
    }

    .search-results__map-wrapper,
    .search-results__map-wrapper .leaflet-container {
        min-height: 892px;
        border-radius: 0;
    }

    .map-user-block-pagination {
        border-bottom: 0;
    }
}

@media (max-width: 767px) {
    .search-results-users .search-tabs .search-bar {
        min-height: 62px;
    }

    .search-results-users .search-tabs .search-page-nav-items,
    .search-results-users .search-tabs .search-tabs__tab {
        min-height: 62px;
    }

    .search-results-users .search-tabs .search-tabs__map-pill {
        min-width: 118px;
        min-height: 40px;
        padding: 8px 14px;
    }

    .search-results__map-wrapper,
    .search-results__map-wrapper .leaflet-container {
        min-height: 450px;
        border-radius: 0;
    }
}

/* Pagination in Map View */
.search-pagination--map {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* List View Styles (for consistency) */
.search-results__list--users {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .search-results__list--users {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .search-results__list--users {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
    margin: 10px 12px;
    font-size: 14px;
}

.search-map-popup {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 180px;
}

.search-map-popup__title {
    font-size: 14px;
    color: #111827;
}

.search-map-popup__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.search-map-popup__badge {
    font-size: 12px;
    background: #e8f3f6;
    color: #1b3d44;
    border-radius: 999px;
    padding: 3px 8px;
}

.search-map-popup__link {
    color: #306e7b;
    font-weight: 600;
    text-decoration: none;
}

.search-map-popup__link:hover {
    text-decoration: underline;
}

.leaflet-popup-close-button {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.leaflet-popup-close-button:hover {
    opacity: 1;
}

/* Marker Styling */
.search-results__map-marker {
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 12px;
}

.search-results__map-marker.default {
    background-color: #306e7b;
}

.search-results__map-marker.active {
    background-color: #1b3d44;
    border-width: 4px;
    box-shadow: 0 3px 10px rgba(27, 61, 68, 0.45);
}

/* Empty State in Map */
.search-results__map-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
    color: #999;
    padding: 2rem;
}

.search-results__map-empty-text {
    font-size: 1rem;
    line-height: 1.5;
}
