/* Stili per la vista mappa interattiva */

/* Modal della mappa */
.map-modal .modal-dialog {
    max-width: 1100px;
    width: 95vw;
    margin: 2rem auto;
}

.map-modal .modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.map-modal .modal-header {
    background: linear-gradient(135deg, #007bff 60%, #0056b3 100%);
    color: white;
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    padding: 1rem 1.5rem;
}

.map-modal .modal-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.map-modal .modal-body {
    padding: 0;
    position: relative;
}

/* Container della mappa */
#fullMap {
    height: 700px;
    width: 100%;
    border-radius: 0;
}

/* Filtri nella mappa */
.map-filters {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1000;
    background: white;
    border-radius: 8px;
    padding: 0.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    min-width: 200px;
}

.map-filters .form-select {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.9rem;
}

/* Popup personalizzati per i marker - DIMENSIONI RESPONSIVE ALLO ZOOM */
.gym-popup {
    max-width: 200px !important;
    min-width: 200px !important;
    padding: 0;
    border-radius: 8px;
    border: none;
    transition: all 0.3s ease;
}

/* Wrapper del popup molto sottile e moderno */
.leaflet-popup-content-wrapper {
    background: transparent !important;
    border: none !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    padding: 0 !important;
    transition: all 0.3s ease;
}

/* Contenuto del popup senza padding aggiuntivo */
.leaflet-popup-content {
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    transition: all 0.3s ease;
}

/* Rimuovi completamente la freccia del popup */
.leaflet-popup-tip {
    display: none !important;
    background: transparent !important;
}

/* Rimuovi il pulsante di chiusura di Leaflet */
.leaflet-popup-close-button {
    display: none !important;
}

.gym-popup .popup-header {
    background: linear-gradient(135deg, #007bff 60%, #0056b3 100%);
    color: white;
    padding: 0.4rem 0.6rem;
    border-radius: 8px 8px 0 0;
    margin: 0;
}

.gym-popup .popup-title {
    font-weight: 600;
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.1;
}

.gym-popup .popup-body {
    padding: 0.6rem !important;
    background: white;
}

/* Immagine fissa */
.gym-popup .popup-image {
    margin-bottom: 0.4rem;
    height: 120px;
    overflow: hidden;
    border-radius: 6px;
}

.gym-popup .popup-image img,
.gym-popup .popup-image picture {
    width: 100% !important;
    height: 120px !important;
    object-fit: cover !important;
    display: block;
    border-radius: 6px;
    margin: 0;
}

.gym-popup .popup-image picture img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

/* Link dell'immagine cliccabile */
.gym-popup .popup-image-link {
    display: block;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: 6px;
    overflow: hidden;
}

.gym-popup .popup-image-link:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.gym-popup .popup-image-link:active {
    transform: scale(0.98);
}

/* Rating e recensioni */
.gym-popup .popup-rating {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.3rem;
    flex-wrap: wrap;
}

.gym-popup .popup-rating .stars {
    color: #ffc107;
    font-size: 0.75rem;
}

.gym-popup .popup-rating .rating-text {
    color: #6c757d;
    font-size: 0.8rem;
}

/* Indirizzo */
.gym-popup .popup-address {
    color: #6c757d;
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
    line-height: 1.2;
}

/* Città e provincia con pulsante dettagli */
.gym-popup .popup-location-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.3rem;
    width: 100%;
}

.gym-popup .popup-location {
    color: #6c757d;
    font-size: 0.8rem;
    font-style: italic;
    flex: 1;
}

.gym-popup .popup-actions {
    flex-shrink: 0;
    margin-left: auto;
}

.gym-popup .btn-details {
    background: #007bff;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    text-decoration: none;
    transition: background-color 0.2s;
    white-space: nowrap;
    position: static !important;
}

.gym-popup .btn-details:hover {
    background: #0056b3;
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .map-modal .modal-dialog {
        max-width: 95vw;
        width: 95vw;
        margin: 0.5rem auto;
    }
    
    #fullMap {
        height: 500px;
    }
    
    .map-filters {
        position: relative;
        top: auto;
        left: auto;
        margin: 1rem;
        min-width: auto;
    }
    
    .gym-popup {
        max-width: 180px;
        min-width: 180px;
    }
    
    /* Riduci leggermente le dimensioni delle immagini sui popup per mobile */
    .gym-popup .popup-image {
        height: 100px; /* Ridotto ulteriormente */
    }
    
    .gym-popup .popup-image img,
    .gym-popup .popup-image picture {
        height: 100px !important; /* Ridotto ulteriormente */
    }
    
    .gym-popup .popup-image picture img {
        height: 100px; /* Ridotto ulteriormente */
    }
}

/* Animazioni */
.map-modal.fade .modal-dialog {
    transform: scale(0.8);
    transition: transform 0.3s ease-out;
}

.map-modal.show .modal-dialog {
    transform: scale(1);
}

/* Loading state */
.map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 1rem 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1001;
}

.map-loading .spinner-border {
    width: 1.5rem;
    height: 1.5rem;
}

/* Marker della palestra corrente */
.current-gym-marker {
    z-index: 1000 !important;
}

.current-gym-marker div {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Riduci le dimensioni del popup quando lo zoom è basso - NUOVO APPROCCIO */
.leaflet-container .leaflet-popup .gym-popup.leaflet-zoom-out {
    max-width: 140px !important;
    min-width: 140px !important;
}

.leaflet-container .leaflet-popup .gym-popup.leaflet-zoom-out .popup-image {
    height: 70px !important;
}

.leaflet-container .leaflet-popup .gym-popup.leaflet-zoom-out .popup-image img,
.leaflet-container .leaflet-popup .gym-popup.leaflet-zoom-out .popup-image picture {
    height: 70px !important;
}

.leaflet-container .leaflet-popup .gym-popup.leaflet-zoom-out .popup-title {
    font-size: 0.7rem !important;
}

.leaflet-container .leaflet-popup .gym-popup.leaflet-zoom-out .popup-body {
    padding: 0.3rem !important;
}

.leaflet-container .leaflet-popup .gym-popup.leaflet-zoom-low {
    max-width: 170px !important;
    min-width: 170px !important;
}

.leaflet-container .leaflet-popup .gym-popup.leaflet-zoom-low .popup-image {
    height: 85px !important;
}

.leaflet-container .leaflet-popup .gym-popup.leaflet-zoom-low .popup-image img,
.leaflet-container .leaflet-popup .gym-popup.leaflet-zoom-low .popup-image picture {
    height: 85px !important;
}

.leaflet-container .leaflet-popup .gym-popup.leaflet-zoom-low .popup-title {
    font-size: 0.8rem !important;
}

.leaflet-container .leaflet-popup .gym-popup.leaflet-zoom-low .popup-body {
    padding: 0.5rem !important;
}

.leaflet-container .leaflet-popup .gym-popup.leaflet-zoom-normal {
    max-width: 200px !important;
    min-width: 200px !important;
} 