/* Map search page styles. Status colours are tokens in custom.css. */

/* Map height */
#map {
	height: 100%;
}

.gm-style-iw {
	padding: 0;
	margin: 0;
	top: 0;
	left: 0;
}

/* Price bubbles: one shape in four status colours */
.popup-bubble-open {
	--gamls-bubble-color: var(--gamls-map-status-active);
	color: var(--gamls-on-map-status-active);
}

.popup-bubble-coming-soon {
	--gamls-bubble-color: var(--gamls-map-status-coming-soon);
	color: var(--gamls-on-map-status-coming-soon);
}

.popup-bubble-pending {
	--gamls-bubble-color: var(--gamls-map-status-pending);
	color: var(--gamls-on-map-status-pending);
}

.popup-bubble-closed {
	--gamls-bubble-color: var(--gamls-map-status-closed);
	color: var(--gamls-on-map-status-closed);
}

.popup-bubble-open,
.popup-bubble-coming-soon,
.popup-bubble-pending,
.popup-bubble-closed {
	/* The tail: base width, height, position (0% left, 100% right), and the corner radius */
	--gamls-bubble-base: .8em;
	--gamls-bubble-height: 1em;
	--gamls-bubble-tip: 50%;
	--gamls-bubble-radius: .6em;

	/* Centred above the marker */
	position: absolute;
	top: 0;
	left: 0;
	transform: translate(-50%, -150%);

	font-family: sans-serif;
	overflow-y: auto;
	max-height: 60px;
	box-shadow: 0 2px 10px 1px var(--gamls-shadow-color);
	padding: .2em .5em;
	border-radius: var(--gamls-bubble-radius) var(--gamls-bubble-radius) min(var(--gamls-bubble-radius),100% - var(--gamls-bubble-tip) - var(--gamls-bubble-base)/2) min(var(--gamls-bubble-radius),var(--gamls-bubble-tip) - var(--gamls-bubble-base)/2)/var(--gamls-bubble-radius);
	clip-path: polygon(0 100%,0 0,100% 0,100% 100%,
	min(100%,var(--gamls-bubble-tip) + var(--gamls-bubble-base)/2) 100%,
	var(--gamls-bubble-tip) calc(100% + var(--gamls-bubble-height)),
	max(0%  ,var(--gamls-bubble-tip) - var(--gamls-bubble-base)/2) 100%);
	background: var(--gamls-bubble-color);
	border-image: conic-gradient(var(--gamls-bubble-color) 0 0) fill 0/
	var(--gamls-bubble-radius) calc(100% - var(--gamls-bubble-tip) - var(--gamls-bubble-base)/2) 0 calc(var(--gamls-bubble-tip) - var(--gamls-bubble-base)/2)/
	0 0 var(--gamls-bubble-height) 0;
}

/* Bubble hover: grows in place; wins the transform by order */
.marker-hover {
	transform: translate(-50%, -150%) scale(1.3);
}

/* Info window buttons: Close and View */
.btn.btn-infowindow {
	padding: 1px;
	margin: .2rem;
	width: 60px;
}

	#map .gm-style img {
		max-width: 100%;
	}

	/* Info window layering */
	body .gm-style-iw-c { z-index:1; } body .gm-style-iw-tc { z-index:2; }

	/* Cluster markers */
	.cluster-marker {
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 50%;
		color: var(--gamls-on-map-cluster);
		font-weight: 700;
		font-size: 0.875rem;
		cursor: pointer;
		background-color: color-mix(in srgb, var(--gamls-cluster-base) 85%, transparent);
		transition: transform 0.2s ease;
	}

	/* Cluster markers: bucket colours */
	.cluster-marker-1 { --gamls-cluster-base: var(--gamls-map-cluster-1); color: var(--gamls-on-map-cluster-1); }
	.cluster-marker-2 { --gamls-cluster-base: var(--gamls-map-cluster-2); }
	.cluster-marker-3 { --gamls-cluster-base: var(--gamls-map-cluster-3); }
	.cluster-marker-4 { --gamls-cluster-base: var(--gamls-map-cluster-4); }
	.cluster-marker-5 { --gamls-cluster-base: var(--gamls-map-cluster-5); }
	.cluster-marker:hover { transform: scale(1.1); }

/* Info window overflow: !important is needed to beat Google's own CSS */
.gm-style-iw, 
.gm-style-iw > div {
  overflow: visible !important;
  z-index: 1000; /* Ensure above map elements */
}

/* Selected listing: the card and its pin, marked as a pair */
.listing-card-selected .card {
	--bs-card-bg: var(--gamls-blue-pale);
	border-color: var(--gamls-gold-dark);
	box-shadow: 0 0 0 3px var(--gamls-gold-dark);
}

.listing-card-selectable:focus-visible {
	outline: 3px solid var(--gamls-gold-dark);
	outline-offset: 2px;
}

/* Selected listing: the pin at twice the size */
.marker-selected {
	--gamls-bubble-color: var(--gamls-gold-dark);
	color: var(--gamls-on-gold-dark);
	transform: translate(-50%, -150%) scale(2);
}
