Remove right and bottom margin on infowindows

You need to first remove the infowindow background & shadow, then apply your own css.

JS part

/*
 * The google.maps.event.addListener() event waits for
 * the creation of the infowindow HTML structure 'domready'
 * and before the opening of the infowindow defined styles
 * are applied.
 */
google.maps.event.addListener(infowindow, 'domready', function() {

   // Reference to the DIV which receives the contents of the infowindow using jQuery
   var iwOuter = $('.gm-style-iw');

   /* The DIV we want to change is above the .gm-style-iw DIV.
    * So, we use jQuery and create a iwBackground variable,
    * and took advantage of the existing reference to .gm-style-iw for the previous DIV with .prev().
    */
   var iwBackground = iwOuter.prev();

   // Remove the background shadow DIV
   iwBackground.children(':nth-child(2)').css({'display' : 'none'});

   // Remove the white background DIV
   iwBackground.children(':nth-child(4)').css({'display' : 'none'});

});

CSS part (example)

.gm-style-iw {
   width: 350px !important;
   top: 0 !important;
   left: 0 !important;
   background-color: #fff;
   box-shadow: 0 1px 6px rgba(178, 178, 178, 0.6);
   border: 1px solid rgba(72, 181, 233, 0.6);
   border-radius: 2px 2px 0 0;
}

Source


The padding is caused by the scroll applied to the .gm-style-iw-d div, this would remove it but be careful and make sure all your content fits inside the max width and height of the info window cause otherwise it will be hidden.

.gm-style-iw-d {
    overflow: hidden !important;
}

For those who are still looking for solution. Angular 8, helped the code below to remove the paddings and hide the close button for agm-info-window. Basically, overflow: scroll in .gm-style-iw-d element creates that space.

/* hide close button in info-window */
::ng-deep button.gm-ui-hover-effect {
  visibility: hidden;
}

/* clear the paddings  */
::ng-deep .gm-style .gm-style-iw-c {
  padding: 0;
}

/* remove the white space */
::ng-deep .gm-style-iw .gm-style-iw-d {
  overflow: auto !important;
}