/* ===========================================================
 * CGMP Locale Switcher + Mobile header tightening
 * =========================================================== */

.cgmp-locale {
	position: relative;
	display: inline-block;
	font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	color: #0F172A;
}

/* Trigger button */
.cgmp-locale-trigger {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: rgba(255, 255, 255, 0.95);
	border: 1px solid rgba(15, 23, 42, 0.12);
	border-radius: 999px;
	padding: 5px 10px 5px 8px;
	font: inherit;
	color: inherit;
	cursor: pointer;
	transition: background .15s, border-color .15s, transform .1s;
	white-space: nowrap;
}
.cgmp-locale-trigger:hover { background: #fff; border-color: rgba(15, 23, 42, 0.25); }
.cgmp-locale-trigger:active { transform: scale(0.98); }
.cgmp-locale-trigger[aria-expanded="true"] { background: #fff; box-shadow: 0 4px 12px rgba(15, 23, 42, 0.10); }

.cgmp-locale-flag  { font-size: 16px; line-height: 1; }
.cgmp-locale-label { font-size: 12.5px; font-weight: 600; letter-spacing: 0.02em; }
.cgmp-locale-chev  { font-size: 10px; color: #64748B; }

/* Dropdown panel */
.cgmp-locale-panel {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	width: 280px;
	max-width: calc(100vw - 24px);
	background: #fff;
	border: 1px solid rgba(15, 23, 42, 0.10);
	border-radius: 12px;
	box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.06);
	z-index: 99997;
	overflow: hidden;
}
.cgmp-locale-panel[hidden] { display: none !important; }

.cgmp-locale-panel-head {
	padding: 12px 14px;
	background: linear-gradient(135deg, #1E73BE, #0F4C8C);
	color: #fff;
	font-weight: 700;
	font-size: 13px;
	letter-spacing: 0.02em;
}

.cgmp-locale-list {
	list-style: none;
	padding: 0;
	margin: 0;
	max-height: 340px;
	overflow-y: auto;
}
.cgmp-locale-list li { margin: 0; }

.cgmp-locale-item {
	width: 100%;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 14px;
	background: transparent;
	border: 0;
	border-bottom: 1px solid #F1F5F9;
	cursor: pointer;
	font: inherit;
	color: #0F172A;
	text-align: left;
	transition: background .12s;
}
.cgmp-locale-item:hover { background: #F8FAFC; }
.cgmp-locale-item.is-active { background: #EFF6FF; }
.cgmp-locale-item.is-active .cgmp-locale-item-name { font-weight: 700; color: #1E73BE; }

.cgmp-locale-item-flag { font-size: 18px; flex-shrink: 0; }
.cgmp-locale-item-name { flex: 1; min-width: 0; font-size: 13.5px; }
.cgmp-locale-item-cur  { font-size: 11.5px; color: #64748B; font-weight: 600; padding: 2px 8px; background: #F1F5F9; border-radius: 999px; }
.cgmp-locale-item-check { color: #1E73BE; font-weight: 700; margin-left: 4px; }

.cgmp-locale-panel-foot {
	padding: 10px 14px;
	background: #F8FAFC;
	border-top: 1px solid #E5E7EB;
	font-size: 11px;
	color: #64748B;
	line-height: 1.4;
}

/* ===========================================================
 * Mobile sheet treatment (under 600px)
 * =========================================================== */
@media (max-width: 600px) {
	.cgmp-locale-panel {
		position: fixed;
		left: 12px;
		right: 12px;
		top: auto;
		bottom: 12px;
		width: auto;
		max-width: none;
		border-radius: 14px;
		box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.25);
	}
	.cgmp-locale-list { max-height: 60vh; }
}

/* ===========================================================
 * Auto-injected position (bottom-right floating) when theme
 * doesn't render the switcher anywhere itself.
 * =========================================================== */
.cgmp-locale--auto {
	position: fixed;
	right: 14px;
	bottom: 90px;
	z-index: 99996;
}
.cgmp-locale--auto .cgmp-locale-trigger {
	background: #fff;
	box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
	border-color: transparent;
	padding: 8px 14px 8px 10px;
}
@media (max-width: 600px) {
	.cgmp-locale--auto { right: 12px; bottom: 76px; }
}

/* ===========================================================
 * Mobile header — JS-injected icon group (cgmp-mh-icons)
 * Triggered by assets/public/mobile-header-fix.js which detects
 * cart/bell/notification/location icons that fell to a 2nd row
 * and moves them next to the logo in this flex group.
 * =========================================================== */
.cgmp-mh-row {
	display: flex !important;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}
.cgmp-mh-row > .cgmp-mh-icons {
	display: flex !important;
	align-items: center;
	gap: 10px;
	margin-left: auto !important;
	flex: 0 0 auto;
	order: 99;
}
.cgmp-mh-row > .cgmp-mh-icons > * {
	flex: 0 0 auto;
	margin: 0 !important;
	position: static !important;
	top: auto !important;
	right: auto !important;
}
/* Don't let big circular icon backgrounds explode the row. */
@media (max-width: 600px) {
	.cgmp-mh-row > .cgmp-mh-icons > a,
	.cgmp-mh-row > .cgmp-mh-icons > button,
	.cgmp-mh-row > .cgmp-mh-icons > div {
		max-width: 44px;
	}
	.cgmp-mh-row > .cgmp-mh-icons img,
	.cgmp-mh-row > .cgmp-mh-icons svg {
		width: 22px;
		height: 22px;
	}
}

/* ===========================================================
 * Mobile header tightening — generic CSS that nudges common
 * theme markup into a single compact row on small screens.
 * Targets only when the marketplace plugin sees an obvious
 * overflowing header (theme-agnostic, intentionally light).
 * =========================================================== */
@media (max-width: 600px) {
	/* Compact icon buttons typically used for cart/bell. */
	.site-header .header-cart,
	.site-header .header-notifications,
	.site-header .cart-icon-wrapper,
	.site-header .notification-icon-wrapper,
	.cg-header-actions {
		display: inline-flex !important;
		align-items: center;
		gap: 10px;
		margin: 0;
	}

	/* Bell + cart on the SAME row as the logo by tightening the wrap. */
	.site-header,
	header.site-header,
	.cg-header,
	.cg-mobile-header {
		display: flex !important;
		flex-wrap: wrap;
		align-items: center;
		gap: 8px;
		padding: 8px 12px !important;
	}

	/* Search bar deserves its own full-width row. */
	.site-header .search-form,
	.cg-header .search-form,
	.cg-mobile-header .search-form,
	.cg-header-search {
		order: 99;
		flex: 1 0 100%;
		margin-top: 6px;
	}

	/* Don't let big circular icon backgrounds explode the layout. */
	.site-header .cart-icon-wrapper,
	.site-header .notification-icon-wrapper {
		width: 40px; height: 40px;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		border-radius: 50%;
		font-size: 18px;
	}
}
