/* ============================================================
   CATÁLOGO DE FERRAMENTAS (ia-filters) — layout, sidebar de
   filtros, grid de cards e paginação.

   2 breakpoints principais: base = desktop (alvo 1280px) e
   @media (max-width: 800px) = mobile (alvo 375px) — mesmo corte
   usado no header/footer globais (static/css/global). Entre os
   dois, tudo reescala de forma fluida (auto-fit, clamp), sem
   breakpoints extras.
   ============================================================ */

/* Reset de aparência nativa — evita que o navegador desenhe cantos
   ou fundo próprios por cima do border-radius definido abaixo. */
.accordion,
.accordion.sub,
.clear-btn,
.mobile-filters-btn,
.sidebar-close,
.page-btn,
.page-dot,
.visit-btn {
  appearance: none;
  -webkit-appearance: none;
}

/* ============================== LAYOUT ============================== */
.layout {
  display: flex;
  align-items: flex-start;
  gap: 32px;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 40px;
  box-sizing: border-box;
}

/* ============================== SIDEBAR ============================== */
:root {
  --sidebar-w: 234px;
}

/* Coluna inteira de filtros: chips rápidos + painel navy embaixo.
   É esse elemento (não o .sidebar sozinho) que vira o drawer no mobile. */
.sidebar-col {
  flex-shrink: 0;
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Filtros rápidos por etiqueta (Tipo, Idioma, Ordenar por) — espaçamento
   apertado e uniforme, igual ao Figma (nada de gap grande entre grupos
   e gap pequeno label->chip, lá é tudo ~8px). */
.quick-filters {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-group-label {
  color: var(--c_blue2);
  font-family: var(--fonte-padrao);
  font-weight: 400;
  font-size: 10px;
  line-height: 121.93%;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-chip {
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(217, 217, 217, 0.5);
  color: var(--c_blue2);
  border: 0.569px solid var(--c_blue2);
  border-radius: 3px;
  padding: 4.552px;
  font-family: var(--fonte-destaque);
  font-size: 9.103px;
  font-weight: 400;
  line-height: normal;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.filter-chip:hover {
  background: var(--bg_cp_blue);
}

.filter-chip.active {
  background: var(--c_blue2);
  color: var(--c_white);
}

.sidebar {
  width: 100%;
  box-sizing: border-box;
  background: var(--c_blue3);
  border-radius: 16px;
  padding: 24px 18px;
  height: fit-content;
}

.sidebar h2 {
  margin: 0 0 14px;
}

.sidebar-title {
  color: var(--c_white);
  font-weight: 700;
  font-size: 18px;
}

/* Piscada de destaque (?highlight=sidebar, pop-up "Por filtragem" da home) —
   mesmo efeito de glow/escala da search-bar, só sem flash de cor no painel
   inteiro (ia bagunçar os chips/checkboxes); o título pisca em vermelho. */
@keyframes sidebar-flash-glow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(230, 54, 22, 0);
    transform: scale(1);
  }
  25%, 75% {
    box-shadow: 0 0 22px 6px rgba(230, 54, 22, 0.55);
    transform: scale(1.015);
  }
}

@keyframes sidebar-flash-color {
  0%, 100% { color: var(--c_white); }
  25%, 75% { color: var(--c_red); }
}

.sidebar.flash-highlight {
  animation: sidebar-flash-glow 0.6s ease-in-out 5;
}

.sidebar.flash-highlight .sidebar-title {
  animation: sidebar-flash-color 0.6s ease-in-out 5;
}

.sidebar-close {
  display: none;
}

/* Alternador Modo Simples / Avançado — pill com borda envolvendo
   o switch inteiro + texto (bate com o mockup do Figma). */
.toggle-container {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 6px 16px 6px 6px;
  border: 1px solid var(--c_white);
  border-radius: 999px;
}

.toggle-input {
  display: none;
}

.toggle-label {
  flex-shrink: 0;
  width: 34px;
  height: 18px;
  background: transparent;
  border: 1px solid var(--c_white);
  border-radius: 20px;
  position: relative;
  cursor: pointer;
  box-sizing: border-box;
  transition: background 0.3s ease;
}

.toggle-ball {
  width: 12px;
  height: 12px;
  background: var(--c_white);
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.3s ease, background 0.3s ease;
}

.toggle-input:checked + .toggle-label {
  background: var(--c_white);
}

.toggle-input:checked + .toggle-label .toggle-ball {
  background: var(--c_blue3);
  transform: translateX(16px);
}

#toggle-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--c_white);
}

/* Categorias (Imagem, Texto, Agente de IA...) */
.accordion {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--c_white);
  font-family: var(--fonte-padrao);
  font-weight: 700;
  font-size: 10.058px;
  line-height: 121.93%;
  padding: 9px 2px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.accordion:hover {
  color: var(--c_yellow);
}

/* Cresce e empurra a seta pra ponta sozinho — sem posicionamento absoluto. */
.accordion-label {
  flex: 1;
}

/* Atributo amplo: "esta ferramenta tem qualquer tarefa dessa categoria > 0".
   Não é "marcar todos os checkboxes filhos" — é um flag à parte (ver
   filterCards() em script.js). Mesmo visual do checkbox de tarefa
   (.panel input[type="checkbox"]). */
.accordion-attr {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  accent-color: var(--c_yellow);
}

.arrow::before {
  content: "▾";
  display: inline-block;
  font-size: 13px;
  color: inherit;
  margin-left: 8px;
  transition: transform 0.2s ease;
}

.accordion.active .arrow::before {
  transform: rotate(180deg);
}

/* Itens do modo avançado — pill branco sólido, texto navy */
.accordion.sub {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  color: var(--c_blue3);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  margin: 8px 0 0;
  background: var(--c_white);
  border: none;
  border-radius: 999px;
  cursor: pointer;
}

.accordion.sub .arrow::before {
  color: var(--c_blue3);
}

.accordion.sub.active .arrow::before {
  transform: rotate(180deg);
}

.panel {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease;
}

.panel.open {
  max-height: 600px;
  overflow-y: auto;
}

.panel label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px 6px 8 px;
  width: 194px;
  max-width: 100%;
  box-sizing: border-box;
  font-family: var(--fonte-padrao);
  font-size: 10.45px;
  font-weight: 400;
  line-height: 200%;
  color: var(--c_white);
}

.panel input[type="checkbox"] {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  accent-color: var(--c_white);
}

.panel.sub-panel label {
  padding: 6px 4px 6px 4px;
  margin: 0;
  border-bottom: 1px solid rgba(242, 242, 242, 0.15);
}

.panel.sub-panel label:first-child {
  padding: 12px 4px 6px 4px;
}

.sidebar-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.clear-btn {
  flex: 1;
  border-radius: 3px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: opacity 0.2s ease;
  background: var(--c_red);
  color: var(--c_white);
  border: none;
}

.clear-btn:hover {
  opacity: 0.85;
}

/* ============================== CONTEÚDO ============================== */
#grid {
  display: none;
}

.content {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "title  search"
    "grid   grid"
    "pagination pagination";
  align-items: center;
  row-gap: 20px;
}

.content h1 {
  grid-area: title;
  align-self: start;
  font-family: var(--fonte-destaque);
  font-style: normal;
  font-weight: 500;
  color: var(--c_red);
  font-size: clamp(24px, 1.6vw + 19px, 32px);
  margin: 0;
}

.mobile-filters-btn {
  display: none;
}

.search-bar-wrap {
  grid-area: search;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-self: end;
}

.hero-search-info {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--c_blue2);
  border-radius: 50%;
  background: transparent;
  color: var(--c_blue2);
  font-family: var(--fonte-info);
  font-size: 15px;
  font-style: italic;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.hero-search-info:hover {
  background-color: var(--c_blue2);
  color: var(--c_white);
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  box-sizing: border-box;
  padding: 14px 28px;
  background: var(--c_white);
  border: 1.5px solid var(--c_blue3);
  border-radius: 999px;
}

.search-bar i {
  color: var(--c_blue3);
  font-size: 16px;
  flex-shrink: 0;
}

/* Piscada de destaque (?highlight=search, vindo do pop-up "Por nome" da
   home) — chama atenção pra search-bar sem depender de layout/posição.
   Além da borda/ícone/texto em vermelho, pulsa leve escala + sombra
   vermelha (glow), pra dar mais presença que uma piscada simples. */
@keyframes search-bar-flash-border {
  0%, 100% {
    border-color: var(--c_blue3);
    box-shadow: 0 0 0 0 rgba(230, 54, 22, 0);
    transform: scale(1);
  }
  25%, 75% {
    border-color: var(--c_red);
    box-shadow: 0 0 22px 6px rgba(230, 54, 22, 0.55);
    transform: scale(1.035);
  }
}

@keyframes search-bar-flash-color {
  0%, 100% { color: var(--c_blue3); }
  25%, 75% { color: var(--c_red); }
}

.search-bar.flash-highlight {
  animation: search-bar-flash-border 0.6s ease-in-out 5;
}

.search-bar.flash-highlight i,
.search-bar.flash-highlight #searchInput {
  animation: search-bar-flash-color 0.6s ease-in-out 5;
}

#searchInput {
  width: 220px;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0;
  border: none;
  background: transparent;
  font-family: var(--fonte-padrao);
  font-size: 15px;
  font-weight: 600;
  color: var(--c_blue3);
  outline: none;
}

#searchInput::placeholder {
  color: var(--c_blue3);
  font-weight: 600;
  opacity: 1;
}

/* ============================== CARDS ============================== */
.card-grid {
  grid-area: grid;
  display: grid;
  /* auto-fill (não auto-fit): com poucos resultados, os cards mantêm a
     largura das colunas em vez de esticar pra preencher a linha toda. */
  grid-template-columns: repeat(auto-fill, minmax(256px, 1fr));
  gap: 32px;
}

.card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--c_white3);
  border-radius: 10px;
  padding: 24px 20px 20px;
  box-sizing: border-box;
}

.card:has(.editor-badge) {
  border-radius: 10px;
  border: 2px solid var(--c_red);
}

.card-header h3 {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  font-size: 16px;
  font-weight: 700;
  color: var(--c_blue3);
  margin: 0;
}

.tool-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  object-fit: contain;
  background: var(--c_blue2);
  border-radius: 8px;
  padding: 6px;
  box-sizing: border-box;
}

.card p {
  font-size: 13px;
  line-height: 1.45;
  color: var(--c_blue4);
  margin: 0;
  min-height: 95px;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tags span {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 32px;
  border: 1px solid var(--c_blue3);
  background: var(--c_gray2);
  color: var(--c_blue3);
  white-space: nowrap;
}

.button-row {
  margin-top: auto;
  padding-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.visit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  background: var(--c_red);
  color: var(--c_white);
  font-weight: 700;
  font-size: 13px;
  text-align: center;
  text-decoration: none;
  border-radius: 3px;
  transition: background-color 0.2s ease;
}

.visit-btn:hover {
  background-color: #c72d10;
}

.editor-badge {
  position: absolute;
  top: -30px;
  right: -50px;
  min-width: 30px;
  min-height: 85px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  padding: 6px 40px 8px;
  background: var(--c_red);
  color: var(--c_white);
  font-family: var(--fonte-padrao);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
  border-radius: 20px;
  transform: rotate(45deg);
  transform-origin: center;
  z-index: 1;
}

/* ============================== PAGINAÇÃO ============================== */
.pagination {
  grid-area: pagination;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
}

.page-dot,
.page-btn {
  width: 36px;
  height: 36px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  color: var(--c_blue3);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.page-btn.extreme {
  font-size: 12px;
}

.page-dot.active {
  background: var(--c_red);
  color: var(--c_white);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ============================================================
   MOBILE (<=800px, alvo 375px)
   ============================================================ */
@media (max-width: 800px) {
  .layout {
    flex-direction: column;
    align-items: stretch;
    padding: 20px;
    gap: 16px;
  }

  .content {
    grid-template-columns: 1fr auto auto;
    column-gap: 7px;
    grid-template-areas:
      ".          mobile-btn search"
      "title      title      title"
      "grid       grid       grid"
      "pagination pagination pagination";
    row-gap: 14px;
  }

  .pagination {
    justify-content: center;
  }

  /* Figma "(Pronto)Catologo IAs Mobile": só texto, sem ícone, Ubuntu 16/400. */
  .mobile-filters-btn {
    grid-area: mobile-btn;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background: transparent;
    color: var(--c_blue2);
    border: 1px solid var(--c_blue2);
    border-radius: 32px;
    font-family: var(--fonte-destaque);
    font-size: 16px;
    font-weight: 400;
    cursor: pointer;
  }

  /* Painel lateral aberto = botão com cores invertidas (fundo azul, texto branco). */
  .mobile-filters-btn.active {
    background: var(--c_blue2);
    color: var(--c_white);
    border-color: var(--c_blue2);
  }

  /* Sem espaço pro botão de info nessa largura — some, só o ícone/campo de busca. */
  .hero-search-info {
    display: none;
  }

  /* Colapsada = pill 40x31 (Figma), só ícone. margin-right compensa os 20px
     do .layout pra fechar exatos 23px de margem até a borda da tela. */
  .search-bar {
    width: 40px;
    height: 31px;
    padding: 0 8px;
    gap: 0;
    justify-content: center;
    margin-right: 3px;
  }

  .search-bar:focus-within {
    width: 195px;
    gap: 14px;
  }

  #searchInput {
    width: 0;
    font-size: 12px;
    transition: width 1s ease;
  }

  #searchInput:focus {
    width: 141px;
  }

  .content h1 {
    font-size: clamp(22px, 6vw, 26px);
  }

  /* A coluna inteira (chips rápidos + painel navy) vira o drawer —
     drawer inteiro fica navy, então os quick-filters precisam de
     borda/texto branco aqui embaixo (senão somem no fundo escuro). */
  .sidebar-col {
    position: fixed;
    top: 0;
    left: -100%;
    width: 85%;
    max-width: 320px;
    min-width: 0;
    height: 100dvh;
    z-index: 2000;
    background: var(--c_blue3);
    border-radius: 0 16px 16px 0;
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.25);
    overflow-y: auto;
    padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
    transition: left 0.35s ease;
  }

  .sidebar-col.open {
    left: 0;
  }

  .filter-group-label {
    color: var(--c_white);
  }

  .filter-chip {
    color: var(--c_white);
    border-color: var(--c_white);
  }

  .filter-chip:hover {
    background: rgba(255, 255, 255, 0.15);
  }

  .filter-chip.active {
    background: var(--c_white);
    color: var(--c_blue3);
    border-color: var(--c_white);
  }

  .sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-bottom: 10px;
    margin-left: auto;
    background: none;
    border: none;
    color: var(--c_white);
    font-size: 40px;
    line-height: 1;
    cursor: pointer;
  }

  .filter-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1999;
  }

  .filter-overlay.show {
    display: block;
  }

  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .card {
    padding: 20px 14px 16px;
    gap: 8px;
  }

  .card-header h3 {
    font-size: 13px;
    gap: 8px;
  }

  .tool-icon {
    width: 36px;
    height: 36px;
  }

  .card p {
    font-size: 11px;
    -webkit-line-clamp: 4;
  }

  .tags span {
    font-size: 9px;
    padding: 3px 8px;
  }

  .button-row {
    gap: 6px;
  }

  .visit-btn {
    padding: 7px;
    font-size: 11px;
  }

  .editor-badge {
    top: -22px;
    right: -38px;
    min-height: 64px;
    min-width: 22px;
    font-size: 8px;
    padding: 4px 28px 6px;
  }
}

/* ============================================================
   POP-UP "Como você quer pesquisar?" (botão .hero-search-info ao lado da
   search-bar) — mesmas classes/visual do pop-up da home (_home_page.css),
   copiadas aqui porque essa página não carrega o CSS da home. A ação de
   cada "Usar essa" é adaptada: já estamos no catálogo, então em vez de
   navegar pra cá, foca/destaca o que já está nesta página.
   ============================================================ */
.hero-info-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 22, 38, 0.55);
  display: flex;
  justify-content: safe center;
  align-items: safe center;
  overflow-y: auto;
  padding: 40px 20px;
  box-sizing: border-box;
  z-index: 2100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
}

.hero-info-overlay.open {
  opacity: 1;
  visibility: visible;
}

.hero-info-modal {
  position: relative;
  width: 100%;
  max-width: 737px;
  box-sizing: border-box;
  padding: 33px 26px 32px;
  background: var(--c_white3);
  border-radius: 32px;
  text-align: center;
}

.hero-info-close {
  position: absolute;
  top: 14px;
  right: 18px;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--c_blue3);
  cursor: pointer;
}

.hero-info-title {
  font-family: var(--fonte-destaque);
  font-weight: 500;
  font-size: 25px;
  color: var(--c_blue3);
  margin-bottom: 6px;
}

.hero-info-subtitle {
  font-family: var(--fonte-padrao);
  font-weight: 300;
  font-size: 16px;
  color: var(--c_blue3);
  margin-bottom: 26px;
}

.hero-info-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 32px;
  margin-bottom: 22px;
}

.hero-info-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  width: 207px;
  box-sizing: border-box;
  padding: 30px 23px 15px;
  border: 1px solid var(--c_blue3);
  border-radius: 32px;
}

.hero-info-icon {
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c_blue3);
}

i.hero-info-icon {
  font-size: 32px;
}

.hero-info-card h3 {
  font-family: var(--fonte-destaque);
  font-weight: 700;
  font-size: 15px;
  color: var(--c_blue3);
}

.hero-info-card p {
  font-family: var(--fonte-padrao);
  font-weight: 400;
  font-size: 12px;
  color: var(--c_blue3);
  line-height: 1.4;
  min-height: 41px;
}

.hero-info-use {
  border: none;
  background: var(--c_red);
  color: var(--c_white3);
  font-family: var(--fonte-padrao);
  font-weight: 700;
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.hero-info-use:hover {
  background-color: #c72d10;
}

.hero-info-more {
  font-family: var(--fonte-padrao);
  font-size: 12px;
  color: var(--c_blue2);
  text-decoration: underline;
}

@media (max-width: 800px) {
  .hero-info-modal {
    padding: 28px 18px 24px;
  }

  .hero-info-cards {
    gap: 18px;
  }

  .hero-info-card {
    width: 100%;
    max-width: 260px;
  }
}
