#gf-field-map-wrapper {
	position: relative;
}
#gf-field-map,
#gf-field-map-modal {
	height: min(480px, 50vh);
	width: 100%;

	.mapbox-gl-draw_ctrl-draw-btn,
	.mapboxgl-ctrl-attrib-button {
		background-color: unset;
	}
}

#gf-field-map {
	border-radius: var(--gf-radius, 3px);
}

/* Panel over the map. Fields, labels and buttons take their look from the
   Gravity Forms theme; these rules only handle the panel and spacing. */
#gf-field-map-modal {
	position: absolute;
	top: 0;
	z-index: 2;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	background-color: var(--gf-ctrl-bg-color, #fff);
	border-width: 1px;
	border-style: solid;
	border-color: var(--gf-color-out-ctrl-light, rgba(17, 35, 55, 0.1));
	border-radius: var(--gf-radius, 3px);
	box-shadow: var(--gf-ctrl-shadow, 0 1px 4px rgba(18, 25, 97, 0.08));

	#gf-field-map-modal-close {
		position: absolute;
		top: 8px;
		right: 8px;
		font-size: 24px;
		line-height: 1;
		/* The theme's semi-transparent gray falls just short of 3:1 contrast. */
		color: var(--gf-color-out-ctrl-dark, #585e6a);

		&:hover,
		&:focus {
			color: var(--gf-ctrl-label-color-primary, #112337);
		}
	}

	/* Positioned so the close button scrolls with the content instead of
	   sitting over it. */
	.gf-field-map-modal-body {
		position: relative;
		flex-grow: 1;
		min-height: 0;
		overflow-y: auto;
		padding: 24px;
	}

	fieldset + fieldset {
		margin-top: 24px;
	}

	/* "Other" sits on one row: checkbox, label, then its text input. */
	.gf-field-map-other-choice {
		grid-template-columns:
			minmax(var(--gf-ctrl-choice-size, 20px), max-content)
			max-content
			minmax(0, var(--gf-field-choice-other-ctrl-max-width, 256px));
		align-items: center;

		/* A shorter input with negative margins keeps this row the same height as
		   the other choices, so the gaps between checkboxes stay even. */
		input[type="text"] {
			width: 100%;
			height: 28px;
			line-height: 28px;
			margin-top: -4px;
			margin-bottom: -4px;
			margin-left: var(--gf-field-choice-gap, 12px);
		}
	}

	.gf-field-map-question + .gf-field-map-question {
		margin-top: 16px;
	}

	/* Stays below the scrolling body so the buttons are always in view. */
	.gf-field-map-modal-footer {
		display: flex;
		flex-shrink: 0;
		flex-wrap: wrap;
		gap: var(--gf-form-footer-gap, 8px);
		padding-top: 16px;
		padding-right: 24px;
		padding-bottom: 16px;
		padding-left: 24px;
		border-top-width: 1px;
		border-top-style: solid;
		border-top-color: var(--gf-color-out-ctrl-light, rgba(17, 35, 55, 0.1));
	}

	/* Delete sits on the left, in the theme's error color; Cancel and Save on the right. */
	#gf-field-map-modal-delete {
		color: var(--gf-color-danger, #c02b0a);
	}

	#gf-field-map-modal-cancel {
		margin-left: auto;
	}

	&.hidden,
	.hidden {
		display: none;
	}
}
