/**
 * Frontend Styles
 */

/* Currency Switcher Base */
.wppc-currency-switcher {
	display: inline-block;
	font-family: inherit;
}

/* Dropdown Type */
.wppc-type-dropdown select.wppc-currency-selector {
	padding: 8px 12px;
	border: 1px solid #ddd;
	border-radius: 4px;
	background: #fff;
	font-size: 14px;
	cursor: pointer;
	min-width: 120px;
	transition: border-color 0.2s;
}

.wppc-type-dropdown select.wppc-currency-selector:hover {
	border-color: #999;
}

.wppc-type-dropdown select.wppc-currency-selector:focus {
	outline: none;
	border-color: #666;
	box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

/* Buttons Type */
.wppc-type-buttons .wppc-currency-buttons {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.wppc-currency-button {
	padding: 8px 16px;
	border: 1px solid #ddd;
	border-radius: 4px;
	background: #fff;
	cursor: pointer;
	font-size: 14px;
	transition: all 0.2s;
	display: flex;
	align-items: center;
	gap: 6px;
}

.wppc-currency-button:hover {
	background: #f5f5f5;
	border-color: #999;
}

.wppc-currency-button.active {
	background: #0073aa;
	color: #fff;
	border-color: #0073aa;
}

.wppc-currency-button .wppc-flag {
	font-size: 18px;
}

/* Compact Type - Menu-style dropdown like Polylang (pure CSS, no JS) */
.wppc-type-compact .wppc-currency-compact {
	position: relative;
	display: inline-block;
}

.wppc-currency-toggle {
	padding: 10px 16px;
	border: 1px solid #ddd;
	border-radius: 4px;
	background: #fff;
	cursor: pointer;
	font-size: 14px;
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 120px;
	transition: all 0.2s;
	user-select: none;
}

.wppc-currency-toggle:hover {
	border-color: #999;
	background: #f9f9f9;
}

.wppc-currency-toggle .wppc-flag {
	font-size: 18px;
}

.wppc-currency-toggle .wppc-arrow {
	margin-left: auto;
	display: flex;
	align-items: center;
}

.wppc-currency-toggle .wppc-arrow-svg {
	width: 10px;
	height: 10px;
	fill: currentColor;
	transition: transform 0.2s;
}

/* Pure CSS hover dropdown - no JavaScript needed */
.wppc-currency-compact:hover .wppc-arrow-svg {
	transform: rotate(180deg);
}

.wppc-currency-list {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	margin: 4px 0 0;
	padding: 0;
	list-style: none;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	max-height: 320px;
	overflow-y: auto;
	z-index: 9999;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-10px);
	transition: all 0.2s ease;
}

/* Show on hover - pure CSS */
.wppc-currency-compact:hover .wppc-currency-list {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.wppc-currency-item {
	margin: 0;
	padding: 0;
}

.wppc-currency-item .wppc-currency-link {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 15px;
	color: inherit;
	text-decoration: none;
	transition: background-color 0.2s;
}

.wppc-currency-item .wppc-currency-link:hover {
	background-color: #f5f5f5;
}

.wppc-currency-item.active .wppc-currency-link {
	background-color: #e8f5e9;
	color: #2e7d32;
	font-weight: 600;
}

.wppc-currency-item .wppc-flag {
	font-size: 18px;
}

/* Loading State */
.wppc-currency-switcher.loading {
	opacity: 0.6;
	pointer-events: none;
}

/* Mobile/Touch Devices - use .open class instead of hover */
.wppc-currency-compact.open .wppc-currency-list {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.wppc-currency-compact.open .wppc-arrow-svg {
	transform: rotate(180deg);
}

/* Responsive */
@media (max-width: 768px) {
	.wppc-type-buttons .wppc-currency-buttons {
		flex-direction: column;
		width: 100%;
	}
	
	.wppc-currency-button {
		width: 100%;
		justify-content: center;
	}
	
	/* On mobile, make dropdown full width */
	.wppc-currency-list {
		left: 0;
		right: 0;
		min-width: 100%;
	}
}

/* Accessibility */
.wppc-currency-button:focus,
.wppc-currency-toggle:focus {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
}

.wppc-currency-item:focus {
	outline: none;
	background-color: #e3f2fd;
}

/* Links Type - Simple link-based switcher without JavaScript */
.wppc-type-links .wppc-currency-links {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.wppc-currency-link {
	padding: 8px 16px;
	border: 1px solid #ddd;
	border-radius: 4px;
	background: #fff;
	cursor: pointer;
	font-size: 14px;
	text-decoration: none;
	color: inherit;
	transition: all 0.2s;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.wppc-currency-link:hover {
	background: #f5f5f5;
	border-color: #999;
	text-decoration: none;
}

.wppc-currency-link.active {
	background: #0073aa;
	color: #fff;
	border-color: #0073aa;
	font-weight: 600;
}

.wppc-currency-link .wppc-flag {
	font-size: 18px;
}

/* Menu Type - Like Polylang language switcher */
.wppc-menu-item .wppc-flag {
	font-size: 16px;
	margin-right: 5px;
}

.wppc-menu-item.menu-item-has-children > a .sub-arrow {
	display: inline-block;
	margin-left: 5px;
	vertical-align: middle;
}

.wppc-menu-item.menu-item-has-children > a .sub-arrow svg {
	width: 10px;
	height: 10px;
	fill: currentColor;
}

.wppc-menu-item .sub-menu {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	background: #fff;
	border: 1px solid #ddd;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	min-width: 150px;
	z-index: 9999;
}

.wppc-menu-item:hover > .sub-menu {
	display: block;
}

.wppc-menu-item .sub-menu li {
	list-style: none;
	margin: 0;
	padding: 0;
}

.wppc-menu-item .sub-menu a {
	display: block;
	padding: 10px 15px;
	color: inherit;
	text-decoration: none;
	transition: background 0.2s;
}

.wppc-menu-item .sub-menu a:hover {
	background: #f5f5f5;
}

.wppc-menu-item .sub-menu .current-currency a {
	background: #e8f5e9;
	color: #2e7d32;
	font-weight: 600;
}

/* Elementor specific styles for menu type */
.elementor-nav-menu .wppc-menu-item > a {
	display: flex;
	align-items: center;
	gap: 5px;
}

.elementor-nav-menu .wppc-menu-item .sub-menu {
	list-style: none;
	padding: 0;
	margin: 0;
}

/* RTL Support */
[dir="rtl"] .wppc-currency-toggle .wppc-arrow {
	margin-left: 0;
	margin-right: auto;
}


