/*
 * LensPart — Design System "Kern" (precisão industrial).
 * Linguagem de instrumento de medição: grafite neutro, UM acento (laranja-segurança),
 * hairlines no lugar de gradientes/glows, tipografia Inter + IBM Plex Mono (dados).
 * Copyright (c) 2024-2026. Todos os direitos reservados.
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* ─── Variáveis de tema ──────────────────────────────────────────── */
:root,
body.tema-escuro {
    --fundo: #0A0A0A;
    --fundo-suave: #121212;
    --superficie: #1A1A1A;
    --superficie-2: #232323;
    --borda: #2C2C2C;
    --borda-forte: #3D3D3D;
    --texto: #FFFFFF;
    --texto-suave: #A6A6A6;
    --texto-fraco: #8C8C8C;
    --primaria: #E10613;
    --primaria-hover: #FF1F2B;
    --primaria-suave: rgba(225, 6, 19, .15);
    --secundaria: #D0D0D0;
    --secundaria-suave: rgba(208, 208, 208, .10);
    --ok: #36C26B;
    --ok-suave: rgba(54, 194, 107, .14);
    --atencao: #F5A623;
    --atencao-suave: rgba(245, 166, 35, .14);
    --erro: #FF4D4D;
    --erro-suave: rgba(255, 77, 77, .14);
    --grade: #1C1C1C;
    --sombra: 0 1px 0 var(--borda-forte), 0 8px 24px rgba(0, 0, 0, .45);
    --sombra-leve: 0 1px 2px rgba(0, 0, 0, .40);
    --raio-sm: 3px;
    --raio: 5px;
    --raio-md: 6px;
    --fonte-display: 'Inter', system-ui, -apple-system, sans-serif;
    --fonte-corpo: 'Inter', system-ui, -apple-system, sans-serif;
    --fonte-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;
}

body.tema-claro {
    --fundo: #FFFFFF;
    --fundo-suave: #F4F4F4;
    --superficie: #FFFFFF;
    --superficie-2: #F7F7F7;
    --borda: #E4E4E4;
    --borda-forte: #C9C9C9;
    --texto: #0A0A0A;
    --texto-suave: #555555;
    --texto-fraco: #6E6E6E;
    --primaria: #D60512;
    --primaria-hover: #B0040F;
    --primaria-suave: rgba(225, 6, 19, .08);
    --secundaria: #333333;
    --secundaria-suave: rgba(51, 51, 51, .06);
    --ok: #1E9E55;
    --ok-suave: rgba(30, 158, 85, .10);
    --atencao: #B7791F;
    --atencao-suave: rgba(183, 121, 31, .10);
    --erro: #D32F2F;
    --erro-suave: rgba(211, 47, 47, .10);
    --grade: #ECECEC;
    --sombra: 0 1px 0 var(--borda-forte), 0 8px 24px rgba(22, 23, 26, .10);
    --sombra-leve: 0 1px 2px rgba(22, 23, 26, .08);
}

/* ─── Base ───────────────────────────────────────────────────────── */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--fonte-corpo);
    font-size: 15px;
    line-height: 1.55;
    font-weight: 400;
    background: var(--fundo);
    color: var(--texto);
    font-feature-settings: 'cv11', 'ss01';
    -webkit-font-smoothing: antialiased;
    transition: background-color .2s linear, color .2s linear;
}

h1, h2, h3 { font-family: var(--fonte-display); font-weight: 600; letter-spacing: -.02em; line-height: 1.14; color: var(--texto); }

/* Wordmark tipográfico sólido (sem Exo 2, sem gradiente) */
.fonte-logo { font-family: var(--fonte-display); font-weight: 700; letter-spacing: -.02em; }

/* Rótulo/eyebrow técnico — assinatura da direção */
.eyebrow, .rotulo-secao {
    font-family: var(--fonte-mono); font-weight: 500; font-size: 11px;
    letter-spacing: .12em; text-transform: uppercase; color: var(--texto-fraco);
}
/* Dados de máquina (IDs, SKUs, %, medidas) em mono tabular */
.mono, .dado { font-family: var(--fonte-mono); font-variant-numeric: tabular-nums; }
/* Números que animam (count-up) não devem "pular" de largura durante a contagem */
[data-contar] { font-variant-numeric: tabular-nums; }

::selection { background: var(--primaria-suave); color: var(--texto); }

:focus-visible {
    outline: 2px solid var(--primaria);
    outline-offset: 2px;
    border-radius: var(--raio-sm);
}

/* Barra de rolagem discreta (hover neutro) */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: var(--fundo); }
::-webkit-scrollbar-thumb { background: var(--borda-forte); border-radius: var(--raio-sm); }
::-webkit-scrollbar-thumb:hover { background: var(--texto-fraco); }

/* ─── Utilitários temáticos (complementam o Tailwind) ────────────── */
.superficie       { background: var(--superficie); }
.superficie-2     { background: var(--superficie-2); }
.borda-tema       { border-color: var(--borda); }
.texto-tema       { color: var(--texto); }
.texto-suave      { color: var(--texto-suave); }
.texto-fraco      { color: var(--texto-fraco); }
.texto-primaria   { color: var(--primaria); }
.texto-secundaria { color: var(--secundaria); }
.texto-ok         { color: var(--ok); }
.texto-atencao    { color: var(--atencao); }
.texto-erro       { color: var(--erro); }
.fundo-suave      { background: var(--fundo-suave); }

/* Gradientes ABOLIDOS — agora sólidos (o acento aparece com parcimônia) */
.gradiente-marca { background: var(--primaria); }
.texto-gradiente {
    background: none;
    -webkit-background-clip: border-box;
    background-clip: border-box;
    -webkit-text-fill-color: currentColor;
    color: var(--texto);
}

/* ─── Cards e painéis ────────────────────────────────────────────── */
.card-seda {
    position: relative;
    background: var(--superficie);
    border: 1px solid var(--borda);
    border-radius: var(--raio-md);
    box-shadow: none;
    transition: border-color .14s ease, transform .14s ease, box-shadow .14s ease;
}
.card-seda:hover { border-color: var(--borda-forte); transform: translateY(-1px); box-shadow: var(--sombra-leve); }

/* Card de resultado: régua-âncora industrial (sem levitar, sem glow) */
.card-resultado:hover { border-color: var(--borda-forte); }
.card-resultado.identificado { border-left: 2px solid var(--primaria); }

/* ─── Botões ─────────────────────────────────────────────────────── */
.btn-primario {
    background: var(--primaria);
    color: #FFFFFF;
    font-family: var(--fonte-corpo);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: -.01em;
    border-radius: var(--raio-md);
    padding: 10px 18px;
    border: 1px solid transparent;
    box-shadow: none;
    transition: background-color .12s linear, transform .04s linear;
}
.btn-primario:hover:not(:disabled) { background: var(--primaria-hover); }
.btn-primario:active { transform: translateY(.5px); }
.btn-primario:disabled { background: var(--superficie-2); color: var(--texto-fraco); cursor: not-allowed; }
body.tema-claro .btn-primario { color: #fff; }

.btn-fantasma {
    background: transparent;
    border: 1px solid var(--borda-forte);
    color: var(--texto);
    font-family: var(--fonte-corpo);
    font-weight: 500;
    font-size: 14px;
    border-radius: var(--raio-md);
    padding: 10px 16px;
    transition: border-color .12s linear, background-color .12s linear, color .12s linear;
}
.btn-fantasma:hover { border-color: var(--texto-suave); background: var(--superficie-2); color: var(--texto); }

.btn-icone {
    padding: 8px;
    border-radius: var(--raio);
    color: var(--texto-suave);
    background: transparent;
    border: 1px solid transparent;
    transition: border-color .12s linear, background-color .12s linear, color .12s linear;
}
.btn-icone:hover { background: var(--superficie-2); border-color: var(--borda); color: var(--texto); }

/* Microinterações: feedback tátil de clique (press) — curto e mecânico */
.btn-fantasma, .btn-icone { transition: border-color .12s linear, background-color .12s linear, color .12s linear, transform .08s ease; }
.btn-primario:active, .btn-fantasma:active, .btn-icone:active { transform: scale(.97); }

/* ─── Navegação por abas (trilho com sublinhado-régua) ───────────── */
.aba-nav {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: 10px 14px;
    border-radius: 0;
    font-family: var(--fonte-corpo);
    font-size: 13px;
    font-weight: 500;
    color: var(--texto-suave);
    white-space: nowrap;
    background: none;
    border-bottom: 2px solid transparent;
    transition: color .12s linear, border-color .12s linear;
    text-decoration: none;
}
.aba-nav:hover { color: var(--texto); background: none; }
.aba-nav.ativa { color: var(--texto); background: none; border-bottom-color: var(--primaria); }

@media (max-width: 900px) {
    .aba-nav span { display: none; }
    .aba-nav { padding: 10px 10px; }
}

/* ─── Seletor de idioma ──────────────────────────────────────────── */
.btn-idioma {
    font-size: 1.1rem;
    padding: .3rem .45rem;
    border-radius: var(--raio-sm);
    opacity: .55;
    transition: opacity .12s linear, background-color .12s linear;
    line-height: 1;
}
.btn-idioma:hover { opacity: .9; }
.btn-idioma.ativo { opacity: 1; background: var(--superficie-2); }
.btn-idioma-mini { font-size: 1rem; padding: .2rem .3rem; }

/* ─── Formulários ────────────────────────────────────────────────── */
.campo-seda {
    width: 100%;
    background: var(--fundo);
    border: 1px solid var(--borda-forte);
    border-radius: var(--raio);
    padding: 9px 12px;
    font-size: 14px;
    font-family: var(--fonte-corpo);
    color: var(--texto);
    transition: border-color .12s linear, box-shadow .12s linear;
}
.campo-seda::placeholder { color: var(--texto-fraco); }
.campo-seda:focus {
    outline: none;
    border-color: var(--primaria);
    box-shadow: inset 0 0 0 1px var(--primaria);
}
select.campo-seda { cursor: pointer; }

/* Slider — thumb quadrado, sem halo */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 0;
    background: var(--borda);
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px; height: 16px;
    border-radius: var(--raio-sm);
    background: var(--primaria);
    cursor: pointer;
    border: 2px solid var(--superficie);
    box-shadow: none;
}

/* ─── Chips de filtro (retangular, neutro; acento só quando aplicado) */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: var(--raio-sm);
    font-family: var(--fonte-corpo);
    font-size: 12px;
    font-weight: 500;
    background: var(--superficie-2);
    color: var(--texto);
    border: 1px solid var(--borda);
    transition: border-color .12s linear, color .12s linear;
}
.chip:hover { border-color: var(--borda-forte); }
.chip.ativo { border-color: var(--primaria); color: var(--primaria); }
.chip button { color: var(--texto-fraco); }
.chip button:hover { color: var(--texto); }

/* ─── Badges (etiqueta de inventário: retangular, mono, contorno) ── */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 8px; border-radius: var(--raio-sm);
    font-family: var(--fonte-mono); font-size: 11px; font-weight: 600;
    letter-spacing: .04em; text-transform: uppercase;
    font-variant-numeric: tabular-nums;
    background: transparent; border: 1px solid currentColor;
}
.badge-ok      { color: var(--ok); }
.badge-atencao { color: var(--atencao); }
.badge-erro    { color: var(--erro); }
.badge-info    { color: var(--texto-suave); }

/* ─── Área de upload (tracejado fino, sem scale) ─────────────────── */
.area-upload {
    border: 1px dashed var(--borda-forte);
    border-radius: var(--raio-md);
    background: var(--fundo);
    transition: border-color .12s linear, background-color .12s linear;
    cursor: pointer;
}
.area-upload:hover, .area-upload.arrastando {
    border-color: var(--primaria);
    background: var(--superficie-2);
}

/* ─── Barra de progresso (reta, sólida) ──────────────────────────── */
.trilha-progresso {
    height: 4px;
    background: var(--borda);
    border-radius: 0;
    overflow: hidden;
}
.barra-progresso {
    height: 100%;
    width: 0;
    border-radius: 0;
    background: var(--primaria);
    transition: width .3s linear;
}

/* ─── Modais ─────────────────────────────────────────────────────── */
.sobreposicao-modal {
    position: fixed; inset: 0; z-index: 80;
    background: rgba(6, 7, 9, .7);
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
    animation: aparecer .18s linear;
}
.caixa-modal {
    background: var(--superficie);
    border: 1px solid var(--borda-forte);
    border-radius: var(--raio-md);
    box-shadow: var(--sombra);
    width: 100%;
    max-width: 30rem;
    animation: subir .2s cubic-bezier(.2, 0, 0, 1);
}
.caixa-modal-larga {
    max-width: 72rem;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Barra flutuante de seleção para comparar */
.barra-comparar {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    transform: translateX(-50%) translateY(140%);
    z-index: 90;
    display: flex;
    align-items: center;
    gap: .9rem;
    background: var(--superficie-2);
    border: 1px solid var(--borda-forte);
    border-radius: var(--raio-md);
    padding: .55rem .7rem .55rem 1.2rem;
    box-shadow: var(--sombra);
    transition: transform .3s cubic-bezier(.2, 0, 0, 1), opacity .2s linear;
    opacity: 0;
    max-width: calc(100vw - 2rem);
}
.barra-comparar.visivel {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Checkbox de comparar sobreposto na imagem do card */
.check-comparar {
    position: absolute;
    top: .55rem;
    left: .55rem;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem .6rem;
    border-radius: var(--raio-sm);
    font-size: .72rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    color: #fff;
    background: rgba(6, 7, 9, .66);
    border: 1px solid rgba(255, 255, 255, .18);
    transition: background .12s linear, border-color .12s linear;
}
.check-comparar:hover { background: rgba(6, 7, 9, .82); }
.check-comparar input { accent-color: var(--primaria); width: 1rem; height: 1rem; cursor: pointer; }
.check-comparar.marcado {
    background: var(--primaria);
    border-color: var(--primaria);
    color: #FFFFFF;
}

/* Coluna individual do comparativo */
.grade-comparar {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    overflow: auto;
    padding: .25rem;
}
.col-comparar {
    display: flex;
    flex-direction: column;
    gap: .65rem;
    min-width: 0;
}

/* Lente de zoom (magnifier) */
.zoom-area {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: var(--raio-md);
    overflow: hidden;
    background: var(--superficie-2);
    border: 1px solid var(--borda);
    cursor: crosshair;
    touch-action: none;
}
.zoom-area img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.zoom-lente {
    position: absolute;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 2px solid var(--primaria);
    box-shadow: var(--sombra);
    background-repeat: no-repeat;
    pointer-events: none;
    opacity: 0;
    transition: opacity .12s linear;
    z-index: 4;
}
.zoom-area.ativa .zoom-lente { opacity: 1; }
.dica-zoom {
    position: absolute;
    bottom: .5rem;
    right: .5rem;
    z-index: 3;
    font-size: .7rem;
    color: #fff;
    background: rgba(6, 7, 9, .62);
    border-radius: var(--raio-sm);
    padding: .2rem .6rem;
    pointer-events: none;
}
@media (max-width: 640px) {
    .zoom-lente { width: 110px; height: 110px; }
}

/* ─── Toasts (LED-quadrado de status à esquerda) ─────────────────── */
#recipienteToast {
    position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 100;
    display: flex; flex-direction: column; gap: .6rem;
}
.toast {
    display: flex; align-items: center; gap: 10px;
    background: var(--superficie-2);
    border: 1px solid var(--borda-forte);
    border-radius: var(--raio);
    padding: 12px 16px;
    font-size: 14px;
    box-shadow: var(--sombra);
    animation: deslizar .25s cubic-bezier(.2, 0, 0, 1);
    max-width: 22rem;
}
.toast::before {
    content: '';
    width: 8px; height: 8px; flex: none;
    border-radius: var(--raio-sm);
    background: var(--primaria);
}
.toast.ok::before   { background: var(--ok); }
.toast.erro::before { background: var(--erro); }
.toast.saindo { animation: sumir .25s linear forwards; }

/* ─── Indicador "ao vivo" (LED piscando em step seco) ────────────── */
.ponto-pulso {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--ok);
    position: relative;
}
.ponto-pulso::after {
    content: '';
    position: absolute; inset: 0;
    border-radius: 50%;
    background: var(--ok);
    animation: piscar-status 1s steps(1) infinite;
}
@keyframes piscar-status { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }

/* ─── Tour guiado ────────────────────────────────────────────────── */
.tour-destaque {
    position: relative;
    z-index: 95 !important;
    box-shadow: 0 0 0 2px var(--primaria), 0 0 0 9999px rgba(6, 7, 9, .72);
    border-radius: var(--raio-md);
}
.tour-tooltip {
    position: fixed; z-index: 96;
    background: var(--superficie);
    border: 1px solid var(--borda-forte);
    border-radius: var(--raio-md);
    padding: 1.1rem 1.3rem;
    max-width: 20rem;
    box-shadow: var(--sombra);
    animation: subir .2s cubic-bezier(.2, 0, 0, 1);
}

/* ─── Fundo técnico (papel milimetrado por pontos — substitui blobs) */
.blob { display: none !important; }
.grade-fundo {
    position: absolute; inset: 0;
    background-image: radial-gradient(var(--grade) 1px, transparent 1px);
    background-size: 24px 24px;
    opacity: .5;
    mask-image: radial-gradient(ellipse at center, black 35%, transparent 78%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 35%, transparent 78%);
}

/* ─── Animações (mecânicas, curtas) ──────────────────────────────── */
@keyframes aparecer  { from { opacity: 0; } to { opacity: 1; } }
@keyframes subir     { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes deslizar  { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes sumir     { to { opacity: 0; transform: translateX(16px); } }

.animar-entrada { animation: subir .4s cubic-bezier(.2, 0, 0, 1) both; }
.animar-entrada-lenta { animation: subir .6s cubic-bezier(.2, 0, 0, 1) both; }

/* Esqueleto de carregamento — varredura cinza de 1 passe (sem shimmer colorido) */
.img-resultado {
    background: linear-gradient(100deg, var(--superficie-2) 40%, var(--borda) 50%, var(--superficie-2) 60%);
    background-size: 200% 100%;
    animation: varredura 1.3s linear infinite;
}
.img-resultado.carregada { animation: none; background: var(--superficie-2); }
@keyframes varredura { to { background-position-x: -200%; } }

/* ─── Leaflet (ajustes de tema) ──────────────────────────────────── */
.leaflet-container { background: var(--fundo-suave) !important; border-radius: var(--raio-md); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
    background: var(--superficie) !important;
    color: var(--texto) !important;
    border: 1px solid var(--borda);
}

/* ─── Slides (demonstração) ──────────────────────────────────────── */
.slide {
    position: absolute; inset: 0;
    display: none;
    align-items: center; justify-content: center;
    padding: 4rem 2rem;
}
.slide.ativo { display: flex; animation: aparecer .35s linear; }

/* ─── Vitrine ────────────────────────────────────────────────────── */
/* Título hero: sólido, hierarquia por peso/tamanho (sem gradiente animado) */
.texto-gradiente-animado {
    background: none;
    -webkit-background-clip: border-box;
    background-clip: border-box;
    -webkit-text-fill-color: currentColor;
    color: var(--texto);
    animation: none;
}

/* Card de destaque — realce por borda, sem glow colorido */
.card-brilho:hover { border-color: var(--borda-forte); }

/* Revelação ao rolar (progressiva — só em navegadores com suporte) */
@supports (animation-timeline: view()) {
    .revelar {
        animation: subir linear both;
        animation-timeline: view();
        animation-range: entry 0% entry 45%;
    }
}

/* Marquee de setores atendidos */
.faixa-marquee { overflow: hidden; position: relative; mask-image: linear-gradient(90deg, transparent, black 12%, black 88%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, black 12%, black 88%, transparent); }
.faixa-marquee .trilho {
    display: flex; gap: 1rem; width: max-content;
    animation: rolar-marquee 32s linear infinite;
}
.faixa-marquee:hover .trilho { animation-play-state: paused; }
@keyframes rolar-marquee { to { transform: translateX(-50%); } }
.chip-setor {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .5rem 1rem; border-radius: var(--raio-sm);
    border: 1px solid var(--borda);
    background: var(--superficie);
    font-size: .85rem; color: var(--texto-suave);
    white-space: nowrap;
}

/* Seletor de idioma (dropdown compacto) */
.seletor-idioma {
    background: var(--superficie);
    border: 1px solid var(--borda);
    border-radius: var(--raio-sm);
    color: var(--texto-suave);
    font-size: .8rem;
    padding: .45rem .6rem;
    cursor: pointer;
    transition: border-color .12s linear;
}
.seletor-idioma:hover { border-color: var(--borda-forte); }
.seletor-idioma:focus-visible { border-color: var(--borda-forte); outline: 2px solid var(--primaria); outline-offset: 2px; }
.seletor-idioma:focus:not(:focus-visible) { outline: none; }

/* ─── Acessibilidade ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
