/**
 * Prado Map - Styles principaux
 */

/* Variables */
:root {
    --prado-primary: #1e3a5f;
    --prado-secondary: #e74c3c;
    --prado-accent: #3498db;
    --prado-light: #f8f9fa;
    --prado-gray: #6c757d;
    --prado-border: #dee2e6;
    --prado-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --prado-radius: 8px;
}

/* Container principal */
.prado-map-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

/* Sidebar (filtres + liste) */
.prado-map-sidebar {
    width: 380px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 700px;
}

/* Wrapper de la carte */
.prado-map-wrapper {
    flex: 1;
    min-width: 300px;
    position: relative;
    border-radius: var(--prado-radius);
    overflow: hidden;
    box-shadow: var(--prado-shadow);
}

.prado-map-canvas {
    width: 100%;
    height: 100%;
}

/* Loading */
.prado-map-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 1000;
}

.prado-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--prado-border);
    border-top-color: var(--prado-primary);
    border-radius: 50%;
    animation: prado-spin 0.8s linear infinite;
}

@keyframes prado-spin {
    to { transform: rotate(360deg); }
}

/* Recherche */
.prado-map-search {
    display: flex;
    gap: 8px;
}

.prado-search-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--prado-border);
    border-radius: var(--prado-radius);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.prado-search-input:focus {
    border-color: var(--prado-primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.prado-search-btn {
    padding: 12px 16px;
    background: var(--prado-primary);
    color: white;
    border: none;
    border-radius: var(--prado-radius);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.prado-search-btn:hover {
    background: #152a45;
}

/* Actions sidebar (Filtres + Geoloc) */
.prado-sidebar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.prado-filters-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: white;
    border: 1px solid var(--prado-border);
    border-radius: var(--prado-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    transition: all 0.2s;
}

.prado-filters-toggle:hover {
    border-color: var(--prado-primary);
    color: var(--prado-primary);
}

.prado-filters-toggle.active {
    background: var(--prado-primary);
    color: white;
    border-color: var(--prado-primary);
}

.prado-filters-toggle svg {
    flex-shrink: 0;
}

/* Géolocalisation */
.prado-geoloc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--prado-accent);
    color: white;
    border: none;
    border-radius: var(--prado-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.prado-geoloc-btn:hover {
    background: #2980b9;
}

.prado-geoloc-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.prado-radius-select {
    padding: 10px 12px;
    border: 1px solid var(--prado-border);
    border-radius: var(--prado-radius);
    font-size: 14px;
    outline: none;
    background: white;
}

/* Panel Filtres (collapsible) */
.prado-filters-panel {
    background: white;
    border: 1px solid var(--prado-border);
    border-radius: var(--prado-radius);
    overflow: hidden;
}

.prado-filter-group {
    border-bottom: 1px solid var(--prado-border);
}

.prado-filter-group:last-of-type {
    border-bottom: none;
}

.prado-filter-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--prado-primary);
    background: var(--prado-light);
    cursor: pointer;
    user-select: none;
}

.prado-filter-toggle {
    font-size: 10px;
    transition: transform 0.2s;
}

.prado-filter-group.collapsed .prado-filter-toggle {
    transform: rotate(-90deg);
}

.prado-filter-options {
    padding: 10px 15px;
    max-height: 180px;
    overflow-y: auto;
}

.prado-filter-group.collapsed .prado-filter-options {
    display: none;
}

.prado-filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    cursor: pointer;
}

.prado-filter-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--prado-primary);
}

.prado-filter-label {
    flex: 1;
}

.prado-filter-count {
    color: var(--prado-gray);
    font-size: 12px;
}

.prado-reset-filters {
    width: 100%;
    padding: 12px;
    background: none;
    border: none;
    border-top: 1px solid var(--prado-border);
    color: var(--prado-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.prado-reset-filters:hover {
    background: #fef2f2;
}

/* Liste des résultats */
.prado-map-results {
    background: white;
    border: 1px solid var(--prado-border);
    border-radius: var(--prado-radius);
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 300px;
}

.prado-results-header {
    padding: 12px 15px;
    background: var(--prado-light);
    font-weight: 600;
    color: var(--prado-primary);
    border-bottom: 1px solid var(--prado-border);
}

.prado-results-count {
    color: var(--prado-secondary);
}

.prado-results-list {
    flex: 1;
    overflow-y: auto;
}

/* Item de résultat avec image */
.prado-result-item {
    display: flex;
    gap: 12px;
    padding: 12px 15px;
    border-bottom: 1px solid var(--prado-border);
    cursor: pointer;
    transition: background 0.2s, border-left-color 0.2s;
    border-left: 3px solid transparent;
}

.prado-result-item:last-child {
    border-bottom: none;
}

.prado-result-item:hover {
    background: #f8f9fa;
}

.prado-result-item.active {
    background: #e8f4ff;
    border-left-color: var(--prado-primary);
}

.prado-result-thumb {
    width: 80px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: #eee;
}

.prado-result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.prado-result-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
}

.prado-result-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.prado-result-title {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prado-result-address {
    margin: 0;
    font-size: 13px;
    color: var(--prado-gray);
}

.prado-result-distance {
    font-size: 12px;
    color: var(--prado-accent);
    font-weight: 600;
    margin-top: 2px;
}

.prado-result-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    flex-shrink: 0;
    color: var(--prado-primary);
    opacity: 0.5;
    transition: opacity 0.2s;
}

.prado-result-item:hover .prado-result-arrow,
.prado-result-item.active .prado-result-arrow {
    opacity: 1;
}

.prado-no-results {
    padding: 40px 20px;
    text-align: center;
    color: var(--prado-gray);
}

/* Pagination */
.prado-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 12px 15px;
    border-top: 1px solid var(--prado-border);
    background: var(--prado-light);
}

.prado-page-prev,
.prado-page-next {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--prado-border);
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    color: #333;
}

.prado-page-prev:hover:not(:disabled),
.prado-page-next:hover:not(:disabled) {
    border-color: var(--prado-primary);
    color: var(--prado-primary);
}

.prado-page-prev:disabled,
.prado-page-next:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.prado-page-numbers {
    display: flex;
    gap: 4px;
}

.prado-page-num {
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    border: 1px solid var(--prado-border);
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.prado-page-num:hover {
    border-color: var(--prado-primary);
    color: var(--prado-primary);
}

.prado-page-num.active {
    background: var(--prado-primary);
    color: white;
    border-color: var(--prado-primary);
}

.prado-page-ellipsis {
    display: flex;
    align-items: center;
    padding: 0 4px;
    color: var(--prado-gray);
}

/* Marqueurs */
.prado-marker-icon {
    background: none !important;
    border: none !important;
}

.prado-marker {
    width: 32px;
    height: 42px;
    color: var(--prado-secondary);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    transition: transform 0.2s;
}

.prado-marker:hover {
    transform: scale(1.1);
}

.prado-marker svg {
    width: 100%;
    height: 100%;
}

/* Marqueur utilisateur */
.prado-user-marker-icon {
    background: none !important;
    border: none !important;
}

.prado-user-marker {
    width: 20px;
    height: 20px;
    background: var(--prado-accent);
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    animation: prado-pulse 2s infinite;
}

@keyframes prado-pulse {
    0% { box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(52, 152, 219, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 152, 219, 0); }
}

/* Clusters */
.prado-cluster-icon {
    background: none !important;
    border: none !important;
}

.prado-cluster {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--prado-primary);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    border: 3px solid white;
}

.prado-cluster-medium {
    width: 50px;
    height: 50px;
    font-size: 16px;
}

.prado-cluster-large {
    width: 60px;
    height: 60px;
    font-size: 18px;
}

/* Popup */
.prado-popup .leaflet-popup-content-wrapper {
    border-radius: var(--prado-radius);
    padding: 0;
    overflow: hidden;
}

.prado-popup .leaflet-popup-content {
    margin: 0;
    min-width: 250px;
}

.prado-popup-content {
    padding: 0;
}

.prado-popup-image {
    width: 100%;
    height: 120px;
    overflow: hidden;
}

.prado-popup-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.prado-popup-title {
    margin: 12px 15px 8px;
    font-size: 16px;
    font-weight: 700;
    color: var(--prado-primary);
}

.prado-popup-types {
    padding: 0 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}

.prado-tag {
    font-size: 11px;
    padding: 2px 8px;
    background: var(--prado-light);
    color: var(--prado-primary);
    border-radius: 10px;
}

.prado-popup-address,
.prado-popup-phone,
.prado-popup-distance {
    margin: 0;
    padding: 5px 15px;
    font-size: 13px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 8px;
}

.prado-popup-address svg,
.prado-popup-phone svg {
    color: var(--prado-gray);
    flex-shrink: 0;
}

.prado-popup-phone a {
    color: var(--prado-accent);
    text-decoration: none;
}

.prado-popup-distance {
    color: var(--prado-accent);
    font-size: 12px;
}

.prado-popup-link {
    display: block;
    padding: 12px 15px;
    margin-top: 10px;
    background: var(--prado-primary);
    color: white;
    text-align: center;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.2s;
}

.prado-popup-link:hover {
    background: #152a45;
    color: white;
}

/* Responsive */
@media (max-width: 900px) {
    .prado-map-sidebar {
        width: 320px;
    }
}

@media (max-width: 768px) {
    .prado-map-container {
        flex-direction: column;
    }

    .prado-map-sidebar {
        width: 100%;
        max-height: none;
        order: 2;
    }

    .prado-map-wrapper {
        min-height: 400px;
        order: 1;
    }

    .prado-results-list {
        max-height: 300px;
    }

    .prado-result-thumb {
        width: 70px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .prado-sidebar-actions {
        flex-direction: column;
    }

    .prado-sidebar-actions > * {
        width: 100%;
    }

    .prado-geoloc-btn {
        flex: 1;
    }

    .prado-pagination {
        flex-wrap: wrap;
    }
}
