/**
 * Whelloglot Language Switcher Frontend Styles
 */

/* Base Switcher Styles */
.whlg-switcher {
	list-style: none;
	margin: 0;
	padding: 0;
	font-family: var(--whlg-font-family);
}

.whlg-switcher-item {
	margin: 0;
	padding: 0;
	display: inline-block;
}

.whlg-switcher a {
	text-decoration: none;
	transition: all var(--whlg-transition-base);
}

/* ===== STYLE 1: DROPDOWN (Default) ===== */
.whlg-switcher.whlg-style-dropdown {
	display: inline-block;
	width: auto;
}

.whlg-switcher.whlg-style-dropdown select {
	padding: 8px 12px;
	font-size: 14px;
	border: 1px solid var(--whlg-border);
	border-radius: var(--whlg-radius-md);
	background-color: var(--whlg-bg-primary);
	color: var(--whlg-text-primary);
	cursor: pointer;
	transition: all var(--whlg-transition-base);
	font-family: inherit;
	appearance: none;
	background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23364BFE' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
	background-repeat: no-repeat;
	background-position: right 8px center;
	background-size: 16px;
	padding-right: 32px;
}

.whlg-switcher.whlg-style-dropdown select:hover {
	border-color: var(--whlg-secondary);
	box-shadow: 0 0 0 3px rgba(32, 167, 251, 0.1);
}

.whlg-switcher.whlg-style-dropdown select:focus {
	outline: none;
	border-color: var(--whlg-primary);
	box-shadow: 0 0 0 3px var(--whlg-primary-light);
}

.whlg-switcher.whlg-style-dropdown option {
	padding: 8px;
	background-color: var(--whlg-bg-primary);
	color: var(--whlg-text-primary);
}

/* ===== STYLE 2: FLAGS (Icon Only) ===== */
.whlg-switcher.whlg-style-flags {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	align-items: center;
}

.whlg-switcher.whlg-style-flags .whlg-switcher-item a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 24px;
	width: 40px;
	height: 40px;
	border-radius: var(--whlg-radius-md);
	border: 2px solid transparent;
	line-height: 1;
	cursor: pointer;
	padding: 0;
	color: inherit;
}

.whlg-switcher.whlg-style-flags .whlg-switcher-item a:hover {
	transform: scale(1.15);
	border-color: var(--whlg-secondary);
}

.whlg-switcher.whlg-style-flags .whlg-switcher-item.whlg-active a {
	border-color: var(--whlg-primary);
	transform: scale(1.1);
	box-shadow: 0 0 0 3px var(--whlg-primary-light);
	background-color: var(--whlg-primary-light);
}

/* Hide text in flags style */
.whlg-switcher.whlg-style-flags .whlg-switcher-text {
	display: none;
}

/* ===== STYLE 3: LIST (Text + Flag) ===== */
.whlg-switcher.whlg-style-list {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	align-items: center;
}

.whlg-switcher.whlg-style-list .whlg-switcher-item {
	display: inline-flex;
	align-items: center;
	position: relative;
}

.whlg-switcher.whlg-style-list .whlg-switcher-item a {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	font-size: 14px;
	color: var(--whlg-text-secondary);
	border-radius: var(--whlg-radius-md);
	border: 1px solid transparent;
}

.whlg-switcher.whlg-style-list .whlg-switcher-item a:hover {
	color: var(--whlg-primary);
}

.whlg-switcher.whlg-style-list .whlg-switcher-item.whlg-active a {
	color: var(--whlg-primary);
	font-weight: var(--whlg-font-weight-semibold);
	background-color: var(--whlg-primary-light);
	border-color: var(--whlg-primary);
}

/* Separator between items */
.whlg-switcher.whlg-style-list .whlg-switcher-item:not(:last-child)::after {
	content: "|";
	position: absolute;
	right: -8px;
	color: var(--whlg-border);
}

/* Hide flag in list if show_flag="no" */
.whlg-switcher.whlg-style-list .whlg-switcher-item a .whlg-switcher-flag {
	display: inline-block;
	font-size: 16px;
	line-height: 1;
}

.whlg-switcher.whlg-style-list .whlg-switcher-item a .whlg-switcher-flag.whlg-hidden {
	display: none;
}

/* Hide text in list if show_text="no" */
.whlg-switcher.whlg-style-list .whlg-switcher-item a .whlg-switcher-text {
	display: inline;
}

.whlg-switcher.whlg-style-list .whlg-switcher-item a .whlg-switcher-text.whlg-hidden {
	display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
	.whlg-switcher.whlg-style-dropdown {
		width: 100%;
	}

	.whlg-switcher.whlg-style-dropdown select {
		width: 100%;
	}

	.whlg-switcher.whlg-style-flags {
		gap: 6px;
	}

	.whlg-switcher.whlg-style-flags .whlg-switcher-item a {
		width: 36px;
		height: 36px;
		font-size: 20px;
	}

	.whlg-switcher.whlg-style-list {
		gap: 8px;
	}

	.whlg-switcher.whlg-style-list .whlg-switcher-item a {
		padding: 4px 8px;
		font-size: 12px;
		gap: 4px;
	}

	.whlg-switcher.whlg-style-list .whlg-switcher-item a .whlg-switcher-flag {
		font-size: 14px;
	}
}

/* Accessibility: Focus visible */
.whlg-switcher a:focus-visible {
	outline: 2px solid var(--whlg-primary);
	outline-offset: 2px;
}

.whlg-switcher.whlg-style-dropdown select:focus-visible {
	outline: 2px solid var(--whlg-primary);
	outline-offset: 2px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
	.whlg-switcher.whlg-style-list .whlg-switcher-item:not(:last-child)::after {
		color: var(--whlg-border);
	}
}
