/* =============================================================================
   GESTOR DE DOWNLOADS — Estilos Públicos
   Prefixo: gd-  (evita conflito com outros plugins/temas)
   Baseado no padrão visual do Gestor de Licitações
============================================================================= */

/* --- 1. CONTAINER E TIPOGRAFIA --- */
.gd-portal-wrapper {
  font-family: "Segoe UI", Roboto, sans-serif;
  text-align: center;
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.gd-title {
  font-size: 2rem;
  color: #1a3a5c;
  font-weight: 300;
  margin-bottom: 10px;
}

.gd-subtitle {
  color: #666;
  margin-bottom: 30px;
  font-size: 1rem;
}

/* --- 2. GRID DE CATEGORIAS/ANOS --- */
.gd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 280px));
  gap: 20px;
  justify-content: center;
  margin: 0 auto 30px;
}

.gd-card {
  background: #fff;
  border: 1px solid #e0e8f0;
  padding: 30px 18px;
  text-decoration: none;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
  transition: 0.25s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.gd-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(0, 55, 120, 0.12);
  border-color: #003778;
}

.gd-icon .dashicons {
  font-size: 40px;
  color: #003778;
  margin-bottom: 12px;
  width: 40px;
  height: 40px;
  line-height: 1;
}

.gd-text {
  font-size: 13px;
  font-weight: 700;
  color: #003778;
  text-transform: uppercase;
  line-height: 1.4;
  text-align: center;
}

.gd-card-desc {
  font-size: 11px;
  color: #888;
  margin-top: 8px;
  text-align: center;
}

/* --- 3. BOTÕES DE DOWNLOAD --- */
.gd-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  background-color: #003778;
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.88rem;
  transition: 0.25s;
  margin: 4px 4px 4px 0;
}

.gd-btn:hover {
  background-color: #002558;
  color: #fff;
}

.gd-btn .dashicons {
  font-size: 18px;
  width: 18px;
  height: 18px;
}

/* Botão "responsivo": ocupa toda a largura do conteúdo disponível,
   em vez de só o tamanho do texto (escolhido no cadastro do download). */
.gd-btn.gd-btn--full {
  display: flex;
  width: 100%;
  justify-content: center;
  box-sizing: border-box;
}

/* Wrapper gerado pelo shortcode [gd_botao]. Precisa ser um elemento de
   bloco para que a centralização/max-width de largura do tema funcione
   (veja comentário em gd_shortcode_botao, no shortcode.php). */
.gd-botao-shortcode {
  display: block;
  max-width: 100%;
}

.gd-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #003778;
  text-decoration: underline;
  font-size: 0.9rem;
  margin: 2px 8px 2px 0;
}

.gd-link:hover {
  color: #002558;
}

.gd-contador {
  font-size: 0.75em;
  opacity: 0.75;
  margin-left: 2px;
}

.gd-btn-back {
  display: inline-block;
  padding: 9px 18px;
  background-color: #eef2f7;
  color: #003778;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: 0.25s;
}

.gd-btn-back:hover {
  background-color: #003778;
  color: #fff;
}

/* --- 4. BUSCA --- */
.gd-search-form {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 auto 25px;
  max-width: 700px;
  flex-wrap: wrap;
}

.gd-search-input {
  flex: 1;
  min-width: 220px;
  padding: 10px 14px;
  border: 1px solid #ccd8e8;
  border-radius: 4px;
  font-size: 0.95rem;
  outline: none;
  transition: border 0.2s;
}

.gd-search-input:focus {
  border-color: #003778;
}

.gd-search-btn {
  padding: 10px 20px;
  background: #003778;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: 0.2s;
}

.gd-search-btn:hover {
  background: #002558;
}

/* --- 5. CARDS DE ARQUIVOS (lista e portal) --- */
.gd-cards-grid,
.gd-lista-embutida .gd-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  text-align: left;
  margin-top: 10px;
}

.gd-card-download {
  background: #fff;
  border: 1px solid #dde6f0;
  border-radius: 6px;
  padding: 18px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s;
}

.gd-card-download:hover {
  border-color: #003778;
}

.gd-card-thumb img {
  width: 100%;
  height: 130px;
  object-fit: contain;
  border-radius: 4px;
  background: #f8fafd;
}

.gd-card-nome {
  font-weight: 700;
  color: #003778;
  font-size: 1rem;
}

.gd-card-desc-texto {
  font-size: 0.85rem;
  color: #777;
  line-height: 1.5;
}

.gd-botoes-grupo {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.gd-lista-titulo {
  color: #1a3a5c;
  font-weight: 400;
  margin-bottom: 14px;
  text-align: left;
}

.gd-empty {
  text-align: center;
  color: #888;
  padding: 30px 0;
  grid-column: 1 / -1;
}

/* --- 6. BREADCRUMB --- */
.gd-breadcrumb {
  padding: 8px 0;
  margin-bottom: 20px;
  font-size: 0.88rem;
  color: #888;
  text-align: left;
}

.gd-breadcrumb a {
  color: #003778;
  text-decoration: none;
}

.gd-breadcrumb a:hover {
  text-decoration: underline;
}

.gd-breadcrumb .sep {
  margin: 0 7px;
  color: #ccc;
}

.gd-breadcrumb span {
  color: #333;
  font-weight: 600;
}

/* --- 7. COMPATIBILIDADE COM O BLOCO "SHORTCODE" / "HTML PERSONALIZADO" ---
   Alguns temas não aplicam o recuo/padding do conteúdo a esses blocos
   (só aplicam a parágrafos, títulos etc.), fazendo o botão "colar" na
   borda da página. Isso reaproveita a variável de padding que os temas
   de bloco (FSE) já definem, com um valor de reserva para os demais. */
.wp-block-shortcode,
.wp-block-html {
  padding-left: var(--wp--style--root--padding-left, 24px);
  padding-right: var(--wp--style--root--padding-right, 24px);
  box-sizing: border-box;
}

/* --- 8. RESPONSIVIDADE --- */
@media (max-width: 768px) {
  .gd-search-form {
    flex-direction: column;
    align-items: stretch;
  }

  .gd-search-btn {
    justify-content: center;
  }

  .gd-cards-grid {
    grid-template-columns: 1fr;
  }
}
