/* QI Roxo — tela de questões (feed): destaques, abas, filtros, coluna da direita e janela de filtros. O cartão fica em questao.css. */

.feed-wrap { display: flex; gap: 28px; justify-content: center; align-items: flex-start; padding: 28px 28px 56px; max-width: 1160px; margin: 0 auto; width: 100%; }
.feed-col { flex: 1; min-width: 0; max-width: 620px; }
@media (max-width: 1179px) and (min-width: 1024px) { .feed-wrap { padding: 24px 24px 48px; max-width: none; } }
@media (max-width: 1023px) { .feed-wrap { padding: 14px 14px 28px; max-width: 680px; } }

/* ------------------------------------------------------------------ destaques redondos (meta e bancas) */
.historias { display: flex; justify-content: space-between; gap: 14px; overflow-x: auto; padding: 4px 2px 16px; margin: 0 -2px; }
.historia { flex: none; display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 0; width: 74px; color: inherit; }
.historia-anel { width: 70px; height: 70px; border-radius: 50%; padding: 3px; background: var(--anel-historia); display: grid; place-items: center; }
.historia.meta .historia-anel { background: var(--ouro); }
.historia.ligada .historia-anel { background: var(--roxo); }
.historia-miolo { width: 100%; height: 100%; border-radius: 50%; background: #fff; padding: 3px; }
.historia-circulo { width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; letter-spacing: .02em; background: oklch(0.5 0.24 var(--h, 304)); }
.historia.meta .historia-circulo { font-size: 15px; background: var(--roxo-ativo); }
.historia-nome { font-size: 12.5px; font-weight: 600; color: oklch(0.35 0.05 300); white-space: nowrap; }
.historia.ligada .historia-nome { font-weight: 800; color: var(--roxo); }

/* setas de navegação dos destaques: só com mouse (no toque, desliza-se com o dedo); a seta some quando não há mais para o lado */
.historias-wrap { position: relative; }
.historias-seta { display: none; }
@media (hover: hover) and (pointer: fine) {
  .historias-wrap::before, .historias-wrap::after { content: ''; position: absolute; top: 0; bottom: 16px; width: 64px; z-index: 1; pointer-events: none; opacity: 0; transition: opacity var(--anim-rapida); }
  .historias-wrap::before { left: -2px; background: linear-gradient(90deg, var(--canvas) 35%, transparent); }
  .historias-wrap::after { right: -2px; background: linear-gradient(270deg, var(--canvas) 35%, transparent); }
  .historias-wrap.tem-esq::before, .historias-wrap.tem-dir::after { opacity: 1; }
  .historias-seta { position: absolute; top: 21px; z-index: 2; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--roxo);
    border: 1.5px solid var(--lilas-borda-cartao); box-shadow: var(--sombra-card-fina); transition: opacity var(--anim-rapida), visibility var(--anim-rapida), background var(--anim-rapida), border-color var(--anim-rapida), transform var(--anim-rapida); }
  .historias-seta.esq { left: 0; }
  .historias-seta.dir { right: 0; }
  .historias-seta:hover:not(:disabled) { border-color: var(--roxo); background: var(--roxo-tinta); }
  .historias-seta:active:not(:disabled) { transform: scale(.94); }
  .historias-seta:focus-visible { outline: 0; box-shadow: 0 0 0 4px var(--roxo-foco); border-color: var(--roxo); }
  .historias-seta:disabled { opacity: 0; visibility: hidden; pointer-events: none; }
}

.feed-busca { box-sizing: content-box; display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 46px; border-radius: var(--r-pilula); background: #fff; border: 1.5px solid oklch(0.91 0.03 306); margin-bottom: 14px; }
.feed-busca:focus-within { border-color: var(--roxo); box-shadow: 0 0 0 4px var(--roxo-foco); }
.feed-busca svg { flex: none; color: oklch(0.5 0.04 300); }
.feed-busca input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 15px; color: inherit; }

/* ------------------------------------------------------------------ abas e botão de filtros */
.feed-barra { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 12px; margin-bottom: 14px; }
.feed-abas { display: flex; gap: 8px; min-width: 0; }
/* as duas abas são botões de verdade: a ativa é roxa cheia (como os botões primários), a outra é branca com borda lilás */
.feed-aba { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 24px; border-radius: var(--r-pilula); border: 1.5px solid var(--lilas-borda-cartao); background: #fff; font-weight: 800; font-size: 17px; white-space: nowrap; color: var(--roxo-texto); transition: all var(--anim-rapida); }
.feed-aba:hover { border-color: var(--roxo); }
.feed-aba.ativa { background: var(--roxo); border-color: var(--roxo); color: #fff; box-shadow: 0 3px 0 var(--roxo-sombra-botao); }
.feed-filtros { flex: none; margin-left: auto; display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: var(--r-pilula); background: #fff; border: 1.5px solid var(--lilas-borda-cartao); color: oklch(0.35 0.05 300); font-weight: 700; font-size: 15px; transition: all var(--anim-rapida); }
.feed-filtros:hover { border-color: var(--roxo); color: var(--roxo); }
.feed-filtros.com-filtros { border-color: var(--roxo); color: var(--roxo); }
/* celular: o botão Filtros nunca pode sair da tela; abas e botão ficam mais compactos e, se ainda faltar largura, o botão desce para a linha de baixo. */
@media (max-width: 479px) {
  .feed-abas { gap: 4px; }
  .feed-aba { padding: 10px 12px; font-size: 15px; }
  .feed-filtros { padding: 10px 12px; gap: 6px; }
}
.feed-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.feed-limpar { color: oklch(0.45 0.04 300); font-weight: 700; font-size: 13.5px; padding: 7px 8px; text-decoration: underline; }

.feed-lista { display: flex; flex-direction: column; gap: 20px; }
.feed-mais { margin-top: 20px; border-radius: var(--r-card); background: #fff; border: 1px solid var(--borda); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.feed-fim { margin-top: 8px; padding: 26px 20px; border-radius: var(--r-card); background: var(--lilas-cintia); border: 1.5px dashed oklch(0.85 0.06 306); text-align: center; }
.feed-fim-titulo { font-weight: 800; font-size: 17px; }
.feed-fim-texto { font-size: 14.5px; color: var(--texto-suave); margin: 4px 0 14px; }

/* ------------------------------------------------------------------ coluna da direita (>= 1180 px) */
/* content-box como no protótipo: 300 px de conteúdo + 4 px de respiro à direita = 304 px na tela */
.feed-rail { box-sizing: content-box; width: var(--coluna-direita); flex: none; position: sticky; top: 16px; max-height: calc(100dvh - var(--topo-altura) - 32px); overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 14px; padding: 2px 4px 8px 0; }
/* como no protótipo, dentro da coluna divs e spans são content-box (botões continuam border-box) */
.feed-rail *, .feed-rail *::before, .feed-rail *::after { box-sizing: content-box; }
.feed-rail button, .feed-rail a.rail-tarefa { box-sizing: border-box; }
.rail-perfil { display: flex; align-items: center; gap: 14px; padding: 0; text-align: left; color: inherit; }
.rail-perfil:hover { color: inherit; }
.rail-perfil-usuario { display: block; font-weight: 800; font-size: 16px; }
.rail-perfil-nome { display: block; font-size: 14px; color: var(--texto-meta); margin-top: 1px; }
.rail-meta { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 22px; background: linear-gradient(135deg, oklch(0.5 0.25 304), oklch(0.4 0.23 298)); color: #fff; box-shadow: 0 18px 30px -20px oklch(0.49 0.25 304 / .8); }
.rail-meta-anel { position: relative; width: 64px; height: 64px; flex: none; }
.rail-meta-anel b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; white-space: nowrap; }
.rail-meta-titulo { font-weight: 800; font-size: 16px; line-height: 1.2; }
.rail-meta-sub { font-size: 13px; color: oklch(0.92 0.05 306); margin-top: 3px; line-height: 1.35; }
.rail-meta-fogo { flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 10px; border-radius: var(--r-item); background: oklch(1 0 0 / .14); }
.rail-meta-fogo .fogo-anim { animation: flick 1.4s ease-in-out infinite; }
.rail-meta-fogo span { font-weight: 800; font-size: 15px; line-height: 1; }
.rail-cartao { padding: 16px 18px 14px; border-radius: var(--r-card); background: #fff; border: 1px solid var(--borda); box-shadow: var(--sombra-card-fina); }
.rail-cartao-cab { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.rail-cartao-titulo { font-weight: 800; font-size: 15.5px; color: oklch(0.22 0.05 300); }
.rail-ver-tudo { font-weight: 700; font-size: 13.5px; color: var(--roxo); }
.rail-tarefas { display: flex; flex-direction: column; gap: 2px; }
.rail-tarefa { display: flex; align-items: center; gap: 12px; padding: 8px; margin: 0 -8px; border-radius: 14px; text-align: left; width: calc(100% + 16px); color: inherit; }
button.rail-tarefa:hover { background: var(--lilas-chip); }
.rail-tarefa-caixa { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: #fff; border: 2px solid oklch(0.82 0.06 306); transition: all var(--anim-rapida); }
.rail-tarefa-caixa.feita { background: var(--roxo); border-color: var(--roxo); }
.rail-tarefa-titulo { display: block; font-weight: 700; font-size: 14.5px; }
.rail-tarefa-titulo.feita { text-decoration: line-through; color: oklch(0.55 0.03 300); }
.rail-tarefa-sub { display: block; font-size: 12.5px; color: var(--texto-3); margin-top: 1px; }
.rail-vazio { font-size: 14px; line-height: 1.5; color: var(--texto-suave); }
.rail-vazio-acao { display: inline-block; margin-top: 6px; font-weight: 800; color: var(--roxo); }

/* ------------------------------------------------------------------ janela de filtros */
.modal.filtros { width: min(1040px, calc(100% - 48px)); padding: 0; display: flex; flex-direction: column; overflow: hidden; border-radius: var(--r-modal); height: fit-content; max-height: calc(100% - 0px); animation-name: rise; animation-duration: .25s; }
.f-cab { display: flex; align-items: center; gap: 10px; padding: 16px 24px 8px; flex-wrap: wrap; }
.f-titulo { font-family: var(--fonte-titulo); font-weight: 800; font-size: 25px; letter-spacing: -.02em; flex: 1; min-width: 120px; }
.f-ultimo { --btn-py: 10px; --btn-px: 16px; --btn-fs: 14px; border-color: var(--lilas-borda-forte); color: var(--roxo); background: #fff; }
.f-ultimo:hover { background: oklch(0.97 0.025 306) !important; color: var(--roxo) !important; }
.f-corpo { flex: 1; min-width: 0; overflow-y: auto; overflow-x: hidden; padding: 2px 24px 14px; display: flex; flex-direction: column; gap: 14px; }
.f-subtitulo { font-weight: 800; font-size: 15px; }
.f-salvos { display: flex; flex-wrap: wrap; gap: 8px; }
.f-salvo { display: inline-flex; align-items: center; border-radius: var(--r-pilula); background: var(--roxo-tinta); overflow: hidden; }
.f-salvo-nome { padding: 9px 6px 9px 14px; color: var(--roxo-texto); font-weight: 800; font-size: 14.5px; }
.f-salvo-x { padding: 9px 12px 9px 6px; color: var(--roxo-texto); display: grid; place-items: center; }
.f-status { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; min-width: 0; }
.f-status-opcoes { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.f-pilula { padding: 8px 14px; border-radius: var(--r-pilula); border: 1.5px solid var(--borda-input); background: #fff; color: var(--texto-forte); font-weight: 800; font-size: 12.5px; letter-spacing: .02em; white-space: nowrap; transition: all var(--anim-rapida); }
.f-pilula.ligada { background: var(--roxo); border-color: var(--roxo); color: #fff; }
.f-grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 165px), 1fr)); gap: 10px; align-items: start; min-width: 0; }
.f-busca { display: flex; align-items: center; gap: 10px; padding: 0 5px 0 14px; height: 44px; border-radius: var(--r-campo); border: 1.5px solid var(--borda-input); background: #fff; }
.f-busca:focus-within { border-color: var(--roxo); box-shadow: 0 0 0 4px var(--roxo-foco); }
.f-busca input { flex: 1; min-width: 90px; text-overflow: ellipsis; border: 0; outline: 0; background: transparent; font-size: 15px; color: inherit; }
.f-busca-icone { width: 36px; height: 36px; border-radius: 10px; background: var(--roxo); color: #fff; display: grid; place-items: center; flex: none; }
.f-campo { width: 100%; display: flex; align-items: center; gap: 8px; padding: 0 14px 0 16px; height: 44px; border-radius: var(--r-campo); border: 1.5px solid var(--borda-input); background: #fff; color: oklch(0.45 0.04 300); font-weight: 500; font-size: 15px; text-align: left; transition: all var(--anim-rapida); }
.f-campo.ativo { border-color: var(--roxo); font-weight: 700; }
.f-campo.um { color: var(--texto); }
.f-campo.aberto { box-shadow: 0 0 0 4px var(--roxo-foco); }
.f-campo.desab { background: oklch(0.965 0.01 306); color: oklch(0.62 0.03 300); cursor: pointer; }   /* apagado, mas não morto: tocar leva ao passo que falta (Assunto abre a lista de Disciplina) */
.f-campo-texto { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f-seta { flex: none; transition: transform .18s; }
.f-campo.aberto .f-seta { transform: rotate(180deg); }
/* no computador a lista abre SOBRE os campos de baixo, fora do fluxo: a linha da grade não cresce e a janela não se mexe. É fixed (e não absolute) porque o corpo e a janela têm
   overflow próprio e cortariam a lista no rodapé; Filtros.js calcula a posição a partir do campo e a entrega em --lista-* */
.f-lista { position: fixed; top: var(--lista-topo, auto); bottom: var(--lista-base, auto); left: var(--lista-esq, 0); width: var(--lista-larg, auto); max-height: var(--lista-max, 220px); z-index: 30; border-radius: var(--r-campo); border: 1.5px solid oklch(0.9 0.04 306); background: #fff; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 6px; animation: rise .18s ease; box-shadow: 0 12px 24px -14px oklch(0.3 0.15 300 / .4); }
.f-lista-busca { width: 100%; height: 36px; margin-bottom: 4px; padding: 0 12px; border-radius: 10px; border: 1.5px solid var(--borda-input); font-size: 14px; outline: 0; background: var(--canvas); position: sticky; top: 0; z-index: 2; box-shadow: 0 -10px 0 #fff, 0 4px 0 #fff; }   /* a sombra branca tampa a faixa por onde as opções rolando apareciam, em cima e embaixo da busca */
.f-lista-busca:focus { border-color: var(--roxo); }
.f-lista { scroll-padding-top: 46px; }                              /* a busca fica grudada no topo: opção que ganha foco ou é levada à vista não pode parar embaixo dela */
.f-lista:focus { outline: 0; }                                      /* tocar na barra de rolagem ou no vão entre as opções põe o foco na própria lista (tabindex -1), sem aro: é só um recipiente que rola */
.f-lista:has(.f-lista-grupo) { scroll-padding-top: 88px; }          /* e, na lista de assuntos, o cabeçalho da disciplina também */
.f-lista-aviso { padding: 12px; font-size: 14px; color: var(--texto-3); }
.f-opcao { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 10px; font-size: 14.5px; font-weight: 500; text-align: left; }
.f-opcao:hover, .f-opcao.ligada { background: oklch(0.97 0.02 306); }
.f-opcao.ligada { font-weight: 700; }
.f-opcao-nome { flex: 1; min-width: 0; white-space: pre-wrap; }
/* lista de assuntos: cabeçalho por disciplina (fica grudado sob a busca enquanto o grupo rola), subtítulo "Outros assuntos" e o número do tópico antes do título */
.f-lista-grupo { position: sticky; top: 40px; z-index: 1; margin: 6px 0 2px; padding: 10px 10px 7px; background: #fff; border-bottom: 1px solid var(--borda); font-size: 13px; font-weight: 800; letter-spacing: .01em; color: var(--texto-3); }
.f-lista-sub { margin-top: 8px; padding: 10px 10px 4px; font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--texto-3); }
.f-opcao-num { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--roxo-texto); }
.f-opcao[data-nivel="0"] .f-opcao-nome { font-weight: 700; }
.f-ligacoes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 10px 24px; }
.f-ligacao { display: flex; align-items: center; align-content: flex-start; gap: 4px 18px; flex-wrap: wrap; }
.f-ligacao-titulo { white-space: nowrap; flex: 1 0 100%; }
.f-ligar { display: inline-flex; align-items: center; gap: 9px; padding: 6px 0; font-size: 14.5px; font-weight: 600; white-space: nowrap; text-align: left; }
.f-ligar:disabled { opacity: .5; cursor: not-allowed; }
/* mini bandeira ao lado de "Anuladas" e "Desatualizadas" (as mesmas cores do cartão da questão) */
.f-bandeira { display: inline-grid; place-items: center; flex: none; margin-right: -3px; }
.f-bandeira.anulada { color: var(--bandeira-vermelha); }
.f-bandeira.desatualizada { color: var(--bandeira-amarela-traco); }
.f-bandeira.desatualizada svg { fill: var(--bandeira-amarela); }
.f-ligacao-nota { flex: 1 0 100%; font-size: 13px; line-height: 1.4; color: var(--texto-meta); }
/* quem estuda para mais de um concurso escolhe o plano aqui (o mesmo campo das listas, de escolha única); no celular a lista ancora neste bloco e não na grade de campos */
.f-ligacao-escolha { flex: 1 0 100%; min-width: 0; margin-top: 4px; }
.f-opcao-visto { flex: none; color: var(--roxo); }
.f-ligacao-link { padding: 0; color: var(--roxo); font-weight: 800; text-decoration: underline; text-underline-offset: 2px; }
.f-rodape { padding: 12px 24px 16px; border-top: 1px solid oklch(0.94 0.015 306); display: flex; flex-direction: column; gap: 12px; }
.f-filtrar { display: flex; align-items: flex-start; gap: 10px; }
.f-filtrar-rotulo { flex: none; font-weight: 800; font-size: 14px; padding-top: 8px; }
.f-filtrar-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; max-height: 96px; overflow-y: auto; overflow-x: hidden; }
.f-acoes { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.f-acao-texto { --btn-py: 12px; --btn-px: 16px; --btn-fs: 14.5px; background: transparent; color: var(--texto-abas); }
.f-acao-texto:hover { background: var(--lilas-chip); }
.f-acao-texto.roxo { color: var(--roxo); }
.f-acao-texto.roxo:hover { background: oklch(0.97 0.025 306); }
.f-aplicar { flex: 1 1 180px; max-width: 280px; }
@media (max-width: 1023px) {
  .modal.filtros { width: 100%; max-height: 92%; border-radius: 28px 28px 0 0; padding: 0; animation-name: sheetup; animation-duration: .28s; box-shadow: var(--sombra-folha); }
  .f-acoes { justify-content: space-between; }
  .f-aplicar { padding-bottom: 14px; flex: 1 1 100%; max-width: none; }      /* o botão principal ocupa a linha toda */
  /* iOS dá zoom na página ao focar um campo com fonte menor que 16px, e a folha de filtros fica desalinhada */
  .f-busca input, .f-lista-busca, .feed-busca input { font-size: 16px; }
  /* a lista de opções abre em largura total logo abaixo do campo, sobre os de baixo (não empurra nem remonta a grade); opções com altura de toque */
  .f-grade, .f-ligacao-escolha { position: relative; }
  .f-lista { position: absolute; top: auto; bottom: auto; left: 0; right: 0; width: auto; margin-top: 6px; z-index: 5; max-height: 240px; }
  .f-opcao { padding: 11px 10px; }
  /* rodapé mais baixo: os chips ficam numa linha só (rolam de lado), sobra mais corpo para os campos */
  .f-filtrar { align-items: center; }
  .f-filtrar-rotulo { padding-top: 0; }
  .f-filtrar-chips { flex-wrap: nowrap; max-height: none; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  .f-filtrar-chips::-webkit-scrollbar { display: none; }
}
