/* Вибір міста України. Кольори змінюються через змінні нижче. */
:root {
	--cu-accent: #1e88e5;
	--cu-accent-text: #fff;
	--cu-text: #222;
	--cu-muted: #777;
	--cu-bg: #fff;
	--cu-hover: #f2f6fb;
	--cu-border: #dde2e8;
	--cu-radius: 10px;
}

html.cu-lock {
	overflow: hidden;
}

.cu-modal[hidden],
.cu-modal [hidden] {
	display: none !important;
}

/* Кнопка міста */
.cu-trigger {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	cursor: pointer;
	white-space: nowrap;
}

.cu-trigger .cu-current-name {
	border-bottom: 1px dashed currentColor;
}

.cu-icon {
	flex: none;
}

.cu-trigger.cu-floating {
	position: fixed;
	left: 16px;
	bottom: 16px;
	z-index: 9990;
	padding: 10px 16px;
	border-radius: 999px;
	background: var(--cu-accent);
	color: var(--cu-accent-text);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
	font-size: 14px;
	text-decoration: none;
}

.cu-trigger.cu-floating:hover,
.cu-trigger.cu-floating:focus {
	color: var(--cu-accent-text);
	text-decoration: none;
}

.cu-trigger.cu-floating .cu-current-name {
	border-bottom: 0;
}

/* Вікно */
.cu-modal {
	position: fixed;
	inset: 0;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	font-size: 14px;
	line-height: 1.4;
	color: var(--cu-text);
}

.cu-backdrop {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	background: rgba(15, 23, 42, 0.55);
}

.cu-dialog {
	position: relative;
	box-sizing: border-box;
	width: 100%;
	max-width: 640px;
	max-height: calc(100vh - 32px);
	overflow-y: auto;
	padding: 28px;
	border-radius: var(--cu-radius);
	background: var(--cu-bg);
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	animation: cu-in 0.18s ease-out;
}

@keyframes cu-in {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

.cu-is-busy .cu-dialog {
	cursor: progress;
	opacity: 0.7;
}

.cu-close {
	position: absolute;
	top: 10px;
	right: 12px;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--cu-muted);
	font-size: 28px;
	line-height: 36px;
	cursor: pointer;
}

.cu-close:hover {
	color: var(--cu-text);
}

.cu-is-required .cu-close {
	display: none;
}

.cu-title {
	margin: 0 32px 4px 0;
	font-size: 22px;
	font-weight: 600;
}

.cu-hint {
	margin-bottom: 14px;
	color: var(--cu-muted);
}

.cu-current {
	margin-bottom: 14px;
}

.cu-input {
	box-sizing: border-box;
	width: 100%;
	height: 46px;
	padding: 0 14px;
	border: 1px solid var(--cu-border);
	border-radius: 8px;
	background: var(--cu-bg);
	color: var(--cu-text);
	font-size: 16px;
	outline: none;
	-webkit-appearance: none;
	appearance: none;
}

.cu-input:focus {
	border-color: var(--cu-accent);
	box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.15);
}

.cu-results,
.cu-grid {
	margin: 0;
	padding: 0;
	list-style: none;
}

.cu-results {
	margin-top: 8px;
	max-height: 320px;
	overflow-y: auto;
}

.cu-msg {
	padding: 12px 4px;
	color: var(--cu-muted);
}

.cu-result,
.cu-city {
	display: block;
	box-sizing: border-box;
	width: 100%;
	border: 0;
	background: none;
	color: var(--cu-text);
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.cu-result {
	padding: 10px 12px;
	border-radius: 6px;
}

.cu-result:hover,
.cu-result.is-focused {
	background: var(--cu-hover);
}

.cu-result-name {
	display: block;
	font-weight: 500;
}

.cu-result-name mark {
	padding: 0;
	background: none;
	color: var(--cu-accent);
}

.cu-result-region {
	display: block;
	font-size: 12px;
	color: var(--cu-muted);
}

/* Населений пункт без відділення НП */
.cu-result-note {
	display: block;
	margin-top: 2px;
	font-size: 12px;
	color: var(--cu-note, #b45309);
}

.cu-subtitle {
	margin: 20px 0 8px;
	font-weight: 600;
}

.cu-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 2px 12px;
}

.cu-city {
	padding: 6px 8px;
	border-radius: 6px;
}

.cu-city:hover {
	background: var(--cu-hover);
	color: var(--cu-accent);
}

.cu-city.is-active {
	color: var(--cu-accent);
	font-weight: 600;
}

/* Кнопка «Визначити автоматично» */
.cu-locate {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 10px;
	padding: 4px 0;
	border: 0;
	background: none;
	color: var(--cu-accent);
	font: inherit;
	cursor: pointer;
}

.cu-locate:hover span {
	text-decoration: underline;
}

/* Підказка «Ваше місто — Київ?» */
.cu-confirm {
	position: fixed;
	top: 16px;
	left: 50%;
	z-index: 9995;
	box-sizing: border-box;
	width: 300px;
	max-width: calc(100vw - 16px);
	padding: 16px 18px;
	border-radius: var(--cu-radius);
	background: var(--cu-bg);
	color: var(--cu-text);
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.22);
	font-size: 14px;
	line-height: 1.4;
	transform: translateX(-50%);
	animation: cu-in 0.18s ease-out;
}

.cu-confirm[hidden] {
	display: none !important;
}

.cu-confirm.cu-confirm-anchored {
	transform: none;
}

.cu-confirm.cu-confirm-anchored::before {
	content: '';
	position: absolute;
	top: -7px;
	left: var(--cu-arrow, 50%);
	width: 14px;
	height: 14px;
	margin-left: -7px;
	background: var(--cu-bg);
	transform: rotate(45deg);
	box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.06);
}

.cu-confirm-close {
	position: absolute;
	top: 4px;
	right: 6px;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--cu-muted);
	font-size: 22px;
	line-height: 28px;
	cursor: pointer;
}

.cu-confirm.cu-is-required .cu-confirm-close {
	display: none;
}

.cu-confirm-text {
	position: relative;
	margin: 0 20px 12px 0;
	font-size: 16px;
}

.cu-confirm-actions {
	position: relative;
	display: flex;
	gap: 8px;
}

.cu-btn {
	flex: 1;
	padding: 9px 12px;
	border: 1px solid var(--cu-border);
	border-radius: 6px;
	background: var(--cu-bg);
	color: var(--cu-text);
	font: inherit;
	cursor: pointer;
}

.cu-btn:hover {
	background: var(--cu-hover);
}

.cu-btn-primary {
	border-color: var(--cu-accent);
	background: var(--cu-accent);
	color: var(--cu-accent-text);
}

.cu-btn-primary:hover {
	background: var(--cu-accent);
	filter: brightness(1.08);
}

@media (max-width: 575px) {
	.cu-confirm {
		top: auto;
		bottom: 12px;
	}

	.cu-modal {
		align-items: flex-end;
		padding: 0;
	}

	.cu-dialog {
		max-height: 92vh;
		padding: 22px 16px;
		border-radius: var(--cu-radius) var(--cu-radius) 0 0;
	}

	.cu-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}
