/* ========================================================= */
/* 1. STILI BASE & MAPPA */
/* ========================================================= */
body, html {
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, sans-serif;
    height: 100%;
    overflow: hidden;
    background-color: #f4f4f4;
    color: #333;
}

#map {
    width: 100vw;
    height: 100vh;
    z-index: 1;
}

/* ========================================================= */
/* 2. STILI FILTRI (Menu Principale) */
/* ========================================================= */
#filters-container {
    position: fixed;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    gap: 10px;
    padding: 12px 18px;
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
    max-width: 95%;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

#filters-container::-webkit-scrollbar {
    display: none;
}

.filter-button {
    padding: 10px 18px;
    margin: 0;
    border: none;
    background-color: #e9ecef;
    color: #343a40;
    cursor: pointer;
    border-radius: 20px;
    white-space: nowrap;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.filter-button:hover {
    background-color: #dee2e6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filter-button:active {
    transform: scale(0.98);
    box-shadow: none;
}

.filter-button.active {
    background-color: #006994;          /* Blu mare Sicilia */
    color: white;
    box-shadow: 0 3px 8px rgba(0, 105, 148, 0.4);
}

/* ========================================================= */
/* 3. STILI PULSANTE CENTRA MAPPA */
/* ========================================================= */
#centerMapButton {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 100;
    width: 52px;
    height: 52px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: all 0.25s ease-out;
}

#centerMapButton:hover {
    background-color: #f8f8f8;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25);
    transform: scale(1.05);
}

/* ========================================================= */
/* 3.bis STILI CLUSTER MARKER (raggruppamento POI vicini) */
/* ========================================================= */
.marker-cluster {
    background-color: rgba(0, 105, 148, 0.25); /* alone esterno blu mare trasparente */
}

.marker-cluster div {
    background-color: #006994; /* nucleo blu mare Sicilia, coerente col brand */
    color: #ffffff;
    font-weight: 700;
    font-family: 'Inter', system-ui, sans-serif;
}

.marker-cluster span {
    color: #ffffff;
}

/* ========================================================= */
/* 4. STILI MODALE & DETTAGLI */
/* ========================================================= */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.visible {
    display: flex;
    opacity: 1;
}

@keyframes fadeIn {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-content {
    background: #fff;
    border-radius: 20px;
    max-width: 750px;
    width: 90%;
    padding: 30px;
    position: relative;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
    max-height: 90vh;
    animation: fadeIn 0.4s ease-out forwards;
}

.close-button {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 28px;
    cursor: pointer;
    color: #777;
    background: none;
    border: none;
    line-height: 1;
    transition: color 0.2s ease, transform 0.2s;
}

.close-button:hover,
.close-button:focus {
    color: #006994;
    transform: rotate(90deg);
    outline: none;
}

.modal-content h2 {
    margin-top: 0;
    font-size: 2rem;
    color: #006994;                 /* Colore primario coerente */
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

#modalImage {
    width: 100%;
    max-height: 300px;
    border-radius: 16px;
    margin-bottom: 20px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.modal-details p {
    margin: 8px 0;
    font-size: 1rem;
    line-height: 1.5;
    color: #444;
}

/* Link cliccabili generati automaticamente dentro le descrizioni
   (es. link di prenotazione tipo quello di "Al Velico") */
.description-link {
    color: #006994;
    font-weight: 600;
    text-decoration: underline;
    word-break: break-word;
}

.description-link:hover,
.description-link:focus {
    color: #00475f;
    text-decoration: none;
}

.directions-button {
    display: block;
    text-align: center;
    padding: 12px;
    margin: 25px 0 15px 0;
    background-color: #006994;
    color: white;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.directions-button:hover {
    background-color: #005a7f;
    box-shadow: 0 4px 8px rgba(0, 105, 148, 0.4);
}

/* ========================================================= */
/* 5. STILI AUDIO PLAYER */
/* ========================================================= */
.audio-player {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 12px;
    padding: 12px 20px;
    background-color: #343a40;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.player-button {
    font-size: 1.4rem;
    cursor: pointer;
    background: #006994;
    border: none;
    color: #fff;
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.player-button:hover {
    background: #005a7f;
    transform: scale(1.05);
}

.progress-container {
    flex-grow: 1;
    background: #555;
    height: 8px;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
}

.progress-bar {
    background: #006994;
    height: 100%;
    width: 0;
    border-radius: 4px;
    position: absolute;
    top: 0;
    left: 0;
    transition: width 0.1s linear;
}

.seek-slider {
    width: 100%;
    -webkit-appearance: none;
    background: transparent;
    cursor: pointer;
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    height: 8px;
}

.seek-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #fff;
    border: 2px solid #006994;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0,0,0,0.4);
    margin-top: -4px;
}

.time-display {
    font-size: 0.95rem;
    color: #ffffff;
    white-space: nowrap;
    flex-shrink: 0;
}

.volume-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    justify-content: flex-end;
    color: #fff;
}

.volume-slider {
    width: 90px;
    -webkit-appearance: none;
    height: 6px;
    background: #555;
    outline: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #006994;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 3px rgba(0,0,0,0.5);
}

/* ========================================================= */
/* 6. MEDIA QUERIES (Mobile First) */
/* ========================================================= */
@media (max-width: 650px) {
    #filters-container {
        top: auto;
        bottom: 10px;
        left: 20px;
        right: 20px;
        width: auto;
        max-width: none;
        transform: translateX(0);
        padding: 8px 10px;
    }
    
    #centerMapButton {
        top: 70px;
        right: 15px;
        width: 44px;
        height: 44px;
    }

    .modal-content {
        padding: 20px;
    }
    
    .modal-content h2 {
        font-size: 1.5rem;
    }
    
    .audio-player {
        padding: 10px 15px;
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .volume-container {
        width: 100%;
        justify-content: flex-start;
        order: 3;
    }

    .volume-slider {
        width: 100%;
    }
}