/**
 * Tuiuti — Letreiro Inteligente
 * Estilos do front-end. Todas as cores/medidas vêm de variáveis CSS
 * geradas pelo painel administrativo (ver TL_Frontend::css_vars()).
 */

.tl-letreiro {
	--tl-item-cor: transparent;
	position: relative;
	display: block;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	overflow: hidden;
	background: var(--tl-fundo, #0b3a5f);
	color: var(--tl-cor-texto, #fff);
	min-height: var(--tl-altura, 46px);
	border: var(--tl-borda, none);
	border-radius: var(--tl-raio, 0);
	box-shadow: var(--tl-sombra, none);
	z-index: var(--tl-zindex, 9999);
	font-family: var(--tl-fonte-familia, inherit);
	font-size: var(--tl-fonte-tamanho, 15px);
	font-weight: var(--tl-fonte-peso, 600);
	letter-spacing: var(--tl-letter-spacing, 0.2px);
	line-height: 1.2;
	contain: layout paint;
}

.tl-letreiro.tl-fixo {
	position: sticky;
	top: 0;
}

.admin-bar .tl-letreiro.tl-fixo {
	top: 32px;
}

@media screen and (max-width: 782px) {
	.admin-bar .tl-letreiro.tl-fixo {
		top: 46px;
	}
}

/* ---------- Viewport e trilha ---------- */

.tl-viewport {
	position: relative;
	overflow: hidden;
	width: 100%;
	height: var(--tl-altura, 46px);
	display: flex;
	align-items: center;
	-webkit-mask-image: linear-gradient(
		to right,
		transparent 0,
		#000 28px,
		#000 calc(100% - 28px),
		transparent 100%
	);
	mask-image: linear-gradient(
		to right,
		transparent 0,
		#000 28px,
		#000 calc(100% - 28px),
		transparent 100%
	);
}

.tl-track {
	display: flex;
	align-items: center;
	flex-wrap: nowrap;
	white-space: nowrap;
	will-change: transform;
	transform: translate3d(0, 0, 0);
	backface-visibility: hidden;
}

.tl-seq {
	display: inline-flex;
	align-items: center;
	flex-wrap: nowrap;
	white-space: nowrap;
	flex: 0 0 auto;
}

/* ---------- Item ---------- */

.tl-item {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	flex: 0 0 auto;
	white-space: nowrap;
	padding: 0 2px;
}

.tl-icone {
	font-size: 1.12em;
	line-height: 1;
	flex: 0 0 auto;
	font-family:
		"Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Android Emoji",
		sans-serif;
	font-weight: 400;
}

.tl-selo {
	display: inline-block;
	flex: 0 0 auto;
	font-size: 0.72em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--tl-item-cor, rgba(255, 255, 255, 0.18));
	color: #fff;
	line-height: 1.5;
}

.tl-item[style*="--tl-item-cor"] .tl-selo {
	background: var(--tl-item-cor);
}

.tl-texto {
	color: inherit;
	text-decoration: none;
}

a.tl-texto {
	text-decoration: underline;
	text-underline-offset: 3px;
	text-decoration-thickness: 1px;
	text-decoration-color: rgba(255, 255, 255, 0.45);
}

a.tl-texto:hover,
a.tl-texto:focus {
	text-decoration-color: currentColor;
}

/* Separador entre itens */
.tl-sep {
	display: inline-block;
	flex: 0 0 auto;
	width: var(--tl-gap, 48px);
	height: var(--tl-altura, 46px);
	position: relative;
}

.tl-sep::before {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--tl-cor-separador, rgba(255, 255, 255, 0.35));
}

/* ---------- Cores por tipo ---------- */

.tl-tipo-clima .tl-icone {
	filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.25));
}

.tl-tipo-comemorativa .tl-texto {
	font-weight: 700;
}

.tl-tipo-emergencia {
	background: var(--tl-cor-alerta, #c62828);
	color: #fff;
	padding: 4px 14px;
	border-radius: 999px;
	font-weight: 800;
}

.tl-tipo-emergencia .tl-selo {
	background: rgba(0, 0, 0, 0.28);
}

/* ---------- Modo emergência ---------- */

.tl-modo-emergencia {
	background: var(--tl-cor-alerta, #c62828) !important;
}

.tl-modo-emergencia .tl-tipo-emergencia {
	background: rgba(0, 0, 0, 0.22);
}

.tl-letreiro.tl-pulsar.tl-modo-emergencia::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: rgba(255, 255, 255, 0.12);
	opacity: 0;
	animation: tl-pulso 1.8s ease-in-out infinite;
}

@keyframes tl-pulso {
	0%,
	100% {
		opacity: 0;
	}
	50% {
		opacity: 1;
	}
}

/* ---------- Botão pausar ---------- */

.tl-btn-pausa {
	position: absolute;
	right: 6px;
	top: 50%;
	transform: translateY(-50%);
	width: 26px;
	height: 26px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.22);
	color: inherit;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 0.18s ease, background 0.18s ease;
	z-index: 3;
}

.tl-letreiro:hover .tl-btn-pausa,
.tl-btn-pausa:focus-visible {
	opacity: 1;
}

.tl-btn-pausa:hover {
	background: rgba(0, 0, 0, 0.38);
}

.tl-btn-pausa:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.tl-icone-pausa {
	display: block;
	width: 8px;
	height: 10px;
	border-left: 3px solid currentColor;
	border-right: 3px solid currentColor;
}

.tl-btn-pausa[aria-pressed="true"] .tl-icone-pausa {
	width: 0;
	height: 0;
	border: 0;
	border-left: 9px solid currentColor;
	border-top: 6px solid transparent;
	border-bottom: 6px solid transparent;
	margin-left: 3px;
}

/* ---------- Acessibilidade ---------- */

.tl-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- Animação de entrada ---------- */

.tl-anim-fade {
	animation: tl-fade-in 0.45s ease both;
}

.tl-anim-slide {
	animation: tl-slide-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes tl-fade-in {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes tl-slide-in {
	from {
		opacity: 0;
		transform: translateY(-100%);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ---------- Responsivo ---------- */

@media (max-width: 782px) {
	.tl-letreiro {
		font-size: var(--tl-fonte-tamanho-mobile, 13px);
		min-height: var(--tl-altura-mobile, 40px);
	}

	.tl-viewport {
		height: var(--tl-altura-mobile, 40px);
		-webkit-mask-image: linear-gradient(
			to right,
			transparent 0,
			#000 14px,
			#000 calc(100% - 14px),
			transparent 100%
		);
		mask-image: linear-gradient(
			to right,
			transparent 0,
			#000 14px,
			#000 calc(100% - 14px),
			transparent 100%
		);
	}

	.tl-sep {
		height: var(--tl-altura-mobile, 40px);
		width: calc(var(--tl-gap, 48px) * 0.7);
	}

	.tl-selo {
		font-size: 0.68em;
		padding: 1px 6px;
	}

	.tl-btn-pausa {
		opacity: 1;
		width: 22px;
		height: 22px;
	}
}

/* ---------- Preferência por menos movimento ---------- */

@media (prefers-reduced-motion: reduce) {
	.tl-letreiro[data-tl-reduzido="1"] .tl-track {
		transform: none !important;
	}

	.tl-letreiro[data-tl-reduzido="1"] .tl-viewport {
		overflow-x: auto;
		scrollbar-width: thin;
	}

	.tl-letreiro.tl-anim-fade,
	.tl-letreiro.tl-anim-slide {
		animation: none;
	}

	.tl-letreiro.tl-pulsar.tl-modo-emergencia::after {
		animation: none;
		opacity: 0.35;
	}
}

/* ---------- Impressão ---------- */

@media print {
	.tl-letreiro {
		display: none;
	}
}

/* ---------- Estado de carregamento ---------- */

.tl-letreiro[data-tl-pronto="0"] .tl-track {
	opacity: 0.001;
}

.tl-letreiro[data-tl-pronto="1"] .tl-track {
	opacity: 1;
	transition: opacity 0.25s ease;
}
