/* =====================================================================
   RedLang — language switcher + admin styles
   Front-end switcher inherits TeaLux --tl-* variables with safe fallbacks
   so it looks at home in the TeaLux theme but works on any theme.
   ===================================================================== */

/* ── Switcher ──────────────────────────────────────────────────── */
.redlang-switcher {
	position: relative; /* inline in normal flow; never fixed by default */
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 3px;
	border-radius: 999px;
	background: var(--tl-surface, rgba(0, 0, 0, 0.04));
	border: 1px solid var(--tl-border, rgba(0, 0, 0, 0.12));
	font-family: var(--tl-sans, "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif);
	line-height: 1;
	vertical-align: middle;
}

.redlang-pill {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 6px 12px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-decoration: none;
	color: var(--tl-text-2, #6b5f4e);
	background: transparent;
	border: 1px solid transparent;
	transition: color 0.25s ease, background-color 0.25s ease, border-color 0.25s ease;
	cursor: pointer;
	white-space: nowrap;
}

.redlang-pill:hover,
.redlang-pill:focus-visible {
	color: var(--tl-text, #1a1410);
	border-color: var(--tl-border, rgba(0, 0, 0, 0.18));
	outline: none;
}

.redlang-pill.is-active {
	color: #fff;
	background: var(--tl-gold, #a07830);
	border-color: var(--tl-gold, #a07830);
	cursor: default;
}

.redlang-pill.is-active:hover {
	color: #fff;
}

.redlang-flag {
	font-size: 14px;
	line-height: 1;
}

/* The switcher is inline by default. Opt into a floating, pinned position by
   rendering with context="float": redlang_switcher_html( array( 'context' => 'float' ) ). */
.redlang-switcher.redlang-ctx-float {
	position: fixed;
	top: 1rem;
	inset-inline-end: 1rem;
	z-index: 9999;
	box-shadow: 0 6px 22px rgba(0, 0, 0, 0.12);
}

.redlang-ctx-footer {
	display: flex;
	justify-content: center;
	margin: 28px auto;
}

/* ── Dropdown variant ──────────────────────────────────────────── */
.redlang-switcher.redlang-dropdown {
	position: relative;
	display: inline-block;
	background: transparent;
	border: none;
	padding: 0;
	border-radius: 0;
	gap: 0;
}

.redlang-current {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.35rem 0.7rem;
	background: transparent;
	border: 1px solid rgba(199, 154, 85, 0.3);
	border-radius: 20px;
	color: var(--tl-gold, #c79a55);
	cursor: pointer;
	font-family: inherit;
	font-size: 0.75rem;
	letter-spacing: 0.1em;
	line-height: 1;
	transition: all 0.2s;
}

.redlang-current:hover {
	border-color: var(--tl-gold, #c79a55);
	background: rgba(199, 154, 85, 0.08);
}

.redlang-arrow {
	font-size: 0.6rem;
	transition: transform 0.2s;
}

.redlang-dropdown.is-open .redlang-arrow {
	transform: rotate(180deg);
}

.redlang-dropdown-menu {
	display: none;
	position: absolute;
	top: calc(100% + 6px);
	inset-inline-end: 0;
	background: var(--tl-surface, #1a1610);
	border: 1px solid rgba(199, 154, 85, 0.2);
	border-radius: 12px;
	padding: 0.4rem;
	min-width: 120px;
	z-index: 9999;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.redlang-dropdown.is-open .redlang-dropdown-menu {
	display: block;
	animation: redlangFadeIn 0.2s ease;
}

@keyframes redlangFadeIn {
	from { opacity: 0; transform: translateY(-4px); }
	to   { opacity: 1; transform: translateY(0); }
}

.redlang-option {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.4rem 0.7rem;
	border-radius: 8px;
	text-decoration: none;
	color: var(--tl-text-2, #b0a090);
	font-size: 0.75rem;
	white-space: nowrap;
	transition: all 0.15s;
}

.redlang-option:hover,
.redlang-option:focus-visible {
	background: rgba(199, 154, 85, 0.1);
	color: var(--tl-gold, #c79a55);
	outline: none;
}

/* .redlang-dropdown forces position:relative, so re-assert fixed at higher
   specificity for the opt-in floating context. */
.redlang-switcher.redlang-dropdown.redlang-ctx-float {
	position: fixed;
}

/* ── RTL readiness ─────────────────────────────────────────────── */
[dir="rtl"] .redlang-switcher {
	direction: rtl;
}

[dir="rtl"] .redlang-pill {
	letter-spacing: 0;
}

/* ── Mobile ────────────────────────────────────────────────────── */
@media (max-width: 600px) {
	.redlang-switcher.redlang-ctx-float {
		top: 10px;
		inset-inline-end: 10px;
	}
	.redlang-pill {
		padding: 5px 10px;
		font-size: 12px;
	}
}

/* ── Admin screens ─────────────────────────────────────────────── */
.redlang-wrap .redlang-lang-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
	gap: 8px;
	max-width: 820px;
}

.redlang-lang-check {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	border: 1px solid #dcdcde;
	border-radius: 6px;
	background: #fff;
}

.redlang-lang-check code {
	color: #646970;
	background: #f0f0f1;
	padding: 1px 5px;
	border-radius: 3px;
}

.redlang-lang-tabs {
	margin-top: 14px;
}

.redlang-strings-table td.redlang-src {
	color: #50575e;
}

.redlang-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 600;
}

.redlang-badge-ok {
	background: #edfaef;
	color: #007017;
	border: 1px solid #b7e6c0;
}

.redlang-badge-no {
	background: #f6f7f7;
	color: #8c8f94;
	border: 1px solid #e0e0e0;
}

/* Side-by-side editor */
.redlang-editor .redlang-editor-lang {
	font-size: 0.6em;
	vertical-align: middle;
	color: #646970;
	margin-inline-start: 8px;
}

.redlang-field-pair {
	margin: 18px 0;
	padding: 16px;
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 8px;
}

.redlang-field-pair h3 {
	margin: 0 0 10px;
}

.redlang-cols {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 18px;
}

.redlang-col-label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #646970;
	margin-bottom: 6px;
}

.redlang-col-src textarea,
.redlang-col-src input {
	background: #f6f7f7;
}

.redlang-col-tr textarea,
.redlang-col-tr input {
	border-color: var(--tl-gold, #a07830);
}

@media (max-width: 782px) {
	.redlang-cols {
		grid-template-columns: 1fr;
	}
}

/* Export / Import screen */
.redlang-io-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
	max-width: 1000px;
	margin-top: 14px;
}

.redlang-io-card {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	padding: 18px 20px;
}

.redlang-io-card h2 {
	margin-top: 0;
}

.redlang-io-types {
	display: grid;
	gap: 6px;
	margin-bottom: 14px;
}

.redlang-io-pair {
	display: flex;
	align-items: flex-end;
	gap: 12px;
	flex-wrap: wrap;
}

.redlang-io-arrow {
	font-size: 18px;
	color: var(--tl-gold, #a07830);
	padding-bottom: 4px;
}

@media (max-width: 782px) {
	.redlang-io-grid {
		grid-template-columns: 1fr;
	}
}

/* UA content editor */
.redlang-ua-list {
	max-width: 1000px;
	margin-top: 10px;
}

.rl-content-row {
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 8px;
	margin-bottom: 8px;
	padding: 10px 14px;
}

.rl-content-head {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

.rl-content-head .rl-current-title {
	min-width: 160px;
}

.rl-content-head .rl-current-val {
	color: #646970;
	flex: 1;
	min-width: 200px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.rl-content-head .rl-edit-btn {
	margin-inline-start: auto;
}

.rl-editor {
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px dashed #dcdcde;
}

.rl-editor-label {
	display: block;
	font-weight: 600;
	font-size: 12px;
	color: #646970;
	margin-bottom: 4px;
}

.rl-save-status {
	margin-inline-start: 10px;
	font-size: 12px;
}

/* ── Accessibility & mobile comfort ─────────────────────────────── */
/* Visible keyboard focus (overrides the earlier outline:none resets). */
.redlang-current:focus-visible,
.redlang-option:focus-visible,
.redlang-pill:focus-visible {
	outline: 2px solid var(--tl-gold, #c79a55);
	outline-offset: 2px;
}

/* Never let the open menu run past a narrow viewport. */
.redlang-dropdown-menu {
	max-width: calc(100vw - 24px);
}

/* Comfortable touch targets inside the fixed mobile header. */
@media (pointer: coarse) {
	.redlang-current,
	.redlang-option {
		min-height: 40px;
	}
}
