/* By Homefeed Places — picker dialog, selected row, and feed card location.
   Uses the theme's --feed-* tokens with safe fallbacks; logical properties
   keep RTL and LTR both correct. */

/* ---- Picker dialog / bottom sheet -------------------------------------- */

.byhfp-picker { position: fixed; inset: 0; z-index: 1200; }
.byhfp-picker[hidden] { display: none; }

.byhfp-picker__scrim {
	position: absolute;
	inset: 0;
	background: var(--scrim, rgba(11, 59, 46, 0.34));
}

.byhfp-picker__dialog {
	position: absolute;
	inset-inline-start: 50%;
	inset-block-start: 14vh;
	transform: translateX(-50%);
	inline-size: min(480px, calc(100vw - 32px));
	max-block-size: 70vh;
	display: flex;
	flex-direction: column;
	border: 1px solid var(--feed-line, #e8e7e3);
	border-radius: 20px;
	background: var(--feed-surface, #fefefd);
	box-shadow: var(--shadow-menu, 0 16px 44px -20px rgba(11, 59, 46, 0.28));
	overflow: hidden;
}

[dir="rtl"] .byhfp-picker__dialog { transform: translateX(50%); }

.byhfp-picker__head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 18px;
	border-block-end: 1px solid var(--feed-soft-line, #f2f1ed);
}
.byhfp-picker__head strong { font-size: 15.5px; color: var(--feed-text, rgba(0, 0, 0, .9)); }

.byhfp-picker__back {
	display: grid;
	place-items: center;
	inline-size: 36px;
	block-size: 36px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #5f5e58;
	cursor: pointer;
}
.byhfp-picker__back:hover { background: var(--feed-tint, #f5f4f1); color: #0e0e10; }

/* No green outlines anywhere in the location UI. The theme's global
   :focus-visible ring and --focus-ring are both accent (lime) coloured, which
   read as a green box around the search field while typing; these override
   them with a neutral ring that still marks keyboard focus clearly. */
.byhfp-picker :focus-visible,
.byhfp-selected :focus-visible { outline: none; }

.byhfp-picker__back:focus-visible,
.byhfp-result:focus-visible,
.byhfp-selected__actions button:focus-visible,
.byhfp-selected__map-close:focus-visible {
	outline: none;
	box-shadow: 0 0 0 2px rgba(14, 14, 16, 0.16);
}

.byhfp-picker__search {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 14px 18px 0;
	padding-inline: 12px;
	border: 1px solid var(--feed-line, #e8e7e3);
	border-radius: 12px;
	background: var(--feed-tint, #f5f4f1);
	color: var(--feed-muted, rgba(0, 0, 0, .6));
}
.byhfp-picker__search input {
	flex: 1;
	min-inline-size: 0;
	padding-block: 11px;
	border: 0;
	outline: 0;
	background: transparent;
	color: var(--feed-text, rgba(0, 0, 0, .9));
	font: inherit;
	font-size: 15px;
}
/* Typing must never draw a coloured box: no outline, no ring, and a neutral
   focus border on the wrapper instead of the previous green one. */
.byhfp-picker__search input:focus,
.byhfp-picker__search input:focus-visible {
	outline: none;
	box-shadow: none;
}
.byhfp-picker__search:focus-within { border-color: #c9c8c3; background: var(--feed-surface, #fefefd); }

.byhfp-picker__status {
	min-block-size: 18px;
	margin: 8px 18px 0;
	color: var(--feed-muted, rgba(0, 0, 0, .6));
	font-size: 13px;
}

/* Group label above the list — currently only used for the recents group. */
.byhfp-picker__section {
	margin: 10px 18px 0;
	color: var(--feed-text, rgba(0, 0, 0, .9));
	font-size: 12.5px;
	font-weight: 700;
}
.byhfp-picker__section[hidden] { display: none; }

.byhfp-picker__results {
	flex: 1;
	overflow-y: auto;
	list-style: none;
	margin: 8px 0 0;
	padding: 0 10px 12px;
}
.byhfp-picker__results:empty { padding-block-end: 4px; }

.byhfp-result {
	display: grid;
	gap: 2px;
	inline-size: 100%;
	padding: 10px 12px;
	border: 0;
	border-radius: 12px;
	background: transparent;
	text-align: start;
	cursor: pointer;
	font: inherit;
}
.byhfp-result strong {
	font-size: 14.5px;
	color: var(--feed-text, rgba(0, 0, 0, .9));
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.byhfp-result span {
	font-size: 12.5px;
	color: var(--feed-muted, rgba(0, 0, 0, .6));
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.byhfp-result:hover,
.byhfp-picker__results li.is-active .byhfp-result { background: var(--feed-tint, #f5f4f1); }

/* Recents: the same rows, marked with a pin so they read as "been there"
   rather than as search matches. */
.byhfp-result--recent {
	display: grid;
	grid-template-columns: auto 1fr;
	column-gap: 10px;
	align-items: center;
}
.byhfp-result--recent::before {
	content: "\f230"; /* dashicons-location */
	grid-row: 1 / span 2;
	font-family: dashicons;
	font-size: 18px;
	line-height: 1;
	color: #d84b4b;
}
.byhfp-result--recent strong,
.byhfp-result--recent span { grid-column: 2; }

.byhfp-result__badge {
	display: inline-block;
	inline-size: fit-content;
	margin-block-start: 2px;
	padding: 1px 8px;
	border-radius: 999px;
	background: var(--accent-tint, #eef9d2);
	color: var(--accent, #567307);
	font-size: 11px;
	font-weight: 600;
	white-space: nowrap;
}

body.byhfp-picker-open { overflow: hidden; }

/* Check-in entry color in the "add to your post" menu (theme palette style). */
.feed-more-icon--place { background: #d84b4b; }

/* ---- Selected place card in the composer -------------------------------- */

/* Map preview on top (when available), place row underneath — the composer's
   location reads as a card, not a text line. */
.byhfp-selected {
	margin-block-end: 12px;
	border: 1px solid var(--feed-line, #e8e7e3);
	border-radius: 14px;
	background: var(--feed-surface, #fefefd);
	overflow: hidden;
}
.byhfp-selected[hidden] { display: none; }

.byhfp-selected__map {
	position: relative;
	block-size: 190px;
	background: var(--feed-tint, #f5f4f1);
}
.byhfp-selected__map[hidden] { display: none; }
.byhfp-selected__map iframe {
	display: block;
	inline-size: 100%;
	block-size: 100%;
	border: 0;
}

.byhfp-selected__map-close {
	position: absolute;
	inset-block-start: 10px;
	inset-inline-end: 10px;
	display: grid;
	place-items: center;
	inline-size: 34px;
	block-size: 34px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--feed-surface, #fefefd);
	box-shadow: 0 2px 8px -2px rgba(11, 59, 46, 0.35);
	color: #5f5e58;
	cursor: pointer;
}
.byhfp-selected__map-close:hover { color: #a42b3f; }

.byhfp-selected__row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 14px;
	background: var(--feed-tint, #f5f4f1);
}

.byhfp-selected__icon {
	display: grid;
	place-items: center;
	inline-size: 38px;
	block-size: 38px;
	flex: 0 0 auto;
	border-radius: 50%;
	background: var(--feed-surface, #fefefd);
	color: #d84b4b;
}

.byhfp-selected__text {
	display: grid;
	gap: 1px;
	min-inline-size: 0;
	flex: 1;
}
/* Scoped past the generic `.byhfp-selected__text span` rule below. */
.byhfp-selected__text .byhfp-selected__caption {
	color: var(--feed-muted, rgba(0, 0, 0, .6));
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .04em;
}
.byhfp-selected__text strong {
	font-size: 15px;
	color: var(--feed-text, rgba(0, 0, 0, .9));
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.byhfp-selected__text span {
	font-size: 12.5px;
	color: var(--feed-muted, rgba(0, 0, 0, .6));
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.byhfp-selected__text span:empty { display: none; }

.byhfp-selected__actions { display: flex; gap: 4px; flex: 0 0 auto; }
.byhfp-selected__actions button {
	min-block-size: 32px;
	padding-inline: 10px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--feed-muted, rgba(0, 0, 0, .6));
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}
.byhfp-selected__actions button:hover { background: var(--feed-surface, #fefefd); color: #0e0e10; }
.byhfp-selected__actions [data-byhfp-remove]:hover { color: #a42b3f; }
.byhfp-selected__actions [data-byhfp-retry] { color: var(--accent, #567307); }
.byhfp-selected__actions [data-byhfp-retry]:hover { background: var(--accent-tint, #eef9d2); }

/* Optimistic preview (pending) and failed-resolve states. The name/address
   shown while .is-pending is unverified suggestion text only — cosmetic,
   never the trusted record; see homefeed-integration.js. */
.byhfp-selected__pending {
	display: block;
	font-size: 12px;
	color: var(--feed-muted, rgba(0, 0, 0, .6));
}
.byhfp-selected__pending:empty { display: none; }
.byhfp-selected.is-pending {
	border-color: var(--feed-line, #e8e7e3);
	opacity: 0.85;
}
.byhfp-selected.is-pending .byhfp-selected__icon { animation: byhfp-pulse 1.1s ease-in-out infinite; }
.byhfp-selected.is-pending .byhfp-selected__pending::before {
	content: "";
	display: inline-block;
	inline-size: 8px;
	block-size: 8px;
	margin-inline-end: 5px;
	border: 2px solid var(--feed-line, #e8e7e3);
	border-block-start-color: var(--accent, #567307);
	border-radius: 50%;
	vertical-align: -1px;
	animation: byhfp-spin 0.7s linear infinite;
}
.byhfp-selected.is-error { border-color: #e7c9c9; }
.byhfp-selected.is-error .byhfp-selected__row { background: #f8e9e9; }
.byhfp-selected.is-error .byhfp-selected__icon { color: #a33a3a; }
.byhfp-selected.is-error .byhfp-selected__pending { color: #a33a3a; font-weight: 600; }

@keyframes byhfp-spin { to { transform: rotate(360deg); } }
@keyframes byhfp-pulse { 50% { opacity: 0.5; } }

@media (prefers-reduced-motion: reduce) {
	.byhfp-selected.is-pending .byhfp-selected__icon,
	.byhfp-selected.is-pending .byhfp-selected__pending::before { animation: none; }
}

/* ---- Location line in published cards ---------------------------------- */

.byhfp-feed-place {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-block-start: 2px;
	color: var(--feed-muted, rgba(0, 0, 0, .6));
	font-size: 13px;
}
.byhfp-feed-place .dashicons {
	color: #d84b4b;
	font-size: 16px;
	inline-size: 16px;
	block-size: 16px;
}
.byhfp-feed-place a,
.byhfp-feed-place__name {
	color: var(--feed-text, rgba(0, 0, 0, .9));
	font-weight: 600;
	text-decoration: none;
}
.byhfp-feed-place a:hover { text-decoration: underline; }
.byhfp-feed-place__address::before { content: "·"; margin-inline-end: 6px; }

/* Inline variant: sits on the author's byline row — "الاسم في المكان" — so the
   check-in reads as part of the name line instead of a separate block. */
.byhfp-feed-place--inline {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin-block-start: 0;
	font-size: 15px;
	line-height: 24px;
}
.byhfp-feed-place--inline .byhfp-feed-place__prefix {
	color: var(--feed-muted, rgba(0, 0, 0, .6));
	font-size: 14px;
	font-weight: 400;
}
.byhfp-feed-place--inline .dashicons {
	font-size: 15px;
	inline-size: 15px;
	block-size: 15px;
}
.byhfp-feed-place--inline a,
.byhfp-feed-place--inline .byhfp-feed-place__name { font-weight: 700; }

/* ---- Mobile: bottom sheet ----------------------------------------------- */

@media (max-width: 640px) {
	.byhfp-picker__dialog {
		inset-inline-start: 0;
		inset-block-start: auto;
		inset-block-end: 0;
		transform: none;
		inline-size: 100%;
		max-block-size: 82vh;
		border-radius: 20px 20px 0 0;
		border-block-end: 0;
	}
	[dir="rtl"] .byhfp-picker__dialog { transform: none; }
	.byhfp-selected__actions button { min-block-size: 40px; }
}
