/* ============================================================
   CATÁLOGO DE CAPACITAÇÕES — layout, sidebar de ferramentas,
   grid de cursos 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) e no
   catálogo de inteligências artificiais. Entre os dois, tudo
   reescala de forma fluida, sem breakpoints extras.

   Baseado em static/css/catalogos/inteligencias-artificiais/style.css
   (mesma estrutura de layout/sidebar/search-bar/paginação) — a
   diferença principal é o card, que aqui é o "course-card" em
   c_blue3 em vez do card branco de ferramenta.
   ============================================================ */

/* Tamanho/distancia do header (.home-header) - centralizado em
   static/css/global/_header.css, mesmo valor pra todas as paginas do site
   (essa pagina nunca teve regra propria — por isso ficava com o padrao cru
   do _header.css, header mais baixo que o resto do site). */

/* Reset de aparência nativa — evita que o navegador desenhe cantos
   ou fundo próprios por cima do border-radius definido abaixo. */
.clear-btn,
.filter-btn,
.mobile-filters-btn,
.sidebar-close,
.page-btn,
.page-dot,
.course-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) */
.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;
}

.sidebar-close {
  display: none;
}

/* Busca por ferramenta dentro da sidebar ("Pesquise a IA") */
.tool-search {
  display: flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  padding: 6px 12px;
  margin-bottom: 14px;
  background: var(--c_white);
  border: 0.55px solid var(--c_blue3);
  border-radius: 17.6px;
}

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

.tool-search input {
  width: 100%;
  border: none;
  background: transparent;
  font-family: var(--fonte-padrao);
  font-weight: 600;
  font-size: 11px;
  color: var(--c_blue3);
  outline: none;
}

.tool-search input::placeholder {
  color: var(--c_blue3);
  font-weight: 600;
  opacity: 1;
}

/* Lista de ferramentas (vinda de "tool" em cada curso do catálogo) */
.tool-filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
}

.tool-filters label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--fonte-padrao);
  font-size: 10.45px;
  font-weight: 400;
  line-height: 200%;
  color: var(--c_white);
}

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

.tool-filters-empty {
  font-family: var(--fonte-padrao);
  font-size: 12px;
  color: var(--c_white);
  opacity: 0.7;
}

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

.clear-btn,
.filter-btn {
  flex: 1;
  border-radius: 3px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.clear-btn {
  background: transparent;
  color: var(--c_white);
  border: 1px solid var(--c_white);
}

.filter-btn {
  background: var(--c_red);
  color: var(--c_white);
  border: none;
}

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

/* ============================== CONTEÚDO ============================== */
.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 {
  grid-area: search;
  display: flex;
  align-items: center;
  gap: 14px;
  justify-self: end;
  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;
}

#searchInput {
  width: 196px;
  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;
}

/* ============================== CURSOS ============================== */
.course-grid {
  grid-area: grid;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
}

.course-card {
  position: relative;
  height: 239px;
  box-sizing: border-box;
  padding: 20px;
  background: var(--c_blue3);
  border: 1px solid var(--c_white3);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 12px;
}

.course-badge {
  position: absolute;
  top: 18px;
  box-sizing: border-box;
  padding: 5px 10px;
  background: transparent;
  border: 0.65px solid var(--c_white);
  border-radius: 32px;
  color: var(--c_white);
  font-family: var(--fonte-destaque);
  font-size: 10px;
  font-weight: 400;
  white-space: nowrap;
}

.course-badge-type {
  left: 20px;
}

.course-badge-status {
  right: 20px;
}

.course-info {
  color: var(--c_white);
  font-family: var(--fonte-destaque);
  font-size: 16px;
  font-style: normal;
  line-height: normal;
}

.course-info p {
  margin: 0;
}

.course-name,
.course-duration {
  font-weight: 500;
}

.course-tool {
  font-weight: 300;
}

.course-info p.course-tool {
  margin-top: 5px;
}

.course-btn {
  align-self: flex-end;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c_red);
  color: var(--c_white);
  font-family: var(--fonte-padrao);
  font-weight: bold;
  font-size: 16px;
  text-decoration: none;
  padding: 7px 11px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

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

/* ============================== 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;
  }

  .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;
  }

  .mobile-filters-btn.active {
    background: var(--c_blue2);
    color: var(--c_white);
    border-color: var(--c_blue2);
  }

  .search-bar {
    justify-self: end;
    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 0.2s ease;
  }

  #searchInput:focus {
    width: 141px;
  }

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

  .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;
  }

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

  .course-card {
    height: 165px;
    padding: 12px;
    gap: 8px;
  }

  .course-badge {
    top: 12px;
    padding: 3px 8px;
    font-size: 8px;
  }

  .course-badge-type {
    left: 12px;
  }

  .course-badge-status {
    right: 12px;
  }

  .course-info {
    font-size: 11px;
  }

  .course-btn {
    padding: 5px 8px;
    font-size: 11px;
  }
}
