/* Trellis Core — listing location picker. Shared by wp-admin and the theme,
 * so it leans on the theme's tokens where they exist and falls back to plain
 * values in wp-admin, where they don't. */

.trellis-geo {
	--geo-line: var(--line, #dcdfe4);
	--geo-muted: var(--muted, #6b7280);
	--geo-surface: var(--surface-2, #f3f4f6);
	--geo-radius: var(--radius-md, 10px);
	--geo-ink: var(--navy-700, #1d2d44);
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.trellis-geo__bar { display: flex; gap: 8px; align-items: stretch; }
.trellis-geo__approx {
	margin: 0; padding: 10px 12px; border-radius: var(--geo-radius);
	background: #fff7e6; border: 1px solid #f5d38a; color: #7a4b00; font-size: 13px; line-height: 1.8;
}
.trellis-geo:not(.is-approx) .trellis-geo__approx { display: none; }
.trellis-geo__search { position: relative; flex: 1; min-width: 0; }
.trellis-geo__q { width: 100%; box-sizing: border-box; padding-inline-end: 44px !important; }
.trellis-geo__go {
	position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%);
	display: grid; place-items: center; width: 34px; height: 34px;
	border: 0; border-radius: 8px; background: var(--geo-ink); color: #fff; cursor: pointer;
}
.trellis-geo--admin .trellis-geo__go { width: 26px; height: 26px; }
.trellis-geo__go:hover { opacity: .9; }
.trellis-geo--admin .trellis-geo__q { min-height: 32px; }

.trellis-geo__results {
	position: absolute; inset-inline: 0; top: calc(100% + 4px); z-index: 1001;
	margin: 0; padding: 4px; list-style: none;
	background: #fff; border: 1px solid var(--geo-line); border-radius: var(--geo-radius);
	box-shadow: 0 10px 28px rgba(16, 32, 58, .14);
	max-height: 280px; overflow-y: auto;
}
.trellis-geo__results li { margin: 0; }
.trellis-geo__results button {
	display: flex; flex-direction: column; gap: 2px; width: 100%;
	padding: 8px 10px; border: 0; border-radius: 6px; background: none;
	font: inherit; text-align: start; color: inherit; cursor: pointer;
}
.trellis-geo__results button:hover,
.trellis-geo__results button:focus-visible { background: var(--geo-surface); outline: none; }
.trellis-geo__results strong { font-size: 14px; }
.trellis-geo__results span { font-size: 12px; color: var(--geo-muted); }
.trellis-geo__empty { padding: 8px 10px; font-size: 13px; color: var(--geo-muted); }

.trellis-geo__btn,
.trellis-geo__clear {
	display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
	padding: 0 12px; min-height: 40px; box-sizing: border-box;
	border: 1px solid var(--geo-line); border-radius: var(--geo-radius);
	background: #fff; color: var(--geo-ink);
	font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.trellis-geo--admin .trellis-geo__btn,
.trellis-geo--admin .trellis-geo__clear { min-height: 32px; }
.trellis-geo__btn:hover, .trellis-geo__clear:hover { border-color: var(--geo-ink); }
.trellis-geo__btn:disabled { opacity: .6; cursor: progress; }

.trellis-geo__map {
	position: relative; height: 320px;
	border: 1px solid var(--geo-line); border-radius: var(--geo-radius);
	background: var(--geo-surface); overflow: hidden;
	/* Leaflet reads its own stacking; keep it under the results dropdown. */
	z-index: 0;
}
.trellis-geo__loading {
	position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
	padding: 16px; text-align: center; font-size: 13px; color: var(--geo-muted);
	direction: rtl;
}
.trellis-geo.is-ready .trellis-geo__loading,
.trellis-geo-view.is-ready .trellis-geo__loading { display: none; }

/* Read-only listing map (Trellis_Geo::view). */
.trellis-geo-view {
	position: relative; height: 240px;
	border: 1px solid var(--line, #dcdfe4); border-radius: var(--r-card, 12px);
	background: var(--surface-2, #f3f4f6); overflow: hidden; z-index: 0;
}
.trellis-geo-view__note { margin: -8px 0 0; font-size: 12.5px; color: var(--muted, #6b7280); }

.trellis-geo__pin { background: none; border: 0; }
.trellis-geo__pin svg { display: block; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .3)); }

.trellis-geo__suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0; font-size: 13px; color: var(--geo-ink); }
.trellis-geo__suggest:empty { display: none; }
.trellis-geo__suggest button { padding: 4px 10px; border: 1px solid var(--geo-line); border-radius: 8px; background: #fff; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--geo-ink); cursor: pointer; }
.trellis-geo__suggest button:hover { border-color: var(--geo-ink); }
.trellis-geo__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.trellis-geo__status { flex: 1; min-width: 200px; margin: 0; font-size: 13px; color: var(--geo-muted); }
.trellis-geo__status-set { display: none; color: #0a7a4b; font-weight: 600; }
.trellis-geo.has-point .trellis-geo__status-set { display: inline; }
.trellis-geo.has-point .trellis-geo__status-empty { display: none; }
.trellis-geo__note { display: block; color: #b42318; }
.trellis-geo__note:empty { display: none; }

.trellis-geo__clear { display: none; }
.trellis-geo.has-point .trellis-geo__clear { display: inline-flex; }

.trellis-geo__coords { display: inline-flex; gap: 10px; }
.trellis-geo__coords label { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }

@media (max-width: 560px) {
	.trellis-geo__map { height: 260px; }
	.trellis-geo-view { height: 200px; }
	/* Icon-only on phones; the label stays for screen readers. */
	.trellis-geo__btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* Archive map dialog (Trellis_Geo::archive_map + geo-archive.js). */
.trellis-geo-archive {
	width: min(1100px, calc(100vw - 32px)); height: min(760px, calc(100vh - 32px));
	max-width: none; max-height: none; padding: 0; border: 0; border-radius: var(--r-card, 14px);
	overflow: hidden; background: #fff; box-shadow: 0 24px 60px rgba(16, 32, 58, .3);
}
.trellis-geo-archive[open] { display: flex; flex-direction: column; }
.trellis-geo-archive::backdrop { background: rgba(8, 17, 31, .55); }
.trellis-geo-archive-open { overflow: hidden; }
.trellis-geo-archive__head {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	padding: 12px 16px; border-bottom: 1px solid var(--line, #dcdfe4);
}
.trellis-geo-archive__head h2 { margin: 0; font-size: 16px; }
.trellis-geo-archive__close {
	display: grid; place-items: center; width: 38px; height: 38px; flex-shrink: 0;
	border: 1px solid var(--line, #dcdfe4); border-radius: 10px; background: #fff; color: inherit; cursor: pointer;
}
.trellis-geo-archive__close:hover { border-color: var(--navy-700, #1d2d44); }
.trellis-geo-archive__map { position: relative; flex: 1; min-height: 0; background: var(--surface-2, #f3f4f6); }
.trellis-geo-archive__map.is-ready .trellis-geo__loading { display: none; }

.trellis-geo-archive__bubble { background: none; border: 0; }
.trellis-geo-archive__bubble span {
	display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
	background: #E5484D; color: #fff; font: 700 13px/1 var(--font, inherit);
	border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); box-sizing: border-box;
}
.trellis-geo-archive__pop { display: flex; flex-direction: column; gap: 6px; font-family: var(--font, inherit); }
.trellis-geo-archive__count { margin: 0 0 2px; font-size: 12px; color: var(--muted, #6b7280); }
.trellis-geo-archive__item { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; border-radius: 8px; color: inherit; text-decoration: none; }
.trellis-geo-archive__item:hover { background: var(--surface-2, #f3f4f6); }
.trellis-geo-archive__item strong { font-size: 13.5px; color: var(--navy-900, #0b1626); }
.trellis-geo-archive__approx { font-size: 11.5px; color: var(--muted, #6b7280); }

@media (max-width: 560px) {
	.trellis-geo-archive { width: 100vw; height: 100dvh; border-radius: 0; }
}
