/**
 * ForeBranch places browse polish
 * Depends on list-chrome.css (hub tokens under .lp-shell).
 */

/* --------------------------------------------------------------------------
	Toolbar (shared pattern with families/sources)
	-------------------------------------------------------------------------- */
.lp-toolbar {
	margin-bottom: var(--lp-space-6);
}

.lp-toolbar__body {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: var(--lp-space-4);
}

.lp-toolbar__meta {
	font-size: var(--lp-text-sm);
	color: var(--lp-color-text-secondary);
}

.lp-toolbar__form {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--lp-space-2);
}

.lp-input,
.lp-select {
	min-height: 2.25rem;
	padding: var(--lp-space-2) var(--lp-space-3);
	font-family: inherit;
	font-size: var(--lp-text-sm);
	color: var(--lp-color-text);
	background: var(--lp-color-surface);
	border: 1px solid var(--lp-color-border);
	border-radius: var(--lp-radius-sm);
	line-height: 1.2;
}

.lp-input {
	min-width: 14rem;
}

.lp-input:focus,
.lp-select:focus {
	outline: none;
	box-shadow: var(--lp-focus-ring);
	border-color: var(--lp-color-accent-muted);
}

.lp-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 2.25rem;
	padding: var(--lp-space-2) var(--lp-space-4);
	font-family: inherit;
	font-size: var(--lp-text-sm);
	font-weight: var(--lp-weight-medium);
	line-height: 1.2;
	color: #fff;
	background: var(--lp-color-accent);
	border: 1px solid var(--lp-color-accent);
	border-radius: var(--lp-radius-sm);
	cursor: pointer;
	text-decoration: none;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.lp-btn:hover {
	background: var(--lp-color-accent-hover);
	border-color: var(--lp-color-accent-hover);
	color: #fff;
	text-decoration: none;
}

.lp-btn:focus-visible {
	outline: none;
	box-shadow: var(--lp-focus-ring);
}

.lp-shell a.lp-btn--ghost,
.lp-btn--ghost {
	color: var(--lp-color-accent);
	background: var(--lp-color-surface);
	border-color: var(--lp-color-border);
}

.lp-shell a.lp-btn--ghost:hover,
.lp-btn--ghost:hover {
	background: var(--lp-color-accent-soft);
	border-color: var(--lp-color-accent-muted);
	color: var(--lp-color-accent);
	text-decoration: none;
}

.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}

/* --------------------------------------------------------------------------
	Alphabetical directory
	-------------------------------------------------------------------------- */
.hp-place-alphabet {
	display: flex;
	flex-wrap: wrap;
	gap: var(--lp-space-1);
	margin: 0 0 var(--lp-space-5);
}

.hp-place-alphabet__item {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2rem;
	min-height: 2rem;
	padding: 0 var(--lp-space-2);
	color: var(--lp-color-accent);
	background: var(--lp-color-surface);
	border: 1px solid var(--lp-color-border);
	border-radius: var(--lp-radius-sm);
	font-size: var(--lp-text-sm);
	font-weight: var(--lp-weight-semibold);
	line-height: 1;
	text-decoration: none;
}

.hp-place-alphabet__item:hover,
.hp-place-alphabet__item.is-current {
	color: #fff;
	background: var(--lp-color-accent);
	border-color: var(--lp-color-accent);
	text-decoration: none;
}

.hp-place-alphabet__item.is-disabled {
	color: var(--lp-color-text-muted);
	background: var(--lp-color-surface-alt);
	cursor: default;
	opacity: 0.55;
}

.hp-place-directory {
	overflow: hidden;
}

/* Legacy hierarchy selectors remain for backward-compatible embeds. */
.hp-place-country {
	margin-bottom: var(--lp-space-5);
}

.hp-place-country__toggle,
.hp-place-state__toggle {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--lp-space-2) var(--lp-space-3);
	width: 100%;
	margin: 0;
	padding: var(--lp-space-4) var(--lp-space-5);
	border: none;
	background: var(--lp-color-surface-alt);
	color: var(--lp-color-text);
	font-family: inherit;
	text-align: left;
	cursor: pointer;
	border-bottom: 1px solid var(--lp-color-border);
}

.hp-place-country__toggle:hover,
.hp-place-state__toggle:hover {
	background: var(--lp-color-accent-soft);
}

.hp-place-country__toggle:focus-visible,
.hp-place-state__toggle:focus-visible {
	outline: none;
	box-shadow: inset var(--lp-focus-ring);
}

.hp-place-toggle {
	display: inline-flex;
	width: 1.25rem;
	color: var(--lp-color-accent);
	font-size: var(--lp-text-sm);
	flex: 0 0 auto;
}

.hp-place-country__name {
	font-size: var(--lp-text-lg);
	font-weight: var(--lp-weight-semibold);
	color: var(--lp-heading-color, var(--lp-color-text));
	flex: 1 1 auto;
}

.hp-place-country__meta,
.hp-place-state__meta,
.hp-place-region__meta {
	font-size: var(--lp-text-sm);
	font-weight: var(--lp-weight-normal);
	color: var(--lp-color-text-secondary);
	margin-left: auto;
}

.hp-place-state__toggle {
	background: var(--lp-color-surface);
	padding: var(--lp-space-3) var(--lp-space-5) var(--lp-space-3) calc(var(--lp-space-5) + 0.5rem);
}

.hp-place-state__name {
	font-size: var(--lp-text-base);
	font-weight: var(--lp-weight-semibold);
	color: var(--lp-color-text);
	flex: 1 1 auto;
}

.hp-place-region__header {
	padding: var(--lp-space-3) var(--lp-space-5);
	background: #f5f7f8;
	color: var(--lp-color-text-secondary);
	font-size: var(--lp-text-sm);
	font-weight: var(--lp-weight-semibold);
	border-top: 1px solid var(--lp-color-border);
}

/* --------------------------------------------------------------------------
	Place rows
	-------------------------------------------------------------------------- */
.hp-place-table {
	width: 100%;
	border-collapse: collapse;
	background: var(--lp-color-surface);
}

.hp-place-table th {
	padding: var(--lp-space-3) var(--lp-space-5);
	color: var(--lp-color-text-secondary);
	background: var(--lp-color-surface-alt);
	border-bottom: 1px solid var(--lp-color-border);
	font-size: var(--lp-text-xs);
	font-weight: var(--lp-weight-semibold);
	text-align: left;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.hp-place-table tr {
	border-bottom: 1px solid var(--lp-color-border);
	transition: background 0.12s ease;
}

.hp-place-table tr:last-child {
	border-bottom: none;
}

.hp-place-table tr:hover {
	background: var(--lp-color-surface-alt);
}

.hp-place-table td {
	padding: var(--lp-space-3) var(--lp-space-5);
	vertical-align: middle;
}

.hp-place-name {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	line-height: 1.35;
	max-width: 100%;
}

.hp-place-name a {
	color: var(--lp-link-color, var(--lp-color-accent));
	text-decoration: none;
	font-weight: var(--lp-weight-semibold);
	font-size: 0.9375rem;
	word-break: break-word;
}

.hp-place-name a:hover {
	text-decoration: underline;
}

.hp-place-name__plain {
	font-weight: var(--lp-weight-semibold);
	font-size: 0.9375rem;
	color: var(--lp-color-text-secondary);
	word-break: break-word;
}

.hp-place-name__sub {
	font-size: var(--lp-text-xs);
	color: var(--lp-color-text-muted);
	line-height: 1.25;
	word-break: break-word;
}

.hp-place-table__count {
	text-align: center;
	width: 6.5rem;
	color: var(--lp-color-text-secondary);
	font-size: var(--lp-text-sm);
	font-variant-numeric: tabular-nums;
}

.hp-place-table__count strong {
	display: block;
	color: var(--lp-color-text);
	font-size: var(--lp-text-base);
}

.hp-place-table__count span {
	font-size: var(--lp-text-xs);
}

.hp-place-table__tree {
	width: 11rem;
	color: var(--lp-color-text-secondary);
	font-size: var(--lp-text-sm);
}


.hp-places-browse .empty-state {
	text-align: center;
	color: var(--lp-color-text-secondary);
	padding: var(--lp-space-8) var(--lp-space-4);
}

.hp-places-browse .lp-pager {
	margin-top: var(--lp-space-6);
}

@media (max-width: 720px) {
	.lp-toolbar__body {
	flex-direction: column;
	align-items: stretch;
	}

	.lp-toolbar__form {
	width: 100%;
	}

	.lp-input,
	.lp-select {
	flex: 1 1 100%;
	width: 100%;
	min-width: 0;
	}

	.hp-place-country__meta,
	.hp-place-state__meta {
	margin-left: 1.75rem;
	width: 100%;
	}

	.hp-place-table__count {
	width: auto;
	}

	.hp-place-table th,
	.hp-place-table td {
	padding-right: var(--lp-space-3);
	padding-left: var(--lp-space-3);
	}

	.hp-place-table__tree {
	display: none;
	}
}
