/**
 * Webcodexworld Car Buying & Selling
 * City Gate ("Select Your City" popup + "Change City" trigger) styles.
 *
 * Redesigned 2026-08-27: richer icon treatment (color-inverting badges on
 * the city tiles, a gradient header badge, a top accent bar on the panel)
 * and softer, more layered shadows/hovers throughout, on top of the same
 * markup/behavior - see templates/parts/city-gate-modal.php.
 *
 * @package Webcodexworld Car Buying & Selling
 * @since 1.5.0
 */

.carbs-wcw-city-gate,
.carbs-wcw-city-trigger {
	--carbs-cg-primary-light: var(--tpc-primary-light);
	--carbs-cg-surface-soft: var(--tpc-surface-soft);
	--carbs-cg-danger: var(--tpc-danger);
	--carbs-cg-danger-bg: var(--tpc-danger-bg);
	--carbs-cg-radius: 22px;
	--carbs-cg-radius-sm: 14px;

	font-family: var(--tpc-font-body);
}

.carbs-wcw-city-gate *,
.carbs-wcw-city-gate *::before,
.carbs-wcw-city-gate *::after {
	box-sizing: border-box;
}

.carbs-wcw-city-gate svg {
	display: block;
	flex-shrink: 0;
}

.carbs-wcw-city-gate button,
.carbs-wcw-city-gate input {
	font-family: inherit;
	font-size: inherit;
	line-height: normal;
	text-transform: none;
	letter-spacing: normal;
	box-shadow: none;
}

/* ---------- Overlay + panel ---------- */

.carbs-wcw-city-gate {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(16, 24, 40, 0.6);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
}

.carbs-wcw-city-gate[hidden] {
	display: none;
}

@keyframes carbsCityGateIn {
	from { opacity: 0; transform: translateY(14px) scale(0.97); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

.carbs-wcw-city-gate-panel {
	position: relative;
	width: 100%;
	max-width: 520px;
	max-height: min(640px, 88vh);
	display: flex;
	flex-direction: column;
	background: var(--tpc-white);
	border-radius: var(--carbs-cg-radius);
	box-shadow: 0 32px 70px -12px rgba(16, 24, 40, 0.35), 0 8px 24px rgba(16, 24, 40, 0.12);
	padding: 26px 26px 22px;
	overflow: hidden;
	animation: carbsCityGateIn 260ms cubic-bezier(0.4, 0, 0.2, 1);
}

.carbs-wcw-city-gate-panel::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 5px;
	background: linear-gradient(90deg, var(--tpc-red), #ffab6b);
}

.carbs-wcw-city-gate-head {
	display: flex;
	align-items: flex-start;
	gap: 14px;
}

.carbs-wcw-city-gate-badge {
	flex-shrink: 0;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, var(--tpc-red), var(--tpc-red));
	box-shadow: 0 8px 18px rgba(242, 103, 34, 0.32);
}

.carbs-wcw-city-gate-badge i {
	color: var(--tpc-white);
}

.carbs-wcw-city-gate-head-text {
	flex: 1;
	min-width: 0;
	padding-top: 2px;
}

.carbs-wcw-city-gate-head h2 {
	margin: 0;
	font-family: var(--tpc-font-heading);
	font-size: 21px;
	font-weight: 700;
	color: var(--tpc-black);
}

.carbs-wcw-city-gate-close {
	flex-shrink: 0;
	width: 34px;
	height: 34px;
	min-width: 34px;
	min-height: 34px;
	padding: 0;
	margin: 0;
	border-radius: 50%;
	border: none;
	background: var(--carbs-cg-surface-soft);
	color: var(--tpc-gray);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background 200ms ease, color 200ms ease, transform 200ms ease;
}

.carbs-wcw-city-gate-close:hover {
	background: var(--tpc-border);
	color: var(--tpc-black);
	transform: rotate(90deg);
}

.carbs-wcw-city-gate-note {
	margin: 5px 0 0;
	font-size: 13.5px;
	line-height: 1.4;
	color: var(--tpc-gray);
}

.carbs-wcw-city-gate-alert {
	margin: 0;
}

.carbs-wcw-city-gate-alert:not(:empty) {
	margin: 14px 0 0;
	padding: 10px 13px;
	border-radius: var(--carbs-cg-radius-sm);
	background: var(--carbs-cg-danger-bg);
	color: var(--carbs-cg-danger);
	font-size: 12.5px;
	font-weight: 600;
}

/* ---------- Search ---------- */

.carbs-wcw-city-gate-search {
	margin-top: 18px;
	display: flex;
	align-items: center;
	gap: 10px;
	color: var(--tpc-gray);
	transition: border-color 200ms ease, background 200ms ease, box-shadow 200ms ease;
}

.carbs-wcw-city-gate-search input {
	flex: 1;
	min-width: 0;
	border: none;
	background: none;
	outline: none;
	color: var(--tpc-black);
	font-size: 14px;
}

.carbs-wcw-city-gate-search input::placeholder {
	color: var(--tpc-gray);
}

/* ---------- City list body ---------- */

.carbs-wcw-city-gate-body {
	margin-top: 20px;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 3px 4px 6px 3px;
}

.carbs-wcw-city-gate-group[hidden] {
	display: none;
}

.carbs-wcw-city-gate-group + .carbs-wcw-city-gate-group {
	margin-top: 22px;
}

.carbs-wcw-city-gate-group-label {
	display: flex;
	align-items: center;
	gap: 7px;
	margin: 0 0 13px;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--tpc-gray);
}

.carbs-wcw-city-gate-group-label::before {
	content: "";
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--tpc-red);
	flex-shrink: 0;
}

.carbs-wcw-city-gate-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
	gap: 11px;
}

.carbs-wcw-city-tile {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	padding: 18px 8px 14px;
	border: 1px solid var(--tpc-border);
	border-radius: var(--carbs-cg-radius-sm);
	background: var(--tpc-white);
	color: var(--tpc-black);
	cursor: pointer;
	text-align: center;
	box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
	transition: border-color 220ms ease, background 220ms ease, box-shadow 220ms ease, transform 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

.carbs-wcw-city-tile[hidden] {
	display: none;
}

.carbs-wcw-city-tile-icon {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--carbs-cg-primary-light);
	transition: background 220ms ease, transform 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

.carbs-wcw-city-tile-icon svg {
	width: 19px;
	height: 19px;
	color: var(--tpc-red);
	transition: color 220ms ease;
}

.carbs-wcw-city-tile-name {
	font-size: 12.5px;
	font-weight: 600;
	line-height: 1.25;
}

.carbs-wcw-city-tile:hover {
	border-color: transparent;
	box-shadow: 0 14px 28px -6px rgba(242, 103, 34, 0.22), 0 2px 8px rgba(16, 24, 40, 0.06);
	transform: translateY(-3px);
}

.carbs-wcw-city-tile:hover .carbs-wcw-city-tile-icon {
	background: var(--tpc-red);
	transform: scale(1.08);
}

.carbs-wcw-city-tile:hover .carbs-wcw-city-tile-icon i {
	color: var(--tpc-white);
}

.carbs-wcw-city-tile:active {
	transform: translateY(-1px);
}

.carbs-wcw-city-tile.is-loading {
	opacity: 0.55;
	cursor: default;
	pointer-events: none;
	transform: none;
}

.carbs-wcw-city-gate-list {
	display: flex;
	flex-wrap: wrap;
	gap: 9px;
}

.carbs-wcw-city-chip {
	padding: 8px 16px;
	border: 1px solid var(--tpc-border);
	border-radius: 999px;
	background: var(--carbs-cg-surface-soft);
	color: var(--tpc-black);
	font-size: 12.5px;
	font-weight: 600;
	cursor: pointer;
	transition: border-color 200ms ease, background 200ms ease, color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}

.carbs-wcw-city-chip[hidden] {
	display: none;
}

.carbs-wcw-city-chip:hover {
	border-color: var(--tpc-red);
	background: var(--tpc-red);
	color: var(--tpc-white);
	transform: translateY(-1px);
	box-shadow: 0 8px 16px -4px rgba(242, 103, 34, 0.35);
}

.carbs-wcw-city-chip.is-loading {
	opacity: 0.55;
	cursor: default;
	pointer-events: none;
	transform: none;
}

.carbs-wcw-city-gate-empty,
.carbs-wcw-city-gate-no-results {
	margin: 4px 0 0;
	font-size: 13px;
	color: var(--tpc-gray);
	text-align: center;
	padding: 28px 0;
}

.carbs-wcw-city-gate-no-results[hidden] {
	display: none;
}

/* ---------- "Change City" trigger ---------- */

.carbs-wcw-city-trigger {
	position: fixed;
	left: 18px;
	bottom: 18px;
	z-index: 9000;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 8px 18px 8px 8px;
	border: 1px solid var(--tpc-border);
	border-radius: 999px;
	background: var(--tpc-white);
	color: var(--tpc-black);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 10px 26px -6px rgba(16, 24, 40, 0.2), 0 2px 8px rgba(16, 24, 40, 0.08);
	transition: box-shadow 220ms ease, transform 220ms ease, border-color 220ms ease;
}

.carbs-wcw-city-trigger-icon {
	flex-shrink: 0;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--carbs-cg-primary-light);
	transition: background 220ms ease;
}

.carbs-wcw-city-trigger-icon svg {
	width: 14px;
	height: 14px;
	color: var(--tpc-red);
	transition: color 220ms ease;
}

.carbs-wcw-city-trigger:hover {
	border-color: var(--tpc-red);
	box-shadow: 0 14px 32px -6px rgba(16, 24, 40, 0.26), 0 3px 10px rgba(16, 24, 40, 0.1);
	transform: translateY(-2px);
}

.carbs-wcw-city-trigger:hover .carbs-wcw-city-trigger-icon {
	background: var(--tpc-red);
	color: var(--tpc-white);
}

.carbs-wcw-city-trigger:hover .carbs-wcw-city-trigger-icon svg {
	color: var(--tpc-white);
}

@media (max-width: 480px) {

	.carbs-wcw-city-gate-panel {
		padding: 22px 18px 18px;
	}

	.carbs-wcw-city-gate-badge {
		width: 40px;
		height: 40px;
		border-radius: 12px;
	}

	.carbs-wcw-city-gate-badge svg {
		width: 19px;
		height: 19px;
	}

	.carbs-wcw-city-gate-head h2 {
		font-size: 18.5px;
	}

	.carbs-wcw-city-gate-grid {
		grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
	}

	.carbs-wcw-city-trigger span {
		max-width: 30vw;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
}
