/**
 * Super Translator — front-end, popup, switcher, edit controls (mobile-first).
 */

/* Language switcher */
.super-translator-switcher {
	font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	margin: 0.5rem 0;
	max-width: 100%;
}

.super-translator-switcher .st-sw__row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem 0.5rem;
	align-items: center;
}

.super-translator-switcher .st-sw__item {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.45rem 0.65rem;
	min-height: 44px;
	box-sizing: border-box;
	border-radius: 6px;
	border: 1px solid #c5d4e0;
	background: linear-gradient(180deg, #f6fafd 0%, #e8f0f8 100%);
	color: #1d2327;
	text-decoration: none;
	font-weight: 600;
	font-size: 0.9rem;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.super-translator-switcher .st-sw__item:hover,
.super-translator-switcher .st-sw__item:focus-visible {
	border-color: #2271b1;
	box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.2);
	outline: none;
}

.super-translator-switcher .st-sw__item.is-active {
	border-color: #d63638;
	background: linear-gradient(180deg, #fff5f5 0%, #fde8e8 100%);
}

.super-translator-switcher .st-sw__flag {
	display: inline-flex;
	align-items: center;
	line-height: 0;
	flex-shrink: 0;
}

.super-translator-switcher .st-flag-img {
	display: block;
	width: 22px;
	height: auto;
	max-height: 15px;
	object-fit: cover;
	border-radius: 2px;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.super-translator-switcher .st-flag-img--fallback {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 28px;
	height: 15px;
	padding: 0 4px;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.02em;
	background: #f0f0f1;
	border-radius: 2px;
	color: #1d2327;
}

.super-translator-switcher .st-sw__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.super-translator-switcher .st-sw__list li {
	margin: 0;
}

/* Compact custom dropdown */
.super-translator-switcher .st-dd {
	position: relative;
	display: inline-block;
	max-width: min(100%, 14rem);
	vertical-align: middle;
}

.super-translator-switcher .st-dd__btn {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	width: 100%;
	min-height: 40px;
	max-height: 44px;
	padding: 0.35rem 0.55rem;
	margin: 0;
	box-sizing: border-box;
	border: 1px solid #c5d4e0;
	border-radius: 8px;
	background: linear-gradient(180deg, #fff 0%, #f3f6f8 100%);
	color: #1d2327;
	font-size: 0.875rem;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	text-align: left;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.super-translator-switcher .st-dd__btn:hover,
.super-translator-switcher .st-dd__btn:focus-visible {
	border-color: #2271b1;
	box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.2);
	outline: none;
}

.super-translator-switcher .st-dd__flag {
	display: inline-flex;
	flex-shrink: 0;
	line-height: 0;
}

.super-translator-switcher .st-dd__flag .st-flag-img {
	width: 22px;
	max-height: 15px;
}

.super-translator-switcher .st-dd__txt {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.super-translator-switcher .st-dd__caret {
	flex-shrink: 0;
	width: 0;
	height: 0;
	margin-left: 0.15rem;
	border-left: 5px solid transparent;
	border-right: 5px solid transparent;
	border-top: 6px solid #50575e;
	opacity: 0.85;
}

.super-translator-switcher .st-dd__list {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	z-index: 200;
	margin: 0;
	padding: 0.25rem 0;
	list-style: none;
	max-height: min(50vh, 16rem);
	overflow-y: auto;
	background: #fff;
	border: 1px solid #c5d4e0;
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.super-translator-switcher .st-dd__li {
	margin: 0;
}

.super-translator-switcher .st-dd__opt {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	padding: 0.45rem 0.65rem;
	min-height: 40px;
	box-sizing: border-box;
	color: #1d2327;
	text-decoration: none;
	font-size: 0.875rem;
	font-weight: 500;
	transition: background 0.12s ease;
}

.super-translator-switcher .st-dd__opt:hover,
.super-translator-switcher .st-dd__opt:focus-visible {
	background: #f0f6fc;
	outline: none;
}

.super-translator-switcher .st-dd__opt.is-active {
	background: #fff5f5;
	font-weight: 700;
}

.super-translator-switcher .st-dd--flag-only .st-dd__btn {
	max-width: 6.5rem;
	justify-content: center;
}

.super-translator-switcher .st-dd--flag-only .st-dd__opt {
	justify-content: center;
}

.super-translator-switcher .st-dd__name {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.super-translator-switcher .st-sw__row .st-sw__item {
	min-height: 40px;
}

.super-translator-switcher .st-sw__item .st-flag-img {
	vertical-align: middle;
}

/* Legacy native select (if cached markup) */
.super-translator-switcher .st-sw__select {
	min-height: 48px;
	padding: 0.5rem 2rem 0.5rem 0.75rem;
	font-size: 1rem;
	max-width: 100%;
	border-radius: 6px;
	border: 1px solid #c5d4e0;
	background-color: #fff;
}

/* Editable host + icon */
.st-editable-host {
	position: relative;
	display: inline-block;
	max-width: 100%;
	vertical-align: baseline;
}

.st-editable-target {
	outline: 1px dashed rgba(34, 113, 177, 0.35);
	outline-offset: 2px;
	border-radius: 2px;
}

.st-edit-wrap {
	position: absolute;
	top: 0;
	right: 0;
	transform: translate(0.15rem, -0.35rem);
	z-index: 50;
	display: inline-flex;
	pointer-events: auto;
}

.st-editable-host .st-edit-wrap,
.st-editable-containing .st-edit-wrap {
	opacity: 0;
	transition: opacity 0.15s ease;
}

.st-editable-host:hover .st-edit-wrap,
.st-editable-host:focus-within .st-edit-wrap,
.st-editable-containing:hover .st-edit-wrap,
.st-editable-containing:focus-within .st-edit-wrap {
	opacity: 1;
}

.st-editable-containing {
	position: relative;
	padding-right: 2.75rem;
}

.st-editable-containing .st-edit-wrap {
	top: 0.15rem;
}

.st-edit-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	min-width: 40px;
	min-height: 40px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: linear-gradient(145deg, #2271b1 0%, #135e96 100%);
	color: #f0c930;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
	cursor: pointer;
}

.st-edit-btn:hover,
.st-edit-btn:focus-visible {
	background: linear-gradient(145deg, #d63638 0%, #b32d2e 100%);
	color: #fff;
	outline: 2px solid #f0c930;
	outline-offset: 2px;
}

.st-edit-icon {
	display: block;
}

/* Block-level hosts need room for the icon */
.st-editable-host--block {
	display: block;
	position: relative;
	padding-right: 2.75rem;
}

@media (hover: none) {
	.st-editable-host .st-edit-wrap,
	.st-editable-containing .st-edit-wrap {
		opacity: 0.9;
	}
}

/* Popup */
body.st-popup-open,
body.st-meta-popup-open {
	overflow: hidden;
}

/* Viewport-fixed wrapper so the button stays top-right (not theme layout). */
#st-other-fields-floater.st-other-fields-floater {
	position: fixed;
	top: 0;
	right: 0;
	left: auto;
	bottom: auto;
	width: 0;
	height: 0;
	margin: 0;
	padding: 0;
	overflow: visible;
	z-index: 100100;
	pointer-events: none;
}

#st-other-fields-floater .st-other-fields-btn {
	position: absolute;
	top: 12px;
	right: 12px;
	left: auto;
	bottom: auto;
	float: none;
	margin: 0;
	pointer-events: auto;
	max-width: min(100vw - 24px, 16rem);
	padding: 0.4rem 0.75rem;
	font-size: 0.8125rem;
	font-weight: 600;
	line-height: 1.3;
	border-radius: 6px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

body.admin-bar #st-other-fields-floater .st-other-fields-btn {
	top: 40px;
}

@media screen and (max-width: 782px) {
	body.admin-bar #st-other-fields-floater .st-other-fields-btn {
		top: 46px;
	}
}

.st-meta-lang-row .st-label-row {
	margin-bottom: 0.35rem;
}

.st-dialog--meta {
	max-width: min(100%, 640px);
}

.st-meta-intro {
	margin: 0 0 1rem;
	font-size: 0.9rem;
	color: #475569;
	line-height: 1.45;
}

.st-meta-field-block {
	margin-bottom: 1.5rem;
	padding-bottom: 1.25rem;
	border-bottom: 1px solid #e2e8f0;
}

.st-meta-field-block:last-child {
	border-bottom: 0;
	margin-bottom: 0;
	padding-bottom: 0;
}

.st-meta-field-title {
	margin: 0 0 0.5rem;
	font-size: 1rem;
	font-weight: 700;
	color: #0f172a;
}

.st-meta-source {
	margin: 0 0 0.75rem;
	font-size: 0.85rem;
	color: #64748b;
	word-break: break-word;
}

.st-meta-source-code {
	display: inline;
	font-size: 0.8rem;
	padding: 0.1rem 0.35rem;
	background: #f1f5f9;
	border-radius: 4px;
	max-width: 100%;
	word-break: break-all;
}

.st-meta-lang-row {
	margin-bottom: 0.75rem;
}

.st-meta-lang-row:last-child {
	margin-bottom: 0;
}

.st-meta-loading,
.st-meta-error,
.st-meta-empty {
	margin: 0;
	font-size: 0.95rem;
	color: #64748b;
}

.st-meta-error {
	color: #b91c1c;
}

.st-overlay {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	padding: 0;
	box-sizing: border-box;
}

@media (min-width: 600px) {
	.st-overlay {
		align-items: center;
		padding: 1rem;
	}
}

.st-overlay[hidden] {
	display: none !important;
}

.st-overlay__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.55);
	backdrop-filter: blur(2px);
}

.st-dialog {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 520px;
	max-height: min(92vh, 720px);
	overflow: auto;
	margin: 0;
	background: #fff;
	border-radius: 12px 12px 0 0;
	box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.25);
	display: flex;
	flex-direction: column;
	padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom)
		env(safe-area-inset-left);
}

@media (min-width: 600px) {
	.st-dialog {
		border-radius: 12px;
		max-height: 90vh;
	}
}

.st-dialog__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 1rem 1.1rem;
	border-bottom: 1px solid #e2e8f0;
	background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}

.st-dialog__title {
	margin: 0;
	font-size: 1.15rem;
	font-weight: 700;
	font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	color: #0f172a;
}

.st-dialog__close {
	background: transparent;
	border: none;
	font-size: 1.75rem;
	line-height: 1;
	cursor: pointer;
	color: #64748b;
	min-width: 44px;
	min-height: 44px;
	padding: 0;
	border-radius: 6px;
}

.st-dialog__close:hover,
.st-dialog__close:focus-visible {
	color: #d63638;
	background: #fef2f2;
	outline: none;
}

.st-dialog__body {
	padding: 1rem 1.1rem;
	overflow-y: auto;
	flex: 1;
}

.st-dialog__footer {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 0.5rem;
	padding: 0.85rem 1.1rem;
	border-top: 1px solid #e2e8f0;
	background: #f8fafc;
}

.st-dialog__footer .button {
	min-height: 44px;
	padding-left: 1rem;
	padding-right: 1rem;
}

.st-original-preview {
	padding: 0.65rem 0.75rem;
	background: #f1f5f9;
	border-radius: 8px;
	border: 1px solid #e2e8f0;
	font-size: 0.95rem;
	line-height: 1.45;
	word-break: break-word;
}

.st-label-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	margin-bottom: 0.35rem;
}

.st-label-row .st-label {
	margin-bottom: 0;
	flex: 1;
	min-width: 0;
}

.st-gtr-btn {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 1px solid #dadce0;
	border-radius: 10px;
	background: #fff;
	cursor: pointer;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.st-gtr-btn:hover,
.st-gtr-btn:focus-visible {
	border-color: #4285f4;
	box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
	outline: none;
}

.st-gtr-btn:disabled {
	opacity: 0.55;
	cursor: wait;
}

.st-gtr-btn .st-gtr-icon {
	display: block;
	width: 22px;
	height: 22px;
}

.st-label {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	font-weight: 600;
	margin-bottom: 0.35rem;
	font-size: 0.9rem;
	color: #334155;
}

.st-label__flag {
	display: inline-flex;
	align-items: center;
	vertical-align: middle;
	margin-right: 0.25rem;
	line-height: 0;
}

.st-label__flag .st-flag-img {
	width: 22px;
	max-height: 15px;
	border-radius: 2px;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.st-field {
	margin-bottom: 1rem;
}

.st-textarea {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	padding: 0.65rem 0.75rem;
	font-size: 1rem;
	line-height: 1.45;
	border-radius: 8px;
	border: 1px solid #cbd5e1;
	resize: vertical;
	min-height: 72px;
	font-family: inherit;
}

.st-textarea:focus-visible {
	border-color: #2271b1;
	box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.25);
	outline: none;
}

.screen-reader-text {
	clip: rect(1px, 1px, 1px, 1px);
	position: absolute !important;
	height: 1px;
	width: 1px;
	overflow: hidden;
	word-wrap: normal !important;
}
