/* ============================================================
   Aegea — Landing Page de Validacao de Paineis
   Peers Consulting & Technology
   Paleta e componentes alinhados ao review_paineis.html
   ============================================================ */

:root {
  --nv: #011334;   /* navy — header, fundo primario */
  --lm: #e1ff00;   /* lime — destaque Peers */
  --gn: #059669;   /* verde — automacao / sucesso */
  --rd: #dc2626;   /* vermelho — erro */
  --bg: #f8fafc;   /* fundo da pagina */
  --cd: #ffffff;   /* fundo de cards */
  --bd: #e2e8f0;   /* bordas */
  --tx: #1e293b;   /* texto principal */
  --mt: #64748b;   /* texto secundario / muted */
  --al: #ef4444;   /* vermelho — alertas */
  --al-bg: #fef2f2;/* fundo de linhas com alerta */
  --al-bg2: #fee2e2;/* hover de linhas com alerta */
  --aut-bg: #dbeafe;/* fundo pill automacao */
  --aut-tx: #1e40af;/* texto pill automacao */
  --dis-bg: #dcfce7;/* fundo pill distribuicao */
  --dis-tx: #166534;/* texto pill distribuicao */
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--tx);
  line-height: 1.5;
}

/* Wrapper interno que centraliza e limita largura do conteudo */
.inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ============================================================
   MODAL DE AUTENTICACAO
   ============================================================ */

#auth-overlay {
  position: fixed;
  inset: 0;
  background: var(--nv);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

#auth-overlay.oculto {
  display: none;
}

.auth-box {
  background: var(--cd);
  border-radius: 12px;
  padding: 40px 48px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo .marca {
  font-size: 13px;
  font-weight: 600;
  color: var(--mt);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.auth-logo .projeto {
  font-size: 22px;
  font-weight: 700;
  color: var(--nv);
  margin-top: 4px;
}

.auth-logo .projeto span {
  color: var(--gn);
}

.auth-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--mt);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.auth-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--bd);
  border-radius: 6px;
  font-size: 15px;
  color: var(--tx);
  outline: none;
  transition: border-color 0.15s;
}

.auth-input:focus {
  border-color: var(--nv);
}

.auth-btn {
  width: 100%;
  margin-top: 16px;
  padding: 11px;
  background: var(--nv);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.auth-btn:hover {
  background: #022060;
}

.auth-erro {
  margin-top: 10px;
  font-size: 12px;
  color: var(--rd);
  text-align: center;
  min-height: 16px;
}

/* ============================================================
   HEADER
   ============================================================ */

.hd {
  background: var(--nv);
  color: #fff;
}

.hd .inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 18px;
  padding-bottom: 18px;
}

.hd h1 {
  font-size: 19px;
  font-weight: 700;
}

.hd h1 span {
  color: var(--lm);
}

.hd-meta {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 3px;
}

.hd-peers {
  text-align: right;
  font-size: 11px;
  color: #94a3b8;
}

/* ============================================================
   CARDS DE ESTATISTICAS
   ============================================================ */

.stats {
  padding: 16px 0;
}

.stats .inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.card {
  background: var(--cd);
  border: 1px solid var(--bd);
  border-radius: 8px;
  padding: 14px 16px;
  text-align: center;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
  user-select: none;
}

.card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.card.ativo {
  border-color: var(--nv);
  box-shadow: 0 0 0 2px rgba(1,19,52,0.2);
}

.card-total {
  border-left: 4px solid var(--lm);
  cursor: default;
}

.card-automacao.ativo {
  border-color: var(--aut-tx);
  box-shadow: 0 0 0 2px rgba(30,64,175,0.2);
}

.card-distribuicao.ativo {
  border-color: var(--dis-tx);
  box-shadow: 0 0 0 2px rgba(146,64,14,0.2);
}

.card-alertas {
  border-left: 4px solid var(--al);
}

.card-alertas.ativo {
  border-color: var(--al);
  box-shadow: 0 0 0 2px rgba(245,158,11,0.25);
}

.card-valor {
  font-size: 26px;
  font-weight: 700;
  color: var(--nv);
}

.card-alertas .card-valor {
  color: var(--al);
}

.card-pct {
  font-size: 12px;
  color: var(--mt);
  margin-top: 1px;
}

.card-label {
  font-size: 10px;
  color: var(--mt);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* ============================================================
   BARRA DE FILTROS
   ============================================================ */

.filtros {
  padding: 8px 0 10px;
}

.filtros .inner {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.filtros-label {
  font-size: 11px;
  color: var(--mt);
  margin-right: 4px;
}

.fb {
  padding: 5px 13px;
  border-radius: 20px;
  border: 1px solid var(--bd);
  background: var(--cd);
  cursor: pointer;
  font-size: 12px;
  color: var(--tx);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  white-space: nowrap;
}

.fb:hover,
.fb.ativo {
  background: var(--nv);
  color: #fff;
  border-color: var(--nv);
}

.fb-automacao.ativo {
  background: var(--aut-tx);
  border-color: var(--aut-tx);
}

.fb-distribuicao.ativo {
  background: var(--dis-tx);
  border-color: var(--dis-tx);
}

.fb-alertas.ativo {
  background: var(--al);
  border-color: var(--al);
  color: #fff;
}

.fb-todos.ativo {
  background: var(--nv);
  border-color: var(--nv);
}

/* ============================================================
   TABELA DE PAINEIS
   ============================================================ */

.tabela-wrap {
  padding: 0 0 32px;
}

.tabela-wrap .inner {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

/* Larguras das colunas: Painel | Imagens | Classificacao | Justificativa | Elementos */
thead th:nth-child(1) { width: 80px; }
thead th:nth-child(2) { width: 230px; }
thead th:nth-child(3) { width: 115px; }
/* colunas 4 e 5 sem largura explicita: dividem o espaco restante igualmente */

thead th {
  background: var(--nv);
  color: #fff;
  padding: 9px 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 10;
  white-space: nowrap;
}

tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--bd);
  vertical-align: top;
  font-size: 13px;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

tbody tr.painel-row {
  cursor: pointer;
  transition: background 0.1s;
}

tbody tr.painel-row:hover {
  background: #f1f5f9;
}

/* Fundo das linhas por classificacao — mesma tonalidade da pill */
tbody tr.painel-row.cls-automacao {
  background: #eff6ff;
}

tbody tr.painel-row.cls-automacao:hover {
  background: var(--aut-bg);
}

tbody tr.painel-row.cls-distribuicao {
  background: #f0fdf4;
}

tbody tr.painel-row.cls-distribuicao:hover {
  background: var(--dis-bg);
}

/* Alertas em vermelho — declarado depois para sobrepor cls-automacao/distribuicao */
tbody tr.painel-row.tem-alerta {
  background: var(--al-bg);
}

tbody tr.painel-row.tem-alerta:hover {
  background: var(--al-bg2);
}

/* Linha de detalhe (expandivel) */
.detalhe-row {
  display: none;
}

.detalhe-row.aberto {
  display: table-row;
}

.detalhe-row td {
  background: #f9fafb;
  padding: 12px 16px;
  font-size: 12px;
  border-bottom: 2px solid var(--bd);
}

.detalhe-grid {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.detalhe-col {
  flex: 1;
  min-width: 200px;
}

.detalhe-col b {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--mt);
  margin-bottom: 4px;
}

.detalhe-justificativa {
  color: var(--tx);
  line-height: 1.4;
}

.detalhe-elementos {
  color: var(--mt);
  line-height: 1.5;
}

.alerta-bloco {
  margin-top: 8px;
  padding: 6px 10px;
  background: #fee2e2;
  border-left: 3px solid var(--al);
  border-radius: 3px;
  font-size: 11px;
  color: #991b1b;
}

.alerta-tipo {
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  color: #dc2626;
  display: block;
  margin-bottom: 2px;
}

/* ============================================================
   THUMBNAILS
   ============================================================ */

.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  max-width: 340px;
}

.thumb {
  width: 65px;
  height: 48px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--bd);
  cursor: pointer;
  transition: opacity 0.1s;
}

.thumb:hover {
  opacity: 0.85;
}

.thumb.com-alerta {
  border: 2px solid var(--al);
}

.thumb-mais {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 65px;
  height: 48px;
  background: #f1f5f9;
  border: 1px dashed var(--bd);
  border-radius: 3px;
  font-size: 11px;
  color: var(--mt);
  cursor: pointer;
}

.thumb-mais:hover {
  background: #e2e8f0;
}

/* ============================================================
   PILLS E BADGES
   ============================================================ */

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.pill-automacao {
  background: var(--aut-bg);
  color: var(--aut-tx);
}

.pill-distribuicao {
  background: var(--dis-bg);
  color: var(--dis-tx);
}

.pill-alerta {
  background: #fee2e2;
  color: #dc2626;
}

.badge-alerta {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  vertical-align: middle;
}

.icone-alerta {
  display: inline-block;
  width: 16px;
  height: 16px;
  background: var(--al);
  color: #fff;
  border-radius: 50%;
  text-align: center;
  line-height: 16px;
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
  margin-right: 3px;
}

.conf-valor {
  font-size: 11px;
  color: var(--mt);
  font-family: Consolas, monospace;
}

/* Badge de alerta inline no Painel (vermelho, sem coluna dedicada) */
.badge-alerta-inline {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 700;
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  letter-spacing: 0.2px;
}

.col-jt {
  display: block;
  font-size: 11px;
  color: var(--mt);
  line-height: 1.4;
  word-wrap: break-word;
}

.col-el {
  display: block;
  font-size: 11px;
  color: var(--mt);
  line-height: 1.5;
  word-wrap: break-word;
}

/* ============================================================
   CARREGANDO / ESTADO VAZIO
   ============================================================ */

.estado-carregando {
  text-align: center;
  padding: 60px 32px;
  color: var(--mt);
  font-size: 14px;
}

.estado-vazio {
  text-align: center;
  padding: 48px 32px;
  color: var(--mt);
  font-size: 14px;
}

/* ============================================================
   BOTAO CARREGAR MAIS
   ============================================================ */

.carregar-mais-wrap {
  text-align: center;
  padding: 16px 0 32px;
}

.btn-carregar-mais {
  padding: 9px 28px;
  background: var(--cd);
  border: 1px solid var(--bd);
  border-radius: 6px;
  font-size: 13px;
  color: var(--tx);
  cursor: pointer;
  transition: background 0.12s;
}

.btn-carregar-mais:hover {
  background: #f1f5f9;
}

.contador-exibindo {
  font-size: 11px;
  color: var(--mt);
  text-align: center;
  padding: 4px 0 0;
}

/* ============================================================
   LIGHTBOX
   ============================================================ */

#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(1,19,52,0.92);
  z-index: 100;
}

#lightbox.aberto {
  display: flex;
}

.lb-wrap {
  display: flex;
  width: 100%;
  height: 100%;
}

.lb-esquerda {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: 0;
  height: 100%;
}

.lb-esquerda img {
  max-width: calc(100% - 80px);
  max-height: 90vh;
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  object-fit: contain;
}

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.lb-nav:hover {
  background: rgba(255,255,255,0.3);
}

.lb-prev { left: 12px; }
.lb-next { right: 12px; }

.lb-contador {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  color: #94a3b8;
  font-size: 11px;
  font-family: Consolas, monospace;
}

.lb-direita {
  width: 320px;
  background: rgba(255,255,255,0.07);
  backdrop-filter: blur(8px);
  height: 100%;
  overflow-y: auto;
  padding: 28px 22px;
  color: #fff;
  font-size: 13px;
  border-left: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.lb-fechar {
  position: absolute;
  top: 14px;
  right: 334px;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  font-weight: 700;
  z-index: 101;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: none;
  transition: background 0.15s;
}

.lb-fechar:hover {
  background: rgba(255,255,255,0.25);
}

.lb-dir-titulo {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--lm);
}

.lb-campo {
  margin-bottom: 14px;
}

.lb-campo-label {
  font-size: 10px;
  text-transform: uppercase;
  color: #94a3b8;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.lb-campo-valor {
  font-size: 13px;
  line-height: 1.4;
}

.lb-arquivo {
  font-family: Consolas, monospace;
  font-size: 10px;
  color: #cbd5e1;
  word-break: break-all;
  margin-top: 6px;
}

.lb-pill-automacao {
  background: var(--aut-bg);
  color: var(--aut-tx);
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.lb-pill-distribuicao {
  background: var(--dis-bg);
  color: var(--dis-tx);
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.lb-elemento {
  display: inline-block;
  background: rgba(255,255,255,0.12);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  margin: 2px 2px 0 0;
}

.lb-alerta-bloco {
  margin-top: 8px;
  padding: 7px 10px;
  background: rgba(239,68,68,0.15);
  border-left: 3px solid var(--al);
  border-radius: 3px;
  font-size: 11px;
  color: #fca5a5;
}

.lb-alerta-tipo {
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--al);
  display: block;
  margin-bottom: 2px;
}

/* ============================================================
   FOOTER
   ============================================================ */

.ft {
  padding: 14px 0;
  text-align: center;
  color: var(--mt);
  font-size: 11px;
  border-top: 1px solid var(--bd);
}

/* ============================================================
   RESPONSIVIDADE
   ============================================================ */

@media (max-width: 1024px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
    padding: 12px 0;
  }

  .inner {
    padding-left: 16px;
    padding-right: 16px;
  }

  .lb-direita {
    width: 260px;
  }

  .lb-fechar {
    right: 274px;
  }
}

@media (max-width: 768px) {
  .hd .inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .hd-peers {
    text-align: left;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .auth-box {
    padding: 28px 24px;
    margin: 16px;
  }

  /* Lightbox em mobile: painel lateral vira overlay inferior */
  #lightbox.aberto {
    flex-direction: column;
  }

  .lb-wrap {
    flex-direction: column;
  }

  .lb-esquerda {
    flex: 1;
    min-height: 50vh;
  }

  .lb-direita {
    width: 100%;
    height: 40vh;
    border-left: none;
    border-top: 1px solid rgba(255,255,255,0.1);
  }

  .lb-fechar {
    right: 14px;
    top: 14px;
  }
}
