

.cml-map-wrapper {
    position: relative;
    width: 100%;
}

.cml-map {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
}

/* Sidebar */
.cml-sidebar {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 400px;
    height: 100%;
    background: #ffffff;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.15);
    z-index: 999;
    display: flex;
    flex-direction: column;

    /* nascosta di default */
    opacity: 0;
    pointer-events: none;
    transform: translateX(20px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.cml-sidebar-active {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}


.cml-sidebar-close {
    align-self: flex-end;
    background: transparent;
    border: none;
    font-size: 24px;
    line-height: 1;
    padding: 10px 14px;
    cursor: pointer;
}

.cml-sidebar-inner {
    padding: 10px 18px 18px 18px;
    overflow-y: auto;
    flex: 1;
}

.cml-sidebar-image img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    margin-bottom: 12px;
    display: block;
}

.cml-sidebar-title {
    margin: 0 0 10px;
    font-size: 20px;
}

.cml-sidebar-desc {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 15px;
}

.cml-sidebar-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cml-btn {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cml-btn-primary {
    background: #9A8555!important;
    color: #ffffff!important;
}

.cml-btn-primary:hover {
    background: #9A8555!important;
    color: #ffffff!important;
}

.cml-btn-secondary {
    background: #f3f4f6;
    color: #111827;
}

.cml-btn-secondary:hover {
    background: #e5e7eb;
    color: #111827;
}

/* Responsive */
@media (max-width: 768px) {
    .cml-sidebar {
        max-width: 100%;
    }
}

/* Marker Font Awesome */
.cml-fa-marker-wrapper {
    background: transparent !important;
    border: none !important;
}

.cml-fa-marker {
    display: flex;
    align-items: center;
    justify-content: center;
}

.cml-fa-marker i {
    font-size: 32px;
    line-height: 40px;
    text-shadow: 0 0 4px rgba(0,0,0,0.4);
}

/* Marker attivo: ingrandito + animazione */
.leaflet-marker-icon.cml-marker-active .cml-fa-marker i {
    animation: cml-marker-bounce 0.9s infinite;
    transform: scale(1.3);
}

@keyframes cml-marker-bounce {
    0%, 100% {
        transform: translateY(0) scale(1.3);
    }
    50% {
        transform: translateY(-6px) scale(1.4);
    }
}

/* --- MOBILE: Sidebar interna alla mappa --- */
@media (max-width: 768px) {

    /* Il wrapper mappa deve permettere posizionamento assoluto interno */
    .cml-map-wrapper {
        position: relative;
        overflow: hidden; /* Importante */
    }

    .cml-sidebar {
        position: absolute;
        left: 3%;
        right: 0;
        top:40%;

        /* Fissa in basso DENTRO la mappa */
        bottom: 0;

        width: 94%;
        max-width: 100%;
        height: 60%;        /* COPRE SOLO LA PARTE BASSA */

        background: #ffffff;
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
        box-shadow: 0 -4px 18px rgba(0,0,0,0.18);

        /* invisibile di default */
        opacity: 0;
        pointer-events: none;
        transform: translateY(20px);
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    .cml-sidebar-active {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    .cml-sidebar-inner {
        height: calc(60% - 50px); /* scorrimento interno */
        overflow-y: auto;
        padding: 15px;
    }

    .cml-sidebar-close {
        font-size: 22px;
        padding: 10px 15px;
    }

    .cml-sidebar-image img {
        border-radius: 12px;
        max-height: 180px;
        object-fit: cover;
        width: 100%;
    }
}

/* Mobile: quando la sidebar è attiva, solleva l'attribuzione */
@media (max-width: 768px) {

    .cml-map-wrapper.sidebar-open .leaflet-control-attribution {
        margin-bottom: 60vh !important; /* stessa altezza della sidebar */
    }
}



