/**
 * GeoIP Currency Switcher — header component styles
 * Premium, minimal eCommerce style. Scoped under .ghics- to avoid theme collisions.
 */

.ghics-currency-switcher {
	--ghics-radius: 10px;
	--ghics-radius-lg: 14px;
	--ghics-border: #e5e7eb;
	--ghics-border-strong: #d1d5db;
	--ghics-text: #18181b;
	--ghics-text-secondary: #6b7280;
	--ghics-text-muted: #9ca3af;
	--ghics-bg: #ffffff;
	--ghics-dropdown-bg: #ffffff;
	--ghics-bg-hover: #f9fafb;
	--ghics-bg-selected: #eff6ff;
	--ghics-accent: #2563eb;
	--ghics-shadow: 0 12px 28px rgba(15, 23, 42, 0.10), 0 2px 8px rgba(15, 23, 42, 0.06);
	--ghics-transition: 160ms cubic-bezier(0.4, 0, 0.2, 1);

	position: relative;
	display: inline-block;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	line-height: 1;
}

/* Trigger button — matches "🇺🇸 $ USD ▼" */
.ghics-trigger {
	display: flex;
	align-items: center;
	gap: 7px;
	height: 38px;
	padding: 0 12px;
	background: var(--ghics-bg);
	border: 1px solid var(--ghics-border);
	border-radius: var(--ghics-radius);
	cursor: pointer;
	font-size: 14px;
	color: var(--ghics-text);
	transition: border-color var(--ghics-transition), background var(--ghics-transition);
}

.ghics-trigger:hover {
	border-color: var(--ghics-border-strong);
	background: var(--ghics-bg-hover);
}

.ghics-trigger:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
	border-color: var(--ghics-accent);
}

.ghics-trigger .ghics-flag {
	width: 18px;
	height: 13px;
	border-radius: 2px;
	flex-shrink: 0;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.ghics-trigger .ghics-symbol {
	font-weight: 500;
}

.ghics-trigger .ghics-code {
	color: var(--ghics-text-secondary);
	font-weight: 400;
	letter-spacing: 0.02em;
}

.ghics-chevron {
	width: 14px;
	height: 14px;
	color: var(--ghics-text-muted);
	transition: transform var(--ghics-transition);
	flex-shrink: 0;
}

.ghics-currency-switcher.is-open .ghics-chevron {
	transform: rotate(180deg);
}

/* Dropdown panel */
.ghics-dropdown {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	width: 300px;
	max-width: 92vw;
	background: var(--ghics-dropdown-bg);
	border: 1px solid var(--ghics-border);
	border-radius: var(--ghics-radius-lg);
	box-shadow: var(--ghics-shadow);
	overflow: hidden;
	z-index: 9999;

	opacity: 0;
	transform: translateY(-6px) scale(0.98);
	pointer-events: none;
	transform-origin: top right;
	transition: opacity var(--ghics-transition), transform var(--ghics-transition);
}

.ghics-currency-switcher.is-open .ghics-dropdown {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

.ghics-search-wrap {
	padding: 10px;
	border-bottom: 1px solid var(--ghics-border);
}

.ghics-search {
	width: 100%;
	height: 34px;
	padding: 0 10px;
	font-size: 13px;
	color: var(--ghics-text);
	background: var(--ghics-bg-hover);
	border: 1px solid transparent;
	border-radius: 8px;
	box-sizing: border-box;
	transition: border-color var(--ghics-transition), background var(--ghics-transition);
}

.ghics-search:focus {
	outline: none;
	background: var(--ghics-bg);
	border-color: var(--ghics-border-strong);
}

.ghics-search::placeholder {
	color: var(--ghics-text-muted);
}

.ghics-list {
	list-style: none;
	margin: 0;
	padding: 6px;
	max-height: 320px;
	overflow-y: auto;
}

.ghics-option {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 10px;
	border-radius: 8px;
	cursor: pointer;
	transition: background var(--ghics-transition);
}

.ghics-option:hover {
	background: var(--ghics-bg-hover);
}

.ghics-option.is-selected {
	background: var(--ghics-bg-selected);
}

.ghics-option .ghics-flag {
	width: 20px;
	height: 15px;
	border-radius: 2px;
	flex-shrink: 0;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.ghics-option-name {
	flex: 1;
	font-size: 13px;
	color: var(--ghics-text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ghics-option.is-selected .ghics-option-name {
	font-weight: 500;
}

.ghics-option-price {
	display: flex;
	align-items: baseline;
	gap: 5px;
	font-size: 13px;
	flex-shrink: 0;
}

.ghics-option-price .ghics-symbol {
	color: var(--ghics-text);
}

.ghics-option-price .ghics-code {
	color: var(--ghics-text-secondary);
	font-size: 12px;
}

.ghics-option.is-selected .ghics-option-price .ghics-symbol,
.ghics-option.is-selected .ghics-option-price .ghics-code {
	color: var(--ghics-accent);
}

.ghics-empty {
	padding: 24px 12px;
	text-align: center;
	font-size: 13px;
	color: var(--ghics-text-muted);
}

.ghics-list::-webkit-scrollbar {
	width: 6px;
}

.ghics-list::-webkit-scrollbar-thumb {
	background: var(--ghics-border-strong);
	border-radius: 3px;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
	.ghics-dropdown,
	.ghics-chevron {
		transition: none;
	}
}

/* Tablet */
@media (max-width: 782px) {
	.ghics-dropdown {
		width: 280px;
	}
}

/* Mobile — anchor full width under the trigger, keep it reachable with one thumb */
@media (max-width: 480px) {
	.ghics-dropdown {
		position: fixed;
		left: 12px;
		right: 12px;
		top: auto;
		width: auto;
		max-width: none;
		transform-origin: top center;
	}

	.ghics-trigger .ghics-code {
		display: none;
	}
}

/**
 * Floating badge placement.
 * Pinned to the corner of the viewport — this positioning is what makes it
 * a "floating badge" rather than an inline element sitting wherever
 * wp_footer happens to print it in the document flow.
 */
.ghics-floating-switcher {
	position: fixed;
	top: 16px;
	right: 16px;
	z-index: 99998;
}

@media (max-width: 480px) {
	.ghics-floating-switcher {
		top: 10px;
		right: 10px;
	}
}

/**
 * Automatic header placement (Header Left / Center / Right).
 * Rendered at wp_body_open, so this sits at the very top of the page,
 * ahead of the theme's own header markup — a slim bar the switcher aligns
 * within per the chosen side. Uses the theme's normal text color so it
 * blends in rather than imposing its own background by default.
 */
.ghics-header-bar {
	display: flex;
	align-items: center;
	width: 100%;
	padding: 6px 20px;
	box-sizing: border-box;
	position: relative;
	z-index: 9990;
}

.ghics-header-bar.ghics-align-left {
	justify-content: flex-start;
}

.ghics-header-bar.ghics-align-center {
	justify-content: center;
}

.ghics-header-bar.ghics-align-right {
	justify-content: flex-end;
}

/* Fallback for themes that never call wp_body_open() — pin to the top of
   the viewport instead of silently rendering nothing. */
.ghics-header-bar-fixed {
	position: fixed;
	top: 0;
	left: 0;
	background: var(--ghics-bg, #ffffff);
	border-bottom: 1px solid var(--ghics-border, #e5e7eb);
	z-index: 99999;
}
