/**
 * Styles pour la carte interactive AIP
 * Mobile-first responsive design
 */

/* === Container principal === */
.aip-map-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

/* === Layout === */
.aip-map-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
}

/* === Sidebar des filtres === */
.aip-filters-sidebar {
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.aip-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.aip-filters-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.aip-filters-toggle {
    display: none;
    cursor: pointer;
    font-size: 14px;
}

.aip-reset-filters {
    cursor: pointer;
    font-size: 14px;
}

.aip-filter-group {
    margin-bottom: 20px;
}

.aip-filter-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.aip-filter-group select,
.aip-filter-group input[type="number"],
.aip-filter-group input[type="range"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.aip-filter-group select:focus,
.aip-filter-group input:focus {
    outline: none;
    border-color: #007bff;
}

.aip-range-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.aip-range-value {
    display: block;
    margin-top: 5px;
    font-size: 13px;
    color: #666;
    text-align: right;
}

/* === Carte === */
.aip-map-section {
    position: relative;
    flex: 1;
}

#aip-leaflet-map {
    width: 100%;
    height: 500px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

/* === Popups Leaflet === */
.aip-popup-content {
    min-width: 250px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.aip-popup-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 10px;
}

.aip-popup-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #333;
}

.aip-popup-details {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.aip-popup-price {
    font-size: 18px;
    font-weight: 700;
    margin: 10px 0;
}

.aip-popup-link {
    display: inline-block;
    padding: 8px 16px;
    text-decoration: none;
    font-size: 14px;
    margin-top: 10px;
}

/* === Liste des biens === */
.aip-biens-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 20px;
}

.aip-bien-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.aip-bien-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.aip-bien-image-wrapper {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.aip-bien-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.aip-bien-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    opacity: 0.95;
}

.aip-bien-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.aip-bien-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: #333;
}

.aip-bien-location {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.aip-bien-details {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.aip-bien-detail {
    font-size: 14px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 5px;
}

.aip-bien-price {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 15px;
}

.aip-bien-link {
    display: inline-block;
    padding: 10px 20px;
    text-decoration: none;
    text-align: center;
    margin-top: auto;
}

/* === Options d'affichage === */
.aip-view-options {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.aip-view-btn {
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.aip-view-btn.active {
    font-weight: 600;
}

/* === Loader === */
.aip-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
}

.aip-loader-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

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

/* === Messages === */
.aip-no-results {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.aip-results-count {
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
}

/* === Responsive === */

/* Tablets */
@media (min-width: 768px) {
    .aip-map-container {
        flex-direction: row;
    }

    .aip-filters-sidebar {
        width: 320px;
        flex-shrink: 0;
    }

    .aip-biens-list {
        grid-template-columns: repeat(2, 1fr);
    }

    #aip-leaflet-map {
        height: 600px;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .aip-biens-list {
        grid-template-columns: repeat(3, 1fr);
    }

    #aip-leaflet-map {
        height: 700px;
    }
}

/* Mobile - Filtres collapsibles */
@media (max-width: 767px) {
    .aip-filters-toggle {
        display: block;
    }

    .aip-filters-content {
        display: none;
    }

    .aip-filters-content.active {
        display: block;
    }

    .aip-filters-sidebar {
        position: relative;
        z-index: 10;
    }
}

/* === Utilitaires === */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}
