/*
 * Jovem Lata Vision - tela receptora (balcão / TV).
 * Identidade automotiva dark: preto carbono, aço, faixa âmbar. Alto contraste e tipografia grande
 * (legível a metros de distância). Escopado em .jl-rx.
 */

html.jl-rx-open,
html.jl-rx-open body {
	overflow: hidden;
}

.jl-rx {
	--rx-bg: #08090b;
	--rx-panel: #12161b;
	--rx-panel-2: #181d24;
	--rx-line: #262d36;
	--rx-text: #f3f5f7;
	--rx-muted: #98a2b0;
	--rx-accent: #ffb300;
	--rx-ok: #22c55e;
	--rx-warn: #facc15;
	--rx-bad: #ef4444;

	position: fixed;
	inset: 0;
	z-index: 2147483000; /* Cobre cabeçalho do tema e barra de admin. */
	display: grid;
	grid-template-rows: auto auto minmax(0, 1fr);
	height: 100vh;
	height: 100dvh;
	padding: clamp(10px, 1.4vw, 24px);
	gap: clamp(8px, 1vw, 16px);
	/* Fibra de carbono sutil. */
	background:
		repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.018) 0 2px, transparent 2px 6px),
		radial-gradient(ellipse at top left, #151a21 0%, var(--rx-bg) 60%);
	color: var(--rx-text);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	font-size: clamp(15px, 1.15vw, 22px);
	line-height: 1.3;
	overflow: hidden;
	-webkit-font-smoothing: antialiased;
}

.jl-rx *,
.jl-rx *::before,
.jl-rx *::after {
	box-sizing: border-box;
}

.jl-rx [hidden] {
	display: none !important;
}

.jl-rx h1,
.jl-rx h2,
.jl-rx p,
.jl-rx dl,
.jl-rx dd,
.jl-rx dt,
.jl-rx ol,
.jl-rx figure {
	margin: 0;
	padding: 0;
}

.jl-rx button,
.jl-rx .jl-rx__btn {
	appearance: none;
	-webkit-appearance: none;
	margin: 0;
	border: 1px solid var(--rx-line);
	font: inherit;
	color: inherit;
	cursor: pointer;
}

.jl-rx :focus-visible {
	outline: 3px solid var(--rx-accent);
	outline-offset: 2px;
}

/* Topo ----------------------------------------------------------------- */

.jl-rx__top {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 0 0 clamp(8px, 1vw, 14px);
	border-bottom: 1px solid var(--rx-line);
}

/* Faixa de corrida âmbar sob o título. */
.jl-rx__top::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: -1px;
	width: clamp(120px, 16vw, 260px);
	height: 3px;
	background: linear-gradient(90deg, var(--rx-accent), transparent);
}

.jl-rx__brand {
	display: flex;
	align-items: baseline;
	gap: 14px;
	min-width: 0;
}

.jl-rx__logo {
	font-size: 1.5em;
	font-weight: 900;
	letter-spacing: 0.14em;
	color: var(--rx-accent);
}

.jl-rx__tela {
	padding: 2px 12px;
	border: 1px solid var(--rx-line);
	border-radius: 999px;
	background: var(--rx-panel);
	color: var(--rx-muted);
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.jl-rx__status {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--rx-muted);
	font-weight: 600;
}

.jl-rx__dot {
	width: 0.7em;
	height: 0.7em;
	border-radius: 50%;
	background: var(--rx-muted);
}

.jl-rx__status[data-estado="ao-vivo"] .jl-rx__dot {
	background: var(--rx-ok);
	box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
	animation: jl-rx-live 2s ease-out infinite;
}

.jl-rx__status[data-estado="ao-vivo"] { color: var(--rx-ok); }
.jl-rx__status[data-estado="offline"] .jl-rx__dot,
.jl-rx__status[data-estado="erro"] .jl-rx__dot { background: var(--rx-bad); }
.jl-rx__status[data-estado="offline"],
.jl-rx__status[data-estado="erro"] { color: var(--rx-bad); }

@keyframes jl-rx-live {
	0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
	70%, 100% { box-shadow: 0 0 0 0.6em rgba(34, 197, 94, 0); }
}

.jl-rx__actions {
	display: flex;
	gap: 10px;
}

.jl-rx__btn,
.jl-rx__actions button {
	min-height: 2.6em;
	padding: 0 1.1em;
	border-radius: 10px;
	background: var(--rx-panel-2);
	font-weight: 700;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.jl-rx__som[data-bloqueado="sim"] {
	border-color: var(--rx-accent);
	color: var(--rx-accent);
}

.jl-rx__btn--perigo {
	border-color: #5a2328;
}

.jl-rx__btn--perigo:hover {
	background: #3a161a;
}

.jl-rx__banner {
	padding: 10px 16px;
	border-left: 5px solid var(--rx-bad);
	border-radius: 8px;
	background: #2a1114;
	color: #ffd9db;
	font-weight: 600;
}

/* Corpo ---------------------------------------------------------------- */

.jl-rx__main {
	display: grid;
	grid-template-columns: minmax(0, 1fr) clamp(260px, 23vw, 440px);
	gap: clamp(10px, 1.2vw, 20px);
	min-height: 0;
}

.jl-rx__stage,
.jl-rx__hist {
	min-height: 0;
	border: 1px solid var(--rx-line);
	border-radius: 16px;
	background: var(--rx-panel);
}

.jl-rx__stage {
	display: grid;
	overflow: auto;
}

/* Vazio ---------------------------------------------------------------- */

.jl-rx__empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 24px;
	color: var(--rx-muted);
	text-align: center;
}

.jl-rx__empty p {
	color: var(--rx-text);
	font-size: 1.8em;
	font-weight: 800;
}

.jl-rx__empty-ico {
	width: 3.2em;
	height: 3.2em;
	border: 3px solid var(--rx-line);
	border-top-color: var(--rx-accent);
	border-radius: 50%;
	animation: jl-rx-spin 2.4s linear infinite;
}

@keyframes jl-rx-spin {
	to { transform: rotate(360deg); }
}

/* Peça atual ------------------------------------------------------------ */

.jl-rx__current {
	display: grid;
	grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
	grid-template-rows: minmax(0, 1fr) auto;
	gap: clamp(10px, 1.2vw, 20px);
	padding: clamp(10px, 1.2vw, 20px);
	border-radius: 16px;
}

.jl-rx__current.is-new {
	animation: jl-rx-new 1.4s ease-out;
}

@keyframes jl-rx-new {
	0% { box-shadow: inset 0 0 0 4px var(--rx-accent), 0 0 40px rgba(255, 179, 0, 0.35); }
	100% { box-shadow: inset 0 0 0 4px transparent, 0 0 0 transparent; }
}

.jl-rx__photo {
	position: relative;
	display: grid;
	place-items: center;
	min-height: 0;
	overflow: hidden;
	border: 1px solid var(--rx-line);
	border-radius: 14px;
	background: #000;
}

.jl-rx__img {
	width: 100%;
	height: 100%;
	max-height: 100%;
	object-fit: contain;
}

.jl-rx__nophoto {
	display: none;
	color: var(--rx-muted);
	font-weight: 700;
}

.jl-rx__photo.is-broken .jl-rx__img { display: none; }
.jl-rx__photo.is-broken .jl-rx__nophoto { display: block; }

.jl-rx__hora {
	position: absolute;
	right: 10px;
	bottom: 10px;
	padding: 2px 10px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.7);
	font-variant-numeric: tabular-nums;
	font-weight: 700;
}

.jl-rx__info {
	display: flex;
	flex-direction: column;
	gap: clamp(8px, 1vw, 16px);
	min-width: 0;
}

.jl-rx__badges {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.jl-rx__conf,
.jl-rx__estado {
	padding: 4px 14px;
	border-radius: 999px;
	font-weight: 800;
	letter-spacing: 0.02em;
}

.jl-rx__conf {
	border: 2px solid var(--rx-ok);
	background: rgba(34, 197, 94, 0.14);
	color: var(--rx-ok);
}

.jl-rx__conf[data-nivel="medio"] { border-color: var(--rx-warn); background: rgba(250, 204, 21, 0.14); color: var(--rx-warn); }
.jl-rx__conf[data-nivel="baixo"] { border-color: var(--rx-bad); background: rgba(239, 68, 68, 0.16); color: var(--rx-bad); }

.jl-rx__conf-pct {
	font-size: 1.3em;
	font-variant-numeric: tabular-nums;
}

.jl-rx__estado {
	border: 1px solid var(--rx-line);
	background: var(--rx-panel-2);
	color: var(--rx-text);
}

.jl-rx__estado[data-estado="avariada"] { border-color: var(--rx-bad); color: var(--rx-bad); }

.jl-rx__nome {
	font-size: clamp(1.8rem, 3.4vw, 4.2rem);
	font-weight: 900;
	line-height: 1.05;
	overflow-wrap: anywhere;
}

.jl-rx__fatos {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px 18px;
}

.jl-rx__fatos dt {
	color: var(--rx-muted);
	font-size: 0.72em;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.jl-rx__fatos dd {
	font-size: 1.3em;
	font-weight: 700;
	overflow-wrap: anywhere;
}

.jl-rx__oem {
	font-family: ui-monospace, "SF Mono", Consolas, monospace;
	letter-spacing: 0.05em;
}

.jl-rx__avaria {
	padding: 10px 14px;
	border-left: 5px solid var(--rx-bad);
	border-radius: 8px;
	background: rgba(239, 68, 68, 0.1);
}

.jl-rx__avaria strong {
	color: var(--rx-bad);
}

/* Bloco de estoque ------------------------------------------------------- */

.jl-rx__estoque {
	grid-column: 1 / -1;
	padding: clamp(12px, 1.2vw, 22px);
	border: 1px solid var(--rx-line);
	border-radius: 14px;
	background: var(--rx-panel-2);
}

.jl-rx__estoque h2 {
	font-size: 0.8em;
	font-weight: 800;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--rx-accent);
}

.jl-rx__estoque[data-achou="sim"] { border-color: rgba(255, 179, 0, 0.5); }
.jl-rx__estoque[data-achou="sim"] .jl-rx__nao-achou { display: none; }
.jl-rx__estoque[data-achou="nao"] .jl-rx__achou { display: none; }

.jl-rx__estoque[data-achou="nao"] {
	border: 2px solid var(--rx-bad);
	background: #2a1114;
}

.jl-rx__cad {
	margin-top: 4px;
	color: var(--rx-muted);
	overflow-wrap: anywhere;
}

.jl-rx__numeros {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: clamp(8px, 1vw, 18px);
	margin-top: 10px;
}

.jl-rx__num {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.jl-rx__num span {
	color: var(--rx-muted);
	font-size: 0.72em;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.jl-rx__num strong {
	font-size: clamp(1.6rem, 3.2vw, 3.6rem);
	font-weight: 900;
	font-variant-numeric: tabular-nums;
	line-height: 1.05;
	overflow-wrap: anywhere;
}

.jl-rx__num--preco strong { color: var(--rx-ok); }
.jl-rx__num--qtd[data-zero="sim"] strong { color: var(--rx-bad); }

.jl-rx__match {
	margin-top: 8px;
	color: var(--rx-muted);
	font-size: 0.85em;
}

.jl-rx__nao-achou h2 { color: #ff8f94; }

.jl-rx__nao-achou p {
	margin-top: 4px;
	font-size: 1.2em;
	font-weight: 700;
}

.jl-rx__cadastrar {
	margin-top: 12px;
	border-color: var(--rx-accent);
	background: var(--rx-accent);
	color: #000;
}

.jl-rx__cadastrar[aria-disabled="true"] {
	opacity: 0.45;
	cursor: not-allowed;
	pointer-events: none;
}

/* Histórico ---------------------------------------------------------------- */

.jl-rx__hist {
	display: flex;
	flex-direction: column;
	padding: clamp(10px, 1vw, 16px);
	overflow: hidden;
}

.jl-rx__hist h2 {
	margin-bottom: 10px;
	color: var(--rx-muted);
	font-size: 0.8em;
	font-weight: 800;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.jl-rx__hist-vazio {
	color: var(--rx-muted);
}

.jl-rx__lista {
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-height: 0;
	overflow-y: auto;
	list-style: none;
}

.jl-rx__h {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 8px;
	border-radius: 12px;
	background: var(--rx-panel-2);
	text-align: left;
}

.jl-rx__h[aria-current="true"] {
	border-color: var(--rx-accent);
	box-shadow: inset 4px 0 0 var(--rx-accent);
}

.jl-rx__h-thumb {
	flex: none;
	width: 3.4em;
	height: 3.4em;
	overflow: hidden;
	border-radius: 8px;
	background: #000;
}

.jl-rx__h-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.jl-rx__h-body {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-width: 0;
}

.jl-rx__h-body strong {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.jl-rx__h-body small {
	color: var(--rx-muted);
}

.jl-rx__h-dot {
	flex: none;
	width: 0.9em;
	height: 0.9em;
	border-radius: 50%;
	background: var(--rx-ok);
}

.jl-rx__h-dot[data-nivel="medio"] { background: var(--rx-warn); }
.jl-rx__h-dot[data-nivel="baixo"] { background: var(--rx-bad); }

/* Telas menores (notebook/tablet/celular) ----------------------------------- */

@media (max-width: 960px) {
	.jl-rx { overflow: auto; grid-template-rows: auto auto auto; height: 100dvh; }
	.jl-rx__main { grid-template-columns: 1fr; }
	.jl-rx__stage { overflow: visible; }
	.jl-rx__current { grid-template-columns: 1fr; grid-template-rows: auto; }
	.jl-rx__photo { aspect-ratio: 4 / 3; }
	.jl-rx__numeros { grid-template-columns: 1fr; }
	.jl-rx__top { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
	.jl-rx *,
	.jl-rx *::before,
	.jl-rx *::after {
		animation: none !important;
		transition: none !important;
	}
}

/* Aviso exibido a quem não pode ver a tela (reaproveita o estilo do leitor). */
.jl-leitor-aviso {
	padding: 16px;
	border-left: 4px solid #ffb300;
	background: #1c1c1e;
	color: #f4f4f5;
}

.jl-leitor-aviso a {
	color: #ffb300;
}
