/* ==========================================================================
   WP SEO Translator — Premium Language Switcher Styles
   Inspired by Apple/Google Modern Design Systems
   ========================================================================== */

:root {
	/* Colors */
	--wpseot-ink: #111827;           /* Deep dark text */
	--wpseot-ink-light: #4b5563;     /* Subtle text */
	--wpseot-ink-muted: #9ca3af;     /* Disabled/Muted */
	--wpseot-surface: #ffffff;       /* Pure white items */
	--wpseot-surface-hover: #f3f4f6; /* Soft gray hover */
	--wpseot-border: rgba(0, 0, 0, 0.08); /* Very subtle border */
	--wpseot-border-hover: rgba(0, 0, 0, 0.15); 
	--wpseot-primary: #0066cc;       /* Apple Blue */
	--wpseot-primary-bg: #eef6ff;    /* Soft blue tint */
	
	/* Shadows */
	--wpseot-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
	--wpseot-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
	--wpseot-shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);
	--wpseot-focus-ring: 0 0 0 3px rgba(0, 102, 204, 0.25);
	
	/* Metrics */
	--wpseot-radius-sm: 6px;
	--wpseot-radius-md: 10px;
	--wpseot-radius-lg: 14px;
	--wpseot-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
	
	/* Typography */
	--wpseot-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* ---- Shared base ---- */
.wpseot-lang-switcher {
	display: inline-flex;
	align-items: center;
	flex-wrap: wrap;
	font-family: var(--wpseot-font);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* ===================== List Style ===================== */
.wpseot-lang-switcher--list {
	list-style: none;
	margin: 0;
	padding: 0;
	gap: 8px;
}

.wpseot-lang-switcher--list .wpseot-lang-item {
	display: inline-block;
}

.wpseot-lang-switcher--list .wpseot-lang-link {
	display: inline-block;
	padding: 6px 14px;
	border: 1px solid var(--wpseot-border);
	border-radius: var(--wpseot-radius-md);
	text-decoration: none;
	color: var(--wpseot-ink-light);
	background: var(--wpseot-surface);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.5;
	box-shadow: var(--wpseot-shadow-sm);
	transition: all var(--wpseot-transition);
}

.wpseot-lang-switcher--list .wpseot-lang-link:hover,
.wpseot-lang-switcher--list .wpseot-lang-link:focus {
	background: var(--wpseot-surface-hover);
	color: var(--wpseot-ink);
	border-color: var(--wpseot-border-hover);
	outline: none;
	transform: translateY(-1px);
}

.wpseot-lang-switcher--list .wpseot-lang-link:focus-visible {
	box-shadow: var(--wpseot-focus-ring);
}

.wpseot-lang-switcher--list .wpseot-lang-current {
	display: inline-block;
	padding: 6px 14px;
	border: 1px solid var(--wpseot-primary);
	border-radius: var(--wpseot-radius-md);
	background-color: var(--wpseot-primary-bg);
	color: var(--wpseot-primary);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.5;
	cursor: default;
}

/* ===================== Flags Style ===================== */
.wpseot-lang-switcher--flags {
	list-style: none;
	margin: 0;
	padding: 0;
	gap: 10px;
}

.wpseot-lang-switcher--flags .wpseot-lang-item {
	display: inline-block;
}

.wpseot-lang-switcher--flags .wpseot-lang-link,
.wpseot-lang-switcher--flags .wpseot-lang-current {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	border-radius: var(--wpseot-radius-sm);
	text-decoration: none;
	font-size: 14px;
	font-weight: 500;
	transition: all var(--wpseot-transition);
}

.wpseot-lang-switcher--flags .wpseot-lang-link {
	color: var(--wpseot-ink-light);
	border: 1px solid transparent;
}

.wpseot-lang-switcher--flags .wpseot-lang-link:hover {
	background: var(--wpseot-surface-hover);
	color: var(--wpseot-ink);
}

.wpseot-lang-switcher--flags .wpseot-lang-item--active .wpseot-lang-current {
	color: var(--wpseot-ink);
	font-weight: 600;
	background: var(--wpseot-surface);
	box-shadow: var(--wpseot-shadow-sm);
	border: 1px solid var(--wpseot-border);
}

/* ===================== Dropdown Style ===================== */
.wpseot-lang-switcher--dropdown {
	display: inline-block;
}

.wpseot-lang-select {
	appearance: none;
	-webkit-appearance: none;
	padding: 8px 36px 8px 14px;
	border: 1px solid var(--wpseot-border);
	border-radius: var(--wpseot-radius-md);
	background-color: var(--wpseot-surface);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234b5563' 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 12px center;
	font-size: 14px;
	font-weight: 500;
	color: var(--wpseot-ink);
	font-family: var(--wpseot-font);
	cursor: pointer;
	min-width: 150px;
	box-shadow: var(--wpseot-shadow-sm);
	transition: all var(--wpseot-transition);
}

.wpseot-lang-select:hover {
	border-color: var(--wpseot-border-hover);
	box-shadow: var(--wpseot-shadow-md);
}

.wpseot-lang-select:focus-visible {
	border-color: var(--wpseot-primary);
	outline: none;
	box-shadow: var(--wpseot-focus-ring);
}

/* RTL: flip dropdown arrow */
[dir="rtl"] .wpseot-lang-select {
	background-position: left 12px center;
	padding-left: 36px;
	padding-right: 14px;
}

/* ===================== Pills Style ===================== */
.wpseot-lang-switcher--pills {
	display: inline-flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
}

.wpseot-pill {
	display: inline-block;
	padding: 6px 16px;
	border-radius: 9999px; /* Absolute pill shape */
	font-size: 14px;
	font-weight: 500;
	line-height: 1.5;
	text-decoration: none;
	color: var(--wpseot-ink-light);
	background: var(--wpseot-surface-hover);
	transition: all var(--wpseot-transition);
	cursor: pointer;
	border: 1px solid transparent;
}

.wpseot-pill:hover,
.wpseot-pill:focus-visible {
	background-color: #e5e7eb;
	color: var(--wpseot-ink);
	outline: none;
}

.wpseot-pill:focus-visible {
	box-shadow: var(--wpseot-focus-ring);
}

.wpseot-pill--active {
	background-color: var(--wpseot-ink);
	color: var(--wpseot-surface);
	cursor: default;
	font-weight: 600;
	box-shadow: var(--wpseot-shadow-sm);
}
.wpseot-pill--active:hover {
	background-color: var(--wpseot-ink); /* Prevent hover effect on active */
	color: var(--wpseot-surface);
}


/* ===================== Minimal Style ===================== */
.wpseot-lang-switcher--minimal {
	display: inline-flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0;
}

.wpseot-minimal-link {
	text-decoration: none;
	color: var(--wpseot-ink-light);
	font-size: 14px;
	font-weight: 500;
	transition: color var(--wpseot-transition);
	padding: 4px 6px;
	border-radius: var(--wpseot-radius-sm);
}

.wpseot-minimal-link:hover,
.wpseot-minimal-link:focus-visible {
	color: var(--wpseot-ink);
	background: var(--wpseot-surface-hover);
	outline: none;
}

.wpseot-minimal-current {
	color: var(--wpseot-ink);
	font-size: 14px;
	font-weight: 600;
	padding: 4px 6px;
}

.wpseot-minimal-sep {
	color: var(--wpseot-ink-muted);
	font-size: 12px;
	padding: 0 4px;
	user-select: none;
}

/* ===================== Button Bar Style ===================== */
/* Redesigned as an iOS Segmented Control */
.wpseot-lang-switcher--button-bar {
	display: inline-flex;
	align-items: center;
	background: #f3f4f6; /* Track background */
	padding: 4px;
	border-radius: var(--wpseot-radius-md);
	box-shadow: inset 0 1px 2px rgba(0,0,0,0.05); /* Recessed track shadow */
}

.wpseot-bar-btn {
	display: inline-block;
	padding: 6px 18px;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.4;
	color: var(--wpseot-ink-light);
	background: transparent;
	border: none;
	border-radius: calc(var(--wpseot-radius-md) - 2px);
	text-decoration: none;
	transition: all var(--wpseot-transition);
	white-space: nowrap;
	cursor: pointer;
}

.wpseot-bar-btn:hover,
.wpseot-bar-btn:focus-visible {
	color: var(--wpseot-ink);
	outline: none;
}
.wpseot-bar-btn:focus-visible {
	box-shadow: var(--wpseot-focus-ring);
	background: rgba(255,255,255,0.5);
}

.wpseot-bar-btn--active {
	background: var(--wpseot-surface);
	color: var(--wpseot-ink);
	font-weight: 600;
	box-shadow: var(--wpseot-shadow-sm), 0 0 0 1px rgba(0,0,0,0.02);
	cursor: default;
}

.wpseot-bar-btn--active:hover {
	background: var(--wpseot-surface);
	color: var(--wpseot-ink);
}

/* ===================== Globe Style ===================== */
.wpseot-lang-switcher--globe {
	display: inline-block;
	position: relative;
}

.wpseot-globe-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	border: 1px solid var(--wpseot-border);
	border-radius: 9999px; /* Pill trigger */
	background: var(--wpseot-surface);
	color: var(--wpseot-ink);
	font-size: 14px;
	font-family: var(--wpseot-font);
	font-weight: 500;
	cursor: pointer;
	box-shadow: var(--wpseot-shadow-sm);
	transition: all var(--wpseot-transition);
	line-height: 1.4;
}

.wpseot-globe-btn:hover,
.wpseot-globe-btn:focus-visible {
	box-shadow: var(--wpseot-shadow-md);
	transform: translateY(-1px);
	outline: none;
}
.wpseot-globe-btn:focus-visible {
	box-shadow: var(--wpseot-shadow-md), var(--wpseot-focus-ring);
}

.wpseot-globe-btn[aria-expanded="true"] {
	background-color: var(--wpseot-surface-hover);
	box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
	transform: none;
}

.wpseot-globe-icon {
	flex-shrink: 0;
	stroke: var(--wpseot-ink-light);
}

.wpseot-globe-caret {
	flex-shrink: 0;
	transition: transform var(--wpseot-transition);
	color: var(--wpseot-ink-muted);
}

.wpseot-globe-btn[aria-expanded="true"] .wpseot-globe-caret {
	transform: rotate(180deg);
}

/* Glassmorphism Popup Panel */
.wpseot-globe-panel {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	z-index: 9999;
	min-width: 180px;
	list-style: none;
	margin: 0;
	padding: 8px; /* Padding for inner items */
	background: rgba(255, 255, 255, 0.95);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	border: 1px solid var(--wpseot-border);
	border-radius: var(--wpseot-radius-lg);
	box-shadow: var(--wpseot-shadow-lg);
	opacity: 1;
	transform: translateY(0) scale(1);
	transform-origin: top left;
	transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.wpseot-globe-panel[hidden] {
	display: none;
	opacity: 0;
	transform: translateY(-8px) scale(0.96);
	pointer-events: none;
}

/* Handle opening cleanly using JS swapping hidden -> display block */
.wpseot-globe-item {
	margin: 0;
}

.wpseot-globe-link,
.wpseot-globe-current {
	display: block;
	padding: 8px 12px;
	font-size: 14px;
	font-weight: 500;
	text-decoration: none;
	color: var(--wpseot-ink);
	border-radius: calc(var(--wpseot-radius-lg) - 4px);
	transition: background-color var(--wpseot-transition), color var(--wpseot-transition);
	white-space: nowrap;
}

.wpseot-globe-link:hover,
.wpseot-globe-link:focus-visible {
	background-color: var(--wpseot-surface-hover);
	color: var(--wpseot-ink);
	outline: none;
}

.wpseot-globe-item--active .wpseot-globe-current {
	font-weight: 600;
	color: var(--wpseot-primary);
	background-color: var(--wpseot-primary-bg);
}

/* RTL: flip the globe panel to open on the right side */
[dir="rtl"] .wpseot-globe-panel {
	left: auto;
	right: 0;
	transform-origin: top right;
}

[dir="rtl"] .wpseot-globe-panel[hidden] {
	transform: translateY(-8px) scale(0.96);
}


/* ===================== Responsive ===================== */
@media screen and (max-width: 600px) {
	.wpseot-lang-switcher--list,
	.wpseot-lang-switcher--flags,
	.wpseot-lang-switcher--pills {
		flex-direction: column;
		align-items: stretch;
	}

	.wpseot-lang-switcher--list .wpseot-lang-link,
	.wpseot-lang-switcher--list .wpseot-lang-current,
	.wpseot-lang-switcher--flags .wpseot-lang-link,
	.wpseot-lang-switcher--flags .wpseot-lang-current,
	.wpseot-pill {
		text-align: center;
		display: block;
		width: 100%;
	}

	.wpseot-lang-select {
		width: 100%;
	}

	.wpseot-globe-panel {
		left: 0;
		right: 0;
		min-width: unset;
		transform-origin: top center;
	}
}
