/* Pigeon Express for WooCommerce - customer checkout picker.
 * Scoped under .pe-wc- to avoid clashes with theme styles. */

.pe-wc-location-picker {
	display: block;
	margin: 10px 0 6px;
	padding: 12px 14px;
	border: 1px solid #d6d8db;
	border-radius: 6px;
	background: #fafbfc;
	/* The panel brings its own light background, so it must bring its own text
	 * colour and alignment too. Inherited, a dark theme paints white text on
	 * it and the shipping cell right-aligns every line. */
	color: #1d2327;
	text-align: left;
	text-indent: 0;
	font-size: 14px;
	line-height: 1.4;
	position: relative;
	box-sizing: border-box;
	max-width: 100%;
}

/* The picker toggles its parts with the `hidden` attribute. Any `display`
 * rule on those parts, ours included, outranks the browser's own
 * `[hidden]` style, so restate it with enough weight to always win. */
.pe-wc-location-picker [hidden] {
	display: none !important;
}

.pe-wc-location-picker__label {
	display: block;
	font-weight: 600;
	margin: 0 0 6px;
	color: #1d2327;
}
/* Themes commonly restyle every checkout label with a heavier selector. */
.pe-wc-location-picker .pe-wc-location-picker__label {
	display: block !important;
	color: #1d2327 !important;
}

.pe-wc-location-picker__input {
	box-sizing: border-box;
	width: 100%;
	padding: 8px 10px;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	background: #fff;
	color: #1d2327;
	font: inherit;
	display: block;
	max-width: 100%;
}
/* WooCommerce's `#shipping_method li input` rule is meant for the method
 * radios, but it matches this text field too and nudges it sideways. */
.pe-wc-location-picker .pe-wc-location-picker__input {
	margin: 0 !important;
	padding: 8px 10px !important;
	width: 100% !important;
}
.pe-wc-location-picker__input:focus {
	border-color: #2271b1;
	outline: 2px solid #2271b1;
	outline-offset: 0;
}

.pe-wc-location-picker__suggestions {
	list-style: none;
	margin: 4px 0 0;
	padding: 0;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	max-height: 280px;
	overflow-y: auto;
	background: #fff;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}
.pe-wc-location-picker__suggestions li {
	margin: 0;
	padding: 8px 10px;
	cursor: pointer;
	border-bottom: 1px solid #f0f0f1;
}
/* The picker sits inside WooCommerce's shipping method list, whose
 * `#shipping_method li` rule (hanging indent, extra padding) also matches
 * these rows and outranks a class selector. Themes style nested lists in
 * that cell the same way. */
.pe-wc-location-picker .pe-wc-location-picker__suggestions {
	margin: 4px 0 0 !important;
	padding: 0 !important;
	list-style: none !important;
}
.pe-wc-location-picker .pe-wc-location-picker__suggestions li {
	margin: 0 !important;
	padding: 8px 10px !important;
	text-indent: 0 !important;
	line-height: 1.4 !important;
	text-align: left !important;
}
.pe-wc-location-picker__suggestions li:last-child {
	border-bottom: 0;
}
.pe-wc-location-picker__suggestions li[aria-selected="true"],
.pe-wc-location-picker__suggestions li:hover {
	background: #f0f6fc;
}
.pe-wc-location-picker__suggestions .pe-wc-suggestion-name {
	display: block;
	font-weight: 600;
	color: #1d2327;
}
.pe-wc-location-picker__suggestions .pe-wc-suggestion-meta {
	display: block;
	color: #50575e;
	font-size: 12px;
}

.pe-wc-location-picker__empty {
	margin: 6px 0 0;
	color: #82141a;
	font-size: 13px;
}

.pe-wc-location-picker__selected {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}
.pe-wc-location-picker__selected-name {
	color: #1b5e20;
}
.pe-wc-location-picker__selected-meta {
	color: #50575e;
}
.pe-wc-location-picker__selected-hours {
	flex-basis: 100%;
	color: #50575e;
	font-size: 13px;
}
.pe-wc-location-picker__selected-hours[hidden] {
	display: none;
}
.pe-wc-location-picker__change {
	margin-left: auto;
	border: 1px solid #c3c4c7;
	background: #fff;
	padding: 4px 10px;
	border-radius: 4px;
	cursor: pointer;
	color: #1d2327;
	font: inherit;
}
.pe-wc-location-picker__change:hover {
	background: #f0f6fc;
	border-color: #2271b1;
}

/* The nearest locations at the top of the list (when "Nearest office" is
 * on): the distance on the right of the name, and a thin line between them
 * and the rest of the list. */
.pe-wc-location-picker__suggestions .pe-wc-suggestion-top {
	display: flex;
	align-items: baseline;
	gap: 8px;
}
.pe-wc-location-picker__suggestions .pe-wc-suggestion-top .pe-wc-suggestion-name {
	flex: 1 1 auto;
	min-width: 0;
}
.pe-wc-location-picker__distance {
	flex: 0 0 auto;
	color: #1b5e20;
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
}
.pe-wc-location-picker__suggestions li.is-nearest {
	position: relative;
}
.pe-wc-location-picker .pe-wc-location-picker__suggestions li.is-nearest-last {
	border-bottom: 2px solid #dcdcde;
}
/* Read out, not shown. */
.pe-wc-location-picker .pe-wc-sr-only {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	margin: -1px !important;
	padding: 0 !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

/* "Choose on the map" (when the map is on), under the search field. */
.pe-wc-location-picker .pe-wc-location-picker__map-button {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 8px 0 0;
	padding: 6px 12px;
	border: 1px solid #2271b1;
	border-radius: 4px;
	background: #fff;
	color: #2271b1;
	font: inherit;
	font-weight: 600;
	line-height: 1.4;
	text-transform: none;
	letter-spacing: normal;
	box-shadow: none;
	cursor: pointer;
}
.pe-wc-location-picker .pe-wc-location-picker__map-button:hover,
.pe-wc-location-picker .pe-wc-location-picker__map-button:focus {
	background: #f0f6fc;
	color: #135e96;
}
.pe-wc-location-picker .pe-wc-location-picker__map-button[aria-busy="true"] {
	cursor: progress;
	opacity: 0.7;
}
.pe-wc-location-picker__map-error {
	margin: 6px 0 0;
	color: #82141a;
	font-size: 13px;
}

/* Hide the WC billing/shipping address rows while a Pigeon Express office or
 * locker is the active delivery target. Applied to the row, not the input, so
 * the row's label and required-asterisk also disappear. */
.pe-wc-address-fields-hidden {
	display: none !important;
}

/* Address fields: the picker panel with its fields laid out in rows, as on
 * the carrier's other shop modules. Only the grid is new; every field reuses
 * the picker's label, input and suggestion styles. */
.pe-wc-address-box__row {
	display: grid;
	grid-template-columns: 2fr 1fr;
	gap: 10px 12px;
	margin: 0 0 10px;
}
.pe-wc-address-box__row--even {
	grid-template-columns: 1fr 1fr;
}
.pe-wc-address-box__field {
	min-width: 0;
}
.pe-wc-address-box .pe-wc-location-picker__input[readonly] {
	background: #f0f0f1;
}
@media (max-width: 480px) {
	.pe-wc-address-box__row--even {
		grid-template-columns: 1fr;
	}
	.pe-wc-address-box__row:not(.pe-wc-address-box__row--even) .pe-wc-address-box__field--wide {
		grid-column: 1 / -1;
	}
}

/* The cash on delivery fee after the name of a payment method. */
.pe-wc-cod-fee {
	white-space: nowrap;
}
