/* Banco de Questões — reaproveita os tokens de app.css */

.topo-banco {
  position: relative;
  padding: 44px 20px 26px;
}
.voltar {
  position: absolute;
  top: 20px;
  left: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}
.voltar:hover { color: var(--acento); }
/* no app instalado (PWA) não há "hub" para voltar — some com o link */
@media (display-mode: standalone) { .voltar { display: none; } }

.marca-sm {
  font-size: clamp(26px, 5vw, 36px);
}

.conteudo-banco {
  max-width: 1180px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 28px;
  align-items: start;
}

/* --------------------------------------------------------------- filtros */
.filtros {
  position: sticky;
  top: 20px;
  display: grid;
  gap: 22px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--raio);
  padding: 18px;
  box-shadow: var(--sombra-sm);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  overflow-x: hidden;   /* nunca rola pro lado */
}
.filtros, .filtro-bloco, .chip-lista, .check-grade, .check-lista {
  min-width: 0;
}

.filtro-bloco h2 {
  margin: 0 0 10px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.filtro-cabecalho {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.filtro-cabecalho h2 { margin: 0; }

.link-mini {
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--acento);
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.link-mini:hover { color: var(--acento-forte); text-decoration: underline; }

.chip-lista {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-filtro {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line-forte);
  background: var(--bg-elev);
  color: var(--ink-2);
  cursor: pointer;
  transition: all .12s ease;
}
.chip-filtro:hover { border-color: var(--acento); }
.chip-filtro.ativo {
  border-color: var(--acento);
  background: var(--acento);
  color: #fff;
}
.chip-filtro:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.check-grade {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-height: 190px;
  overflow-y: auto;
  padding-right: 4px;
}

.check-lista {
  display: grid;
  gap: 2px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
  padding: 6px 6px;
  border-radius: 7px;
  cursor: pointer;
  line-height: 1.3;
  min-width: 0;               /* deixa o texto encolher em vez de estourar */
}
.check-item:hover { background: var(--acento-fraco); }
.check-item input {
  accent-color: var(--acento);
  width: 14px;
  height: 14px;
  flex: none;
}
.check-item > span:not(.contagem-topico) {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;   /* nomes longos quebram de linha */
  word-break: break-word;
}
.check-item .contagem-topico {
  margin-left: auto;
  flex: none;
  font-size: 11px;
  color: var(--faint);
  font-weight: 600;
}

.botao-offline {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--raio-sm);
  border: 1px solid var(--line-forte);
  background: var(--bg-elev);
  color: var(--acento-forte);
  cursor: pointer;
  line-height: 1.3;
}
.botao-offline:hover:not(:disabled) { border-color: var(--acento); background: var(--acento-fraco); }
.botao-offline:disabled { opacity: .6; cursor: default; }
.offline-status {
  margin: 8px 0 0;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--muted);
}

/* --------------------------------------------------------------- resultados */
.resultados-cabecalho {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.contagem {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
  font-weight: 500;
}
.contagem strong { color: var(--ink); font-weight: 700; }

.ordenar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
}
.ordenar select {
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  border: 1px solid var(--line-forte);
  border-radius: var(--raio-sm);
  padding: 7px 10px;
  background: var(--bg-elev);
}

.grade-questoes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.cartao-questao {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--raio);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--sombra-sm);
  transition: box-shadow .15s ease, transform .15s ease;
}
.cartao-questao:hover {
  box-shadow: var(--sombra-md);
  transform: translateY(-2px);
}

.cartao-cabecalho {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px 0;
}

.cartao-identificacao {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.cartao-identificacao .ano { color: var(--acento); }

.selo-variante {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--acento-fraco);
  color: var(--acento-forte);
  white-space: nowrap;
}
.selo-variante.ppl { background: #fff7ed; color: #c2410c; }

.cartao-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 8px 14px 0;
}
.tag-topico {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  background: #f1f2f4;
  padding: 3px 8px;
  border-radius: 999px;
}

.cartao-imagem {
  margin: 12px 14px 0;
  border: 1px solid var(--line);
  border-radius: var(--raio-sm);
  overflow: hidden;
  background: #fafafb;
  max-height: 340px;
  cursor: zoom-in;
  display: block;
}
.cartao-imagem img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: top center;
}

.cartao-rodape {
  margin-top: auto;
  display: flex;
  gap: 14px;
  padding: 12px 14px 14px;
}
.cartao-rodape a {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--acento);
  text-decoration: none;
}
.cartao-rodape a:hover { text-decoration: underline; }
.cartao-rodape .desabilitado {
  color: var(--faint);
  cursor: default;
  pointer-events: none;
}
.botao-gabarito {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--acento);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.botao-gabarito:hover { text-decoration: underline; }

.vazio-resultado {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  border: 1px dashed var(--line-forte);
  border-radius: var(--raio);
  font-size: 14px;
}

.carregar-mais-linha {
  display: flex;
  justify-content: center;
  margin-top: 26px;
}
.secundario {
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--acento-forte);
  background: var(--acento-fraco);
  border: 1px solid transparent;
  border-radius: var(--raio-sm);
  padding: 10px 22px;
  cursor: pointer;
}
.secundario:hover { background: #ece5fb; }

/* ------------------------------------------------------------------ lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 25, .82);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 30;
}
.lightbox-corpo {
  max-width: min(900px, 92vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border-radius: 14px;
  overflow: hidden;
}
.lightbox-corpo img {
  display: block;
  width: 100%;
  max-height: 74vh;
  object-fit: contain;
  background: #fff;
}
.lightbox-rodape {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
}
.lightbox-rodape span {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.lightbox-acoes {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.lightbox-acoes a {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--acento);
  text-decoration: none;
}
.lightbox-acoes a:hover { text-decoration: underline; }

.lightbox-fechar {
  position: fixed;
  top: 22px;
  right: 26px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 0;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.lightbox-fechar:hover { background: rgba(255, 255, 255, .22); }

/* ------------------------------------------------------------ gabarito popup */
.gabarito-popup {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 50;
  background: var(--bg-elev);
  border: 1px solid var(--line-forte);
  border-radius: 14px;
  box-shadow: var(--sombra-md);
  padding: 18px 22px;
  min-width: 220px;
  max-width: min(320px, 88vw);
  text-align: center;
}
.gabarito-popup-fechar {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.gabarito-popup-fechar:hover { background: var(--acento-fraco); color: var(--ink); }
.gabarito-popup-legenda {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.gabarito-popup-resposta {
  font-size: 30px;
  font-weight: 800;
  color: var(--acento-forte);
  margin-bottom: 6px;
}
.gabarito-popup-resposta.anulada { font-size: 17px; color: #c2410c; }
.gabarito-popup-resposta.indisponivel { font-size: 13px; font-weight: 600; color: var(--faint); }
.gabarito-popup-pdf {
  display: inline-block;
  margin-top: 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}
.gabarito-popup-pdf:hover { color: var(--acento); text-decoration: underline; }
.gabarito-popup-pdf[hidden] { display: none; }

/* --------------------------------------------------------------- responsivo */
@media (max-width: 880px) {
  .conteudo-banco { grid-template-columns: 1fr; }
  .filtros {
    position: static;
    max-height: none;
  }
  .check-grade { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 480px) {
  .check-grade { grid-template-columns: repeat(3, 1fr); }
  .grade-questoes { grid-template-columns: 1fr; }
}
