/* Sistema de Provas Online — Estilos compartilhados */

:root {
  --verde: #198754;
  --verde-claro: #d1e7dd;
}

/* Utilitário de cor roxo (para badge MC_MULTI) — Bootstrap 5 não inclui bg-purple */
.bg-purple { background-color: #6610f2 !important; }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background-color: #f4f6f9;
}

/* --- Questões --- */
.questao-card {
  border-left: 4px solid #dee2e6;
  transition: border-left-color 0.2s;
}

.questao-card.respondida {
  border-left-color: var(--verde);
}

.questao-card .form-check {
  padding: 8px 12px;
  border-radius: 6px;
  transition: background-color 0.15s;
  cursor: pointer;
}

/* Switches (ex.: "Questão revisada") precisam de mais espaço à esquerda
   para o botão do toggle não vazar para fora do box */
.questao-card .form-check.form-switch {
  padding-left: 2.5em;
}

.questao-card .form-check:hover {
  background-color: #f0f4f0;
}

.questao-card .form-check-input:checked + .form-check-label {
  font-weight: 600;
  color: var(--verde);
}

/* --- Barra de progresso — rodapé do cabeçalho ---
   position:absolute dentro do nav sticky: sempre no fundo do cabeçalho,
   independente da altura real do nav (1 linha desktop ou 3 linhas mobile). */
.barra-progresso {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background-color: #dee2e6;
}

.barra-progresso .fill {
  height: 100%;
  background-color: var(--verde);
  transition: width 0.3s ease;
}

/* --- Resultado --- */
.nota-grande {
  font-size: 5rem;
  font-weight: 800;
  line-height: 1;
}

.nota-aprovado  { color: #198754; }
.nota-media     { color: #fd7e14; }
.nota-reprovado { color: #dc3545; }

/* --- Questão corrigida na tela de resultado --- */
.q-correta   { border-left: 4px solid #198754; background-color: #f0faf5; }
.q-incorreta { border-left: 4px solid #dc3545; background-color: #fff5f5; }
.q-pendente  { border-left: 4px solid #6c757d; background-color: #f8f9fa; }
.q-em-branco { border-left: 4px solid #ffc107; background-color: #fffdf0; }

/* Botões Salvar/Fechar do editor do Banco de Questões — sempre visíveis */
.bq-editor-actions-floating {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 1050;
  background-color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

/* --- Tabela com colunas redimensionáveis (Banco de Questões) --- */
/* min-width: com table-layout:fixed, quando o container é mais estreito que a
   soma das colunas de largura fixa, a coluna sem largura declarada ("Texto")
   fica com 0px e some. A largura mínima faz a tabela rolar dentro do
   .table-responsive em vez de espremer essa coluna. */
.tabela-resizable { table-layout: fixed; min-width: 860px; }
.tabela-resizable th { position: relative; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tabela-resizable td { overflow: hidden; word-wrap: break-word; }

/* Texto completo da questão — quebra em várias linhas em vez de truncar */
.tabela-resizable .texto-questao-banco {
  white-space: normal;
  word-break: break-word;
  vertical-align: top;
}
.tabela-resizable .col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  user-select: none;
  z-index: 2;
}
.tabela-resizable .col-resizer:hover,
.tabela-resizable .col-resizer.resizing {
  background-color: var(--verde);
  opacity: 0.5;
}

/* Ícone de filtro nas colunas do Banco de Questões */
.filtro-col-icon {
  cursor: pointer;
  color: #adb5bd;
  margin-left: 2px;
  font-size: 0.75rem;
}
.filtro-col-icon:hover { color: #6c757d; }
.filtro-col-icon.filtro-ativo { color: var(--verde); }

#filtro-banco-dropdown {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
}

/* --- Admin --- */
.prova-item {
  cursor: pointer;
  transition: background-color 0.15s;
}
.prova-item:hover { background-color: #f0f4f0; }

/* --- Imagem nas questões --- */
.imagem-questao {
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid #dee2e6;
  display: block;
}

/* --- Imagem nas alternativas (MC / MC_MULTI) --- */
.imagem-opcao {
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid #dee2e6;
  display: block;
}

/* --- Feedback Teste Mode --- */
.opcao-selecionada-correta { background-color: #d1e7dd !important; border-radius: 6px; }
.opcao-selecionada-errada  { background-color: #f8d7da !important; border-radius: 6px; }
.opcao-correta-perdida     { border: 2px dashed #198754 !important; border-radius: 6px; }

.feedback-inline {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.5;
}
.feedback-inline.correto        { background-color: #d1e7dd; border-left: 4px solid #198754; }
.feedback-inline.errado         { background-color: #f8d7da; border-left: 4px solid #dc3545; }
.feedback-inline.nao-respondido { background-color: #fff3cd; border-left: 4px solid #ffc107; }
.feedback-inline.dissertativa   { background-color: #e2e3e5; border-left: 4px solid #6c757d; }

/* --- Responsivo mobile --- */
@media (max-width: 576px) {
  .nota-grande { font-size: 3.5rem; }
  #timer { font-size: 0.8rem !important; padding: 3px 7px !important; }
  .questao-card .card-header { flex-wrap: wrap; gap: 4px; }
  .questao-card .form-check  { padding: 10px 8px; }
  .btn-lg { font-size: 1rem; padding: 10px 20px; }
  .container { padding-left: 12px; padding-right: 12px; }

  /* ── Navbar mobile: 3 linhas (nome / disciplina / instituição) ─────────── */
  .navbar-brand     { font-size: 0.82rem; min-width: 0; overflow: hidden; }
  .navbar-brand img { height: 36px !important; top: 2px !important; }
  .navbar-texto     { flex: 1; min-width: 0; overflow: hidden; }

  /* Cada span vira bloco → 3 linhas empilhadas */
  .titulo-nome, .titulo-disc {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .titulo-sep { display: none; } /* esconde o "|" no mobile */

  .navbar-instituicao {
    font-size: 0.68rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* --- Faixa de disciplina (prova.html) --- */
#faixa-disciplina {
  background: #eaf4ee;
  border-bottom: 1px solid #c3e0d0;
  color: #198754;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 5px 0;
  text-align: center;
  letter-spacing: 0.02em;
}

/* --- Rodapé institucional --- */
.rodape-institucional {
  text-align: center;
  color: #6c757d;
  font-size: 0.78rem;
  padding: 16px 0 24px;
  margin-top: 40px;
  border-top: 1px solid #dee2e6;
}

/* Zera o padding vertical embutido do Bootstrap no .navbar-brand
   para que o espaço ao redor da logo seja determinado apenas pelo
   padding do .navbar — garantindo simetria real topo/base */
.navbar .navbar-brand {
  padding-top: 0;
  padding-bottom: 0;
}

/* Título da prova + disciplina — tamanho fixo para não herdar escala do navbar-brand */
#titulo-nav {
  font-size: 0.875rem;
}

/* Nome do aluno — mesmo tamanho e peso do título da prova */
#aluno-nav {
  font-size: 0.875rem;
  font-weight: 700;
}

/* Linha de instituição no navbar brand — menor que o título mas legível */
.navbar-instituicao {
  font-size: 0.74rem;
  font-weight: 700;
  color: white;
  display: block;
  letter-spacing: 0.03em;
  margin-top: 1px;
}

/* --- Impressão (resultado) --- */
@media print {
  .navbar, .btn, .barra-progresso, #btn-enviar, #btn-voltar { display: none !important; }
  body { background: white; }
  .card { break-inside: avoid; }
}


/* ══════════════════════════════════════════════════════════════════════════
   Página de materiais do aluno (aluno.html)
   Capítulo atual em destaque, todos expandidos por padrão (<details open>; o aluno recolhe), futuros bloqueados.
   ══════════════════════════════════════════════════════════════════════════ */

.mat-topo {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 12px;
  padding: 1rem 1.25rem;
}

.mat-progresso {
  height: 8px;
  border-radius: 4px;
  background: #e9ecef;
  overflow: hidden;
}
.mat-progresso > div { height: 100%; background: var(--verde); transition: width .3s; }

/* Chips de navegação entre capítulos */
.mat-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0; }
.mat-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .3rem .8rem;
  border: 1px solid #dee2e6; border-radius: 999px;
  background: #fff; color: #495057;
  font-size: .85rem; text-decoration: none;
}
a.mat-chip:hover { border-color: var(--verde); color: var(--verde); }
.mat-chip { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mat-chip-bloq { border-style: dashed; color: #adb5bd; background: transparent; }

/* Cartão de capítulo */
.mat-cap {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 12px;
  margin-bottom: .75rem;
  scroll-margin-top: 1rem;
}
.mat-cap-agora { border: 2px solid var(--verde); }
.mat-cap-bloq  { border-style: dashed; background: transparent; color: #868e96; }

.mat-cap-resumo {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .75rem;
  padding: .85rem 1rem;
}
summary.mat-cap-resumo { cursor: pointer; list-style: none; }
summary.mat-cap-resumo::-webkit-details-marker { display: none; }
summary.mat-cap-resumo::before {
  content: '▸'; color: #868e96; transition: transform .15s;
}
details[open] > summary.mat-cap-resumo::before { transform: rotate(90deg); }

.mat-cap-num    { font-size: .8rem; color: #6c757d; text-transform: uppercase; letter-spacing: .04em; }
.mat-cap-titulo { font-weight: 600; font-size: 1.05rem; }
.mat-cap-agora .mat-cap-titulo { font-size: 1.2rem; }
.mat-cap-cont   { margin-left: auto; font-size: .8rem; color: #6c757d; }
.mat-cap-bloq .mat-cap-titulo { font-weight: 500; }

.mat-cap-corpo { padding: 0 1rem .5rem; }

/* Seção (Aula / Prática / Sondagem) */
.mat-secao {
  display: flex; flex-wrap: wrap; gap: .5rem 1rem;
  padding: .85rem 0;
  border-top: 1px solid #e9ecef;
}
.mat-secao-rotulo {
  flex: 0 0 90px;
  margin: .45rem 0 0;
  font-size: .8rem; font-weight: 500; color: #6c757d;
}
.mat-tiles, .mat-botoes { flex: 1 1 260px; min-width: 0; }
.mat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
}
.mat-botoes { display: flex; flex-wrap: wrap; gap: .5rem; align-content: flex-start; }
.mat-tiles + .mat-botoes { flex-basis: 100%; margin-left: calc(90px + 1rem); }

/* Botão de link */
.mat-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem .85rem;
  border-radius: 8px; border: 1px solid transparent;
  font-size: .9rem; text-decoration: none; font-weight: 500;
  transition: filter .15s;
}
.mat-btn:hover { filter: brightness(.95); }
.mat-btn-pdf   { background: #fde8e8; color: #9b1c1c; }
.mat-btn-pasta { background: #fdf3d7; color: #7a5200; }
.mat-btn-video { background: #dcefe4; color: #14532d; }
.mat-btn-forms { background: #ece5fb; color: #4c2a9b; }
.mat-btn-link  { background: #e2ecf9; color: #1e4b8f; }

/* Bloco com miniatura (vídeo e documentos) */
.mat-tile-rotulo { font-weight: 500; font-size: .9rem; margin-top: .4rem; }
.mat-tile-link   { display: block; text-decoration: none; color: inherit; }
.mat-tile-link:hover .mat-thumb { border-color: var(--verde); }

.mat-thumb {
  position: relative; display: block; width: 100%; padding: 0;
  aspect-ratio: 16 / 9;
  border: 1px solid #dee2e6; border-radius: 8px;
  background: #e9ecef; overflow: hidden; cursor: pointer;
}
.mat-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mat-thumb-doc img { object-position: top; }   /* documento em pé: mostra o topo da página */
.mat-play {
  position: absolute; left: 50%; top: 50%;
  width: 3.2rem; height: 3.2rem; margin: -1.6rem 0 0 -1.6rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: rgba(255,255,255,.92);
  color: #212529; font-size: 1.2rem; padding-left: .15rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
  transition: transform .15s;
}
.mat-thumb:hover .mat-play { transform: scale(1.08); }

.mat-player { position: relative; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: #000; }
.mat-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

@media (max-width: 575.98px) {
  .mat-secao-rotulo { flex-basis: 100%; margin-top: 0; }
  .mat-tiles + .mat-botoes { margin-left: 0; }
}

/* ══════════════════════════════════════════════════════════════════════════
   Cabeçalho e abas do site (index.html e aluno.html)
   Marca e abas usam a mesma largura (.container-site) e o mesmo alinhamento à
   esquerda nas duas páginas, para nada "pular" ao trocar de aba. Sem rolagem:
   no celular as abas dividem a largura por igual; a partir de 576 px ficam
   juntas à esquerda, com largura do próprio texto.
   ══════════════════════════════════════════════════════════════════════════ */

.container-site { max-width: 980px; }

.abas-site { gap: .15rem; }
.abas-site .nav-item { flex: 1 1 auto; }
.abas-site .nav-link {
  display: block;
  padding: .8rem .5rem;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #495057;
  font-size: .9rem;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.abas-site .nav-link:hover,
.abas-site .nav-link:focus-visible { color: var(--verde); border-bottom-color: #a3cfbb; }
.abas-site .nav-link.active         { color: var(--verde); border-bottom-color: var(--verde); font-weight: 600; }

@media (min-width: 576px) {
  .abas-site { gap: .5rem; }
  .abas-site .nav-item { flex: 0 0 auto; }
  .abas-site .nav-link { padding: .9rem 1.1rem; font-size: 1rem; }
}
