/* Editor de textos por idioma — se carga solo en modo edición. */

:root {
	--tto-barra: 44px;
	/* Lo que ocupa la barra de WordPress, si la hay. Lo mide el editor al arrancar. */
	--tto-arriba: 0px;
	--tto-total: calc(var(--tto-arriba) + var(--tto-barra));
}

tto-t {
	display: contents;
}

.tto-barra,
.tto-panel,
.tto-marco,
.tto-aviso {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	box-sizing: border-box;
}

.tto-barra *,
.tto-panel * {
	box-sizing: border-box;
}

/* ---------- barra superior ---------- */
.tto-barra {
	position: fixed;
	top: var(--tto-arriba);
	left: 0;
	right: 0;
	z-index: 2147483000;
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 0 1rem;
	height: var(--tto-barra);
	background: #0E4034;
	color: #fff;
	font-size: 13px;
	box-shadow: 0 1px 8px rgba(0, 0, 0, .25);
}

.tto-barra b {
	font-weight: 600;
}

.tto-barra .tto-idioma {
	background: #EF7A5D;
	color: #21160f;
	font-weight: 700;
	padding: .15rem .5rem;
	border-radius: 3px;
	letter-spacing: .02em;
}

.tto-barra .tto-ayuda {
	opacity: .8;
}

.tto-barra .tto-espacio {
	margin-left: auto;
}

.tto-barra button {
	background: transparent;
	border: 1px solid rgba(255, 255, 255, .45);
	color: #fff;
	border-radius: 3px;
	padding: .3rem .7rem;
	font-size: 12px;
	cursor: pointer;
}

.tto-barra button:hover,
.tto-barra button:focus,
.tto-barra button:focus-visible {
	background: rgba(255, 255, 255, .12);
	color: #fff;
}

/*
 * WordPress también empuja el documento con `html{margin-top:32px!important}` para su
 * propia barra. Nuestra regla es más específica y gana, así que aquí se reserva el sitio
 * de las dos: la de WordPress arriba y la del editor justo debajo.
 */
html.tto-activo {
	margin-top: var(--tto-total) !important;
}

/* ---------- cabeceras que se quedan pegadas arriba ---------- */
/*
 * Un elemento con position:fixed no se entera del margen que le ponemos al documento:
 * se quedaría justo debajo de la barra, tapado. La cabecera de este sitio se pega con el
 * «sticky» de Elementor, que le escribe un `top` en línea; de ahí el !important.
 * La clase la pone el editor solo en los elementos que se anclan al borde superior, para
 * no tocar los que se anclan abajo.
 */
html.tto-activo .tto-bajado {
	top: var(--tto-total) !important;
}

/* ---------- resaltado del texto bajo el cursor ---------- */
.tto-marco {
	position: absolute;
	z-index: 2147482000;
	pointer-events: none;
	border-radius: 2px;
	outline: 2px solid #EF7A5D;
	outline-offset: 1px;
	background: rgba(239, 122, 93, .12);
	transition: opacity .1s ease;
}

.tto-marco[hidden] {
	display: none;
}

/* Texto que ya tiene un cambio guardado.
   Con display:contents el elemento no genera caja y no se podría pintar el fondo,
   así que solo estos pasan a inline, y únicamente mientras se está editando. */
html:not(.tto-edicion-off) tto-t.tto-editado {
	display: inline;
	background: rgba(239, 122, 93, .16);
	box-shadow: 0 1px 0 #EF7A5D;
	border-radius: 2px;
}

/* ---------- panel lateral ---------- */
.tto-panel {
	position: fixed;
	top: var(--tto-total);
	right: 0;
	bottom: 0;
	width: min(420px, 100vw);
	z-index: 2147483001;
	background: #fff;
	color: #14201d;
	border-left: 1px solid #d8e0de;
	box-shadow: -6px 0 24px rgba(0, 0, 0, .12);
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform .18s ease;
}

.tto-panel.tto-abierto {
	transform: translateX(0);
}

.tto-panel header {
	padding: 1rem 1.1rem .8rem;
	border-bottom: 1px solid #e8eeec;
	display: flex;
	align-items: baseline;
	gap: .5rem;
}

.tto-panel header h2 {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	color: #0E4034;
}

.tto-panel header .tto-cerrar:hover,
.tto-panel header .tto-cerrar:focus,
.tto-panel header .tto-cerrar:focus-visible {
	background: #eef2f1;
	color: #14201d;
	border-radius: 3px;
}

.tto-panel header .tto-cerrar {
	margin-left: auto;
	background: none;
	border: 0;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	color: #6b7b78;
	padding: 0 .2rem;
}

.tto-cuerpo {
	padding: 1rem 1.1rem;
	overflow-y: auto;
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.tto-campo > label,
.tto-campo > .tto-etiqueta {
	display: block;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: .07em;
	color: #6b7b78;
	margin-bottom: .35rem;
	font-weight: 600;
}

.tto-referencia {
	background: #f4f7f6;
	border: 1px solid #e3eae8;
	border-radius: 4px;
	padding: .55rem .7rem;
	font-size: 13px;
	line-height: 1.45;
	color: #43524f;
	max-height: 120px;
	overflow-y: auto;
	white-space: pre-wrap;
	word-break: break-word;
}

.tto-referencia.tto-vacia {
	color: #93a2a0;
	font-style: italic;
}

.tto-panel textarea {
	width: 100%;
	min-height: 110px;
	border: 1px solid #c9d6d3;
	border-radius: 4px;
	padding: .6rem .7rem;
	font-size: 14px;
	line-height: 1.5;
	font-family: inherit;
	resize: vertical;
	color: #14201d;
}

.tto-panel textarea:focus {
	outline: 2px solid #0E4034;
	outline-offset: -1px;
	border-color: #0E4034;
}

.tto-opciones {
	display: flex;
	flex-direction: column;
	gap: .4rem;
}

.tto-opcion {
	text-transform: none;
	letter-spacing: normal;
	font-weight: 400;
	color: #14201d;
	display: flex;
	align-items: flex-start;
	gap: .5rem;
	font-size: 13px;
	line-height: 1.4;
	padding: .5rem .6rem;
	border: 1px solid #e3eae8;
	border-radius: 4px;
	cursor: pointer;
}

.tto-opcion:hover {
	border-color: #b9cbc7;
}

.tto-opcion input {
	margin: .18rem 0 0;
	accent-color: #0E4034;
}

.tto-opcion.tto-elegida {
	border-color: #0E4034;
	background: #f2f7f5;
}

.tto-opcion > span {
	font-weight: 600;
}

.tto-opcion small {
	display: block;
	font-weight: 400;
	color: #6b7b78;
	font-size: 11.5px;
	margin-top: .1rem;
}

.tto-pie {
	padding: .85rem 1.1rem;
	border-top: 1px solid #e8eeec;
	display: flex;
	gap: .5rem;
	align-items: center;
	background: #fbfcfc;
}

/*
 * Todo estado de los botones se declara aquí, fondo y color incluidos.
 *
 * El tema (hello-biz) trae `button:hover, button:focus { background-color:#c36; color:#fff }`,
 * que es más específico que nuestra regla base: cualquier estado que dejemos sin definir lo
 * acaba pintando él — de ahí el fondo morado al pasar por «Abrir el enlace». Va también
 * `:focus`, no solo `:focus-visible`, porque si no el botón se quedaba morado tras el clic.
 */
.tto-pie button {
	font-size: 13px;
	border-radius: 4px;
	padding: .55rem .9rem;
	cursor: pointer;
	border: 1px solid transparent;
	font-family: inherit;
	text-transform: none;
	letter-spacing: normal;
	text-decoration: none;
	box-shadow: none;
	transition: background .12s ease, border-color .12s ease;
}

.tto-pie button:hover,
.tto-pie button:focus,
.tto-pie button:focus-visible {
	box-shadow: none;
	text-decoration: none;
}

.tto-guardar {
	background: #0E4034;
	color: #fff;
	font-weight: 600;
}

.tto-guardar:hover,
.tto-guardar:focus,
.tto-guardar:focus-visible {
	background: #15594a;
	color: #fff;
}

.tto-guardar[disabled],
.tto-guardar[disabled]:hover,
.tto-guardar[disabled]:focus {
	background: #0E4034;
	color: #fff;
	opacity: .55;
	cursor: default;
}

.tto-restaurar {
	background: #fff;
	border-color: #c9d6d3;
	color: #43524f;
}

.tto-restaurar:hover,
.tto-restaurar:focus,
.tto-restaurar:focus-visible {
	background: #f4f7f6;
	border-color: #9aaeaa;
	color: #43524f;
}

.tto-cancelar {
	background: none;
	color: #6b7b78;
	margin-left: auto;
}

.tto-cancelar:hover,
.tto-cancelar:focus,
.tto-cancelar:focus-visible {
	background: #eef2f1;
	color: #14201d;
}

/* ---------- aviso flotante ---------- */
.tto-aviso {
	position: fixed;
	bottom: 1.2rem;
	left: 50%;
	transform: translateX(-50%) translateY(8px);
	z-index: 2147483002;
	background: #0E4034;
	color: #fff;
	padding: .6rem 1rem;
	border-radius: 4px;
	font-size: 13px;
	opacity: 0;
	pointer-events: none;
	transition: opacity .15s ease, transform .15s ease;
	box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
}

.tto-aviso.tto-visible {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

.tto-aviso.tto-error {
	background: #9A3412;
}

@media (max-width: 600px) {
	.tto-panel {
		width: 100vw;
		top: auto;
		height: 70vh;
		bottom: 0;
		border-left: 0;
		border-top: 1px solid #d8e0de;
		transform: translateY(100%);
	}

	.tto-panel.tto-abierto {
		transform: translateY(0);
	}

	.tto-barra .tto-ayuda {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tto-panel,
	.tto-aviso,
	.tto-marco {
		transition: none;
	}
}

/* ---------- interruptor de la barra ---------- */
.tto-interruptor {
	display: inline-flex;
	align-items: center;
	gap: .5rem;
	cursor: pointer;
	user-select: none;
	font-size: 12px;
}

.tto-interruptor input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.tto-palanca {
	width: 34px;
	height: 19px;
	border-radius: 19px;
	background: rgba(255, 255, 255, .25);
	border: 1px solid rgba(255, 255, 255, .35);
	position: relative;
	flex: none;
	transition: background .15s ease;
}

.tto-palanca::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 13px;
	height: 13px;
	border-radius: 50%;
	background: #fff;
	transition: transform .15s ease;
}

.tto-interruptor input:checked + .tto-palanca {
	background: #EF7A5D;
	border-color: #EF7A5D;
}

.tto-interruptor input:checked + .tto-palanca::after {
	transform: translateX(15px);
}

.tto-interruptor input:focus-visible + .tto-palanca {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.tto-interruptor-texto {
	white-space: nowrap;
	font-weight: 600;
}

/* Con la edición apagada, el sitio se ve y se usa como siempre. */
html.tto-edicion-off tto-t.tto-editado {
	display: contents;
	background: none;
	box-shadow: none;
}

html.tto-edicion-off .tto-marco {
	display: none;
}

html.tto-edicion-off .tto-barra {
	background: #3B4A47;
}

/* Botón para seguir un enlace desde el panel */
.tto-enlace {
	background: #fff;
	border-color: #c9d6d3;
	color: #0E4034;
	font-weight: 500;
}

.tto-enlace:hover,
.tto-enlace:focus,
.tto-enlace:focus-visible {
	background: #f2f7f5;
	border-color: #0E4034;
	color: #0E4034;
}

@media (prefers-reduced-motion: reduce) {
	.tto-palanca,
	.tto-palanca::after {
		transition: none;
	}
}
