/**
 * HGC Multilingual - Frontend Styles
 *
 * Language switcher and RTL adjustments.
 *
 * @package HGC_Multilingual
 * @since   1.0.0
 */

/* ==========================================================================
   Language Switcher - Dropdown
   ========================================================================== */

.hgc-lang-switcher {
	position: relative;
	display: inline-flex;
	align-items: center;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	font-size: 14px;
	line-height: 1.4;
	z-index: 9999;
}

/* Toggle Button */
.hgc-lang-switcher__toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	border: 1px solid rgba(124, 58, 237, 0.15);
	border-radius: 8px;
	background: rgba(124, 58, 237, 0.06);
	color: inherit;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.hgc-lang-switcher__toggle:hover,
.hgc-lang-switcher__toggle:focus-visible {
	background: rgba(124, 58, 237, 0.12);
	border-color: rgba(124, 58, 237, 0.25);
	box-shadow: 0 2px 8px rgba(124, 58, 237, 0.1);
	outline: none;
}

.hgc-lang-switcher__arrow {
	width: 10px;
	height: 6px;
	transition: transform 0.2s ease;
}

.hgc-lang-switcher__toggle[aria-expanded="true"] .hgc-lang-switcher__arrow {
	transform: rotate(180deg);
}

/* Flag */
.hgc-lang-switcher__flag {
	display: inline-flex;
	align-items: center;
	flex-shrink: 0;
}

.hgc-lang-switcher__flag svg,
.hgc-lang-switcher__flag .hgc-flag {
	display: block;
	width: 20px;
	height: 14px;
	border-radius: 2px;
	box-shadow: 0 0 1px rgba(0, 0, 0, 0.2);
}

/* Code */
.hgc-lang-switcher__code {
	text-transform: uppercase;
	font-weight: 600;
	letter-spacing: 0.5px;
}

/* Dropdown Menu */
.hgc-lang-switcher__menu {
	position: absolute;
	top: calc(100% + 4px);
	right: 0;
	min-width: 160px;
	margin: 0;
	padding: 6px 0;
	list-style: none;
	background: #fff;
	border-radius: 10px;
	box-shadow:
		0 4px 24px rgba(0, 0, 0, 0.12),
		0 1px 4px rgba(0, 0, 0, 0.08);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-8px);
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
	z-index: 10000;
}

.hgc-lang-switcher__menu--open {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.hgc-lang-switcher__item {
	list-style: none;
	margin: 0;
	padding: 0;
}

/* Link */
.hgc-lang-switcher__link {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 14px;
	color: #333;
	text-decoration: none;
	font-size: 14px;
	transition: background 0.15s ease;
}

.hgc-lang-switcher__link:hover,
.hgc-lang-switcher__link:focus-visible {
	background: #f5f0fa;
	color: #7E4FA9;
	text-decoration: none;
	outline: none;
}

.hgc-lang-switcher__item--active .hgc-lang-switcher__link {
	color: #7E4FA9;
	font-weight: 600;
	background: #f8f4fc;
}

/* Name */
.hgc-lang-switcher__name {
	flex: 1;
}

.hgc-lang-switcher__code-label {
	font-size: 11px;
	font-weight: 600;
	color: #999;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.hgc-lang-switcher__item--active .hgc-lang-switcher__code-label {
	color: #7E4FA9;
}


/* ==========================================================================
   Language Switcher - Inline
   ========================================================================== */

.hgc-lang-switcher--inline .hgc-lang-switcher__list {
	display: flex;
	align-items: center;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.hgc-lang-switcher--inline .hgc-lang-switcher__link {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 4px 8px;
	border-radius: 6px;
	font-size: 12px;
	font-weight: 500;
	color: rgba(255, 255, 255, 0.7);
	text-decoration: none;
	transition: color 0.2s ease, background 0.2s ease;
}

.hgc-lang-switcher--inline .hgc-lang-switcher__link:hover {
	color: #fff;
	background: rgba(255, 255, 255, 0.1);
}

.hgc-lang-switcher--inline .hgc-lang-switcher__item--active .hgc-lang-switcher__link {
	color: #fff;
	background: rgba(255, 255, 255, 0.15);
	font-weight: 600;
}

.hgc-lang-switcher--inline .hgc-lang-switcher__flag svg {
	width: 16px;
	height: 11px;
}


/* ==========================================================================
   RTL Adjustments
   ========================================================================== */

html[dir="rtl"] .hgc-lang-switcher__menu {
	right: auto;
	left: 0;
}

html[dir="rtl"] .hgc-lang-switcher__link {
	flex-direction: row-reverse;
}

html[dir="rtl"] .hgc-lang-switcher__toggle {
	flex-direction: row-reverse;
}

html[dir="rtl"] .hgc-lang-switcher--inline .hgc-lang-switcher__list {
	flex-direction: row-reverse;
}

html[dir="rtl"] .hgc-lang-switcher--inline .hgc-lang-switcher__link {
	flex-direction: row-reverse;
}


/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
	.hgc-lang-switcher__toggle {
		padding: 5px 10px;
		font-size: 12px;
	}

	.hgc-lang-switcher__flag svg {
		width: 18px;
		height: 12px;
	}

	.hgc-lang-switcher__menu {
		min-width: 140px;
	}

	.hgc-lang-switcher__link {
		padding: 7px 12px;
		font-size: 13px;
	}
}

@media (max-width: 380px) {
	.hgc-lang-switcher__name {
		display: none;
	}

	.hgc-lang-switcher__toggle {
		padding: 4px 8px;
	}
}
