/**
 * ANSC Bilingual Section Switcher — Scoped Frontend Styles
 *
 * Strictly scoped under `.ansc-bss`.
 * Inherits Flatsome typography, text colors, and theme variables (--fs-color-primary, --primary-color)
 * without overriding any global styles, backgrounds, headings, paragraphs, or buttons.
 */

.ansc-bss {
	--ansc-bss-primary: var(--fs-color-primary, var(--primary-color, currentColor));
	--ansc-bss-secondary: var(--fs-color-secondary, currentColor);
	--ansc-bss-gap: 12px;
	--ansc-bss-margin-bottom: 24px;
	--ansc-bss-btn-padding: 6px;
	--ansc-bss-btn-radius: 8px;
	--ansc-bss-flag-radius: 4px;
	--ansc-bss-border-width: 1px;
	--ansc-bss-inactive-opacity: 0.65;
	--ansc-bss-flag-width: 42px;
	--ansc-bss-ar-font: "Noto Kufi Arabic", sans-serif;

	display: block;
	width: 100%;
	max-width: 100%;
	background: transparent;
	color: inherit;
	box-sizing: border-box;
}

.ansc-bss *,
.ansc-bss *::before,
.ansc-bss *::after {
	box-sizing: border-box;
}

/* Size presets for flag SVG width (3:2 aspect ratio) */
.ansc-bss--size-sm {
	--ansc-bss-flag-width: 32px;
}

.ansc-bss--size-md {
	--ansc-bss-flag-width: 42px;
}

.ansc-bss--size-lg {
	--ansc-bss-flag-width: 54px;
}

/* Language Selector Bar */
.ansc-bss__selector {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: var(--ansc-bss-gap, 12px);
	margin: 0 0 var(--ansc-bss-margin-bottom, 24px) 0;
	padding: 0;
	list-style: none;
	background: transparent;
	direction: ltr;
}

.ansc-bss--align-left > .ansc-bss__selector {
	justify-content: flex-start;
}

.ansc-bss--align-center > .ansc-bss__selector {
	justify-content: center;
}

.ansc-bss--align-right > .ansc-bss__selector {
	justify-content: flex-end;
}

/* Flag Selector Button (isolated from Flatsome's content .button margins) */
.ansc-bss .ansc-bss__btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: var(--ansc-bss-btn-padding, 6px);
	min-height: 0;
	line-height: 1;
	background: var(--ansc-bss-btn-bg, transparent);
	color: inherit;
	border-style: solid;
	border-width: var(--ansc-bss-border-width, 1px);
	border-color: var(--ansc-bss-border-color, rgba(128, 128, 128, 0.28));
	border-radius: var(--ansc-bss-btn-radius, 8px);
	opacity: var(--ansc-bss-inactive-opacity, 0.65);
	cursor: pointer;
	box-shadow: none;
	text-transform: none;
	letter-spacing: normal;
	transition: opacity 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
	-webkit-appearance: none;
	appearance: none;
}

.ansc-bss .ansc-bss__btn:hover {
	opacity: 0.92;
	border-color: var(--ansc-bss-active-border-color, var(--ansc-bss-primary));
}

.ansc-bss .ansc-bss__btn:focus {
	outline: none;
}

.ansc-bss .ansc-bss__btn:focus-visible {
	opacity: 1;
	outline: 2px solid var(--ansc-bss-active-border-color, var(--ansc-bss-primary));
	outline-offset: 2px;
}

/* Active Flag Button States */
.ansc-bss .ansc-bss__btn.is-active {
	opacity: 1;
	background: var(--ansc-bss-active-btn-bg, var(--ansc-bss-btn-bg, transparent));
	border-color: var(--ansc-bss-active-border-color, var(--ansc-bss-primary));
}

/* Style 1: Subtle Border + Theme Primary Ring (Default) */
.ansc-bss--active-style-border_glow .ansc-bss__btn.is-active {
	box-shadow: 0 0 0 1px var(--ansc-bss-active-border-color, var(--ansc-bss-primary));
}

/* Style 2: Bottom Accent Indicator */
.ansc-bss--active-style-underline .ansc-bss__btn.is-active::after {
	content: "";
	position: absolute;
	left: 18%;
	right: 18%;
	bottom: -5px;
	height: 2.5px;
	border-radius: 2px;
	background-color: var(--ansc-bss-active-border-color, var(--ansc-bss-primary));
}

/* Style 3: Elevated Shadow + Crisp Border */
.ansc-bss--active-style-elevated .ansc-bss__btn.is-active {
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
	transform: translateY(-1px);
}

/* Style 4: Subtle Surface Tint + Border */
.ansc-bss--active-style-solid_tint .ansc-bss__btn.is-active {
	background: var(--ansc-bss-active-btn-bg, rgba(128, 128, 128, 0.08));
	box-shadow: 0 0 0 1px var(--ansc-bss-active-border-color, var(--ansc-bss-primary));
}

/* Flag SVG Wrapper & Graphic */
.ansc-bss__flag {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--ansc-bss-flag-width, 42px);
	aspect-ratio: 3 / 2;
	border-radius: var(--ansc-bss-flag-radius, 4px);
	overflow: hidden;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
	pointer-events: none;
}

.ansc-bss__flag-svg {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Accessible Screen Reader Text (fallback if theme does not define .screen-reader-text) */
.ansc-bss .screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}

/* Language Panels Container */
.ansc-bss__panels {
	display: block;
	width: 100%;
	max-width: 100%;
	background: transparent;
}

.ansc-bss__panel {
	display: none;
	width: 100%;
	max-width: 100%;
	background: transparent;
	color: inherit;
}

.ansc-bss__panel.is-active {
	display: block;
}

.ansc-bss__panel[hidden] {
	display: none !important;
}

/* Arabic Panel: RTL Direction & Noto Kufi Arabic Typography */
.ansc-bss__panel--ar {
	direction: rtl;
	text-align: right;
	font-family: var(--ansc-bss-ar-font, "Noto Kufi Arabic", sans-serif);
}

.ansc-bss__panel--ar :is(h1, h2, h3, h4, h5, h6, .heading-font, p, li, blockquote, a, span, label, input, textarea, select, button, .button) {
	font-family: var(--ansc-bss-ar-font, "Noto Kufi Arabic", sans-serif);
}

/* French Panel: LTR Direction & Native Flatsome Theme Typography Inheritance */
.ansc-bss__panel--fr {
	direction: ltr;
	text-align: left;
}

/* Ensure Flatsome alignment utility classes work inside both RTL and LTR panels */
.ansc-bss__panel .text-center {
	text-align: center;
}

.ansc-bss__panel .text-left {
	text-align: left;
}

.ansc-bss__panel .text-right {
	text-align: right;
}

/* RTL list padding adjustments inside Arabic container when site root is LTR */
.ansc-bss__panel--ar ul,
.ansc-bss__panel--ar ol {
	padding-right: 1.25em;
	padding-left: 0;
}

.ansc-bss__panel--fr ul,
.ansc-bss__panel--fr ol {
	padding-left: 1.25em;
	padding-right: 0;
}

/* Responsive Adjustments for Tablet & Mobile */
@media (max-width: 849px) {
	.ansc-bss {
		--ansc-bss-margin-bottom: 20px;
	}
}

@media (max-width: 549px) {
	.ansc-bss--size-md {
		--ansc-bss-flag-width: 38px;
	}

	.ansc-bss--size-lg {
		--ansc-bss-flag-width: 46px;
	}

	.ansc-bss__selector {
		gap: min(var(--ansc-bss-gap, 12px), 16px);
	}
}
