.mappa-porto-torres-container {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 600px;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.mappa-sidebar {
    width: 300px;
    background: #f8f9fa;
    padding: 24px;
    border-right: 1px solid #edf2f7;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Custom Scrollbar */
.mappa-sidebar::-webkit-scrollbar {
    width: 6px;
}

.mappa-sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.mappa-sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 10px;
}

.mappa-sidebar::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

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

.mappa-sidebar-header h3 {
    margin: 0 !important;
}

.mappa-reset-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a5568' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M23 4v6h-6'%3E%3C/path%3E%3Cpath d='M20.49 15a9 9 0 1 1-2.12-9.36L23 10'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.mappa-reset-btn:hover {
    background-color: #f7fafc;
    border-color: #cbd5e0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.mappa-controls {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mappa-controls li {
    margin-bottom: 12px;
    transition: transform 0.2s ease;
}

.mappa-sub-controls {
    list-style: none;
    padding: 10px 0 5px 20px;
    margin: 0;
    display: none; /* Chiusi di default all'apertura */
}

.mappa-sub-controls li {
    margin-bottom: 8px;
    transform: none !important;
    position: relative;
    display: flex;
    align-items: center;
}

.zone-zoom {
    width: 24px;
    height: 24px;
    margin-left: 8px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a0aec0' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 16px;
    transition: all 0.2s ease;
    border-radius: 4px;
    flex-shrink: 0;
}

.zone-zoom:hover {
    background-color: #edf2f7;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233182ce' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
}

.mappa-sub-controls label {
    padding: 8px 12px 8px 35px;
    font-size: 13px;
    background: #fdfdfd;
}

.mappa-sub-controls .custom-checkbox {
    left: 10px;
    height: 16px;
    width: 16px;
}

.mappa-controls li:hover {
    transform: translateX(4px);
}

.mappa-controls label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 15px;
    color: #4a5568;
    background: #ffffff;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.layer-header {
    display: flex;
    align-items: center;
    position: relative;
}

.mappa-expand-icon {
    position: absolute;
    right: 15px;
    cursor: pointer;
    color: #4a5568;
    transition: transform 0.3s ease;
    width: 30px;
    height: 30px;
    z-index: 10;
    display: none; /* Nascosta di default */
    align-items: center;
    justify-content: center;
}

.mappa-expand-icon::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    margin-bottom: 4px;
}

.mappa-expand-icon.active {
    transform: rotate(-180deg);
}

.mappa-expand-icon:hover {
    color: #4a5568;
}

.mappa-controls label:hover {
    border-color: #cbd5e0;
    background: #fdfdfd;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.mappa-controls input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* Custom Checkbox Style */
.mappa-controls label {
    position: relative;
    padding-left: 50px;
}

.mappa-controls .custom-checkbox {
    position: absolute;
    left: 12px;
    height: 20px;
    width: 20px;
    background-color: #edf2f7;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.mappa-controls input:checked ~ .custom-checkbox {
    background-color: #3182ce;
}

.mappa-controls .custom-checkbox:after {
    content: "";
    position: absolute;
    display: none;
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.mappa-controls input:checked ~ .custom-checkbox:after {
    display: block;
}

.layer-color-box {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 12px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}

.mappa-google-canvas {
    flex-grow: 1;
    height: 100%;
}

.mappa-popup-content {
    padding: 5px;
    font-size: 14px;
    color: #2d3748;
    max-width: 200px;
    line-height: 1.4;
}

@media (max-width: 768px) {
    .mappa-porto-torres-container {
        flex-direction: column;
        height: auto !important;
        position: relative;
        overflow: visible;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        border-radius: 0 !important;
    }

    .mappa-google-canvas {
        height: 400px !important;
        width: 100%;
        order: 1;
    }

    .mappa-sidebar-toggle {
        display: none !important;
    }

    .mappa-sidebar {
        position: relative;
        width: 100% !important;
        height: auto;
        max-height: none;
        z-index: 10;
        transform: none;
        background: #ffffff;
        padding: 20px;
        border-radius: 0;
        box-shadow: none;
        border-top: 1px solid #edf2f7;
        overflow: visible;
        display: flex;
        flex-direction: column;
        order: 2;
        box-sizing: border-box;
    }

    .mappa-sidebar-header {
        position: absolute;
        top: -60px;
        right: 15px;
        margin: 0;
        display: flex;
        align-items: center;
        z-index: 1001;
    }

    .mappa-sidebar-header h3 {
        display: block;
        font-size: 18px;
        margin-bottom: 15px !important;
        color: #2d3748;
    }
    
    /* On mobile, we want the title back inside the sidebar if it's below the map */
    .mappa-sidebar-header {
        position: static;
        top: auto;
        right: auto;
        justify-content: space-between;
        margin-bottom: 20px;
        pointer-events: auto;
    }

    .mappa-reset-btn {
        width: 40px;
        height: 40px;
        background-color: #ffffff;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        border: 1px solid #e2e8f0;
        background-size: 18px;
    }

    .mappa-controls {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px;
        overflow: visible;
        padding: 0;
    }

    .mappa-controls li {
        width: 100%;
    }

    .mappa-controls label {
        padding: 12px 16px 12px 50px !important;
        font-size: 15px !important;
        border-radius: 10px !important;
        background: #ffffff !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.02) !important;
        border: 1px solid #e2e8f0 !important;
        width: 100% !important;
        white-space: normal;
    }

    .mappa-controls .custom-checkbox {
        left: 12px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }

    .mappa-expand-icon {
        display: flex !important;
    }
    
    .mappa-sub-controls {
        display: none; /* Keep them toggleable */
        padding: 10px 0 10px 20px;
    }
    
    .mappa-sub-controls li {
        display: flex;
        align-items: center;
        margin-bottom: 8px;
    }
}
