/* =========================================================================
    ESTILOS DO FRONTEND (SHORTCODE)
    ========================================================================= */

:root { --custom-primary: #f87316; }

/* ----------- ELEMENTOS DE FILTRO ----------- */
#filtro-documentos-container .border-custom-primary { border-color: var(--custom-primary); }
#filtro-documentos-container .text-custom-primary { color: var(--custom-primary); }

.filtro-select{
  -webkit-appearance:none;-moz-appearance:none;appearance:none;
  background-image:url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="%23f87316" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>');
  background-repeat:no-repeat;background-position:right .75rem center;background-size:1.25em;
  padding-right:2.5rem;color:#6B7280;border:2px solid var(--custom-primary);border-radius:.75rem;
  padding-left:.75rem;background-color:#F9FAFB;width:100%;height:3.5rem;transition:all 300ms;
}
.filtro-select.user-has-selected{color:#1F2937;}
.filtro-select optgroup{font-weight:bold;color:#111827;}
.filtro-select option{font-weight:normal;color:#374151;padding:2px 0;}

#filtro-documentos-container .btn-ano{background:transparent!important;border:none!important;cursor:pointer;color:var(--custom-primary);padding:.25rem;border-radius:9999px;line-height:1;}
#filtro-documentos-container .btn-ano:hover{background-color:rgba(248,115,22,.1)!important;}

.fdi-checkbox-label{display:inline-flex;align-items:center;cursor:pointer;user-select:none;color:#374151;}
.fdi-checkbox{display:none;}
.fdi-checkbox-custom{width:1.25rem;height:1.25rem;border:2px solid var(--custom-primary);border-radius:.25rem;margin-right:.5rem;display:flex;align-items:center;justify-content:center;transition:background-color 150ms ease-in-out;}
.fdi-checkbox-custom::after{content:'✓';color:#fff;font-size:1rem;line-height:1;opacity:0;transition:opacity 150ms ease-in-out;}
.fdi-checkbox:checked + .fdi-checkbox-custom{background-color:var(--custom-primary);}
.fdi-checkbox:checked + .fdi-checkbox-custom::after{opacity:1;}

.filter-button{background:#fff;color:#374151;font-weight:700;padding:.5rem 1.5rem;border-radius:9999px;border:2px solid var(--custom-primary);cursor:pointer;transition:all 150ms ease-in-out;}
.filter-button:hover{
  background: #fff;
  color: var(--custom-primary);
}
.filter-button.active{background:var(--custom-primary);color:#fff;box-shadow:0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);}

/* =========================================================================
    TABELA – LIMPA, SEM ZEBRA E SEM LINHAS VERTICAIS
    ========================================================================= */

#filtro-documentos-container .fdi-tabela{
  width:100%;
  border-collapse:separate!important;
  border-spacing:0;
  background:#fff!important;
  table-layout:fixed; /* 'fixed' para larguras funcionarem */
  font-size:16px;
}

/* ZERA QUALQUER ZEBRA/CORES DE LINHA DO TEMA/TAILWIND */
#filtro-documentos-container .fdi-tabela tr,
#filtro-documentos-container .fdi-tabela tr:nth-child(even),
#filtro-documentos-container .fdi-tabela tr:nth-child(odd),
#filtro-documentos-container .fdi-tabela tbody tr:hover,
#filtro-documentos-container .fdi-tabela thead tr {
  background:#fff!important;
}

/* Cabeçalho */
#filtro-documentos-container .fdi-tabela thead th{
  font-weight:700;color:#111827;font-size:16px;
  padding:14px 0;
  border-bottom:1px solid #e5e7eb!important;
  text-align:left;
  border-top:none!important;border-left:none!important;border-right:none!important;
  background:#fff!important;
}

/* Células */
#filtro-documentos-container .fdi-tabela tbody td{
  padding:18px 0;
  font-size:16px;color:#374151;
  vertical-align:middle; /* ALINHAMENTO VERTICAL DESKTOP */
  background:#fff!important;
  border-bottom:1px solid #e5e7eb!important;    /* só linha horizontal suave */
  border-top:none!important;border-left:none!important;border-right:none!important;
}

/* Remove quaisquer bordas da tabela padrão do tema */
#filtro-documentos-container .fdi-tabela,
#filtro-documentos-container .fdi-tabela *{
  border-left:0!important;border-right:0!important;
}

/* Links (arquivo) */
#filtro-documentos-container .fdi-tabela td a{
  color:var(--custom-primary);text-decoration:none;font-weight:700;
  display:inline-flex;align-items:center;gap:6px;
}
#filtro-documentos-container .fdi-tabela td a:hover{text-decoration:underline;}
#filtro-documentos-container .fdi-tabela td svg{vertical-align:middle;}


/* LARGURA DAS COLUNAS (Desktop 50/25/25) */
#filtro-documentos-container .fdi-tabela th:nth-child(1),
#filtro-documentos-container .fdi-tabela td:nth-child(1) {
  width: 50%;
}
#filtro-documentos-container .fdi-tabela th:nth-child(2),
#filtro-documentos-container .fdi-tabela td:nth-child(2) {
  width: 25%;
}
#filtro-documentos-container .fdi-tabela th:nth-child(3),
#filtro-documentos-container .fdi-tabela td:nth-child(3) {
  width: 25%;
}


/* =======================================================
   NOVO: TABELA RESPONSIVA (Layout de Card no Celular) 
   ======================================================= */
@media (max-width: 768px) {
  /* Mostra o cabeçalho no celular */
  #filtro-documentos-container .fdi-tabela thead {
    display: table-header-group;
    border: none;
    border-bottom: 1px solid #e5e7eb; /* Linha do header */
  }
  
  /* ALTERADO: Headers (Nome 70% e Serviço 30%) */
  #filtro-documentos-container .fdi-tabela thead th:nth-child(1) {
    width: 70%;
    padding-bottom: 0.5rem;
    font-weight: 700;
  }
  #filtro-documentos-container .fdi-tabela thead th:nth-child(2) {
    display: table-cell;
    width: 30%;
    padding-bottom: 0.5rem;
    font-weight: 700;
  }
  
  /* Esconde o header "Arquivo" */
  #filtro-documentos-container .fdi-tabela thead th:nth-child(3) {
    display: none;
  }

  /* Transforma a linha em um container flexível */
  #filtro-documentos-container .fdi-tabela tr {
    display: flex;
    flex-wrap: wrap; 
    width: 100%;
    border: none; /* Remove borda da linha */
    margin-bottom: 0;
    padding: 1rem 0 0 0; /* Padding só no topo de cada item */
  }

  /* Remove a borda padrão de TODAS as células tbody (que era a linha desktop) */
  #filtro-documentos-container .fdi-tabela tbody td {
    border-bottom: none !important; 
    padding: 0; /* Limpa padding desktop */
    vertical-align: middle; /* ALTERADO: Alinhamento vertical mobile */
  }

  /* Célula 1 (Nome) - ALTERADO para 70% */
  #filtro-documentos-container .fdi-tabela td:nth-child(1) {
    width: 70%;
    font-weight: normal; 
    font-size: 1rem;
    color: #374151;
    padding-right: 10px; 
    padding-bottom: 1rem; /* Espaço antes da linha */
  }
  
  /* Célula 2 (Serviço) - ALTERADO para 30% */
  #filtro-documentos-container .fdi-tabela td:nth-child(2) {
    width: 30%;
    font-size: 0.95rem;
    color: #6B7280;
    padding-bottom: 1rem; /* Espaço antes da linha */
  }
  
  /* Célula 3 (Arquivo/Link) - com a linha divisória ACIMA */
  #filtro-documentos-container .fdi-tabela td:nth-child(3) {
     width: 100%;
     text-align: center;
     padding: 1rem 0; /* Espaço em cima e em baixo do link */
     border-top: 1px solid #e5e7eb !important; /* A LINHA DIVISÓRIA */
  }
}


/* =========================================================================
    PAGINAÇÃO
    ========================================================================= */
.fdi-pagination{display:flex;gap:.5rem;justify-content:center;align-items:center;margin-top:1rem;flex-wrap:wrap;}
.fdi-page-link{padding:.4rem .8rem;border:1px solid #e5e7eb;border-radius:.5rem;background:#fff;color:#111827;cursor:pointer;font-weight:600;font-size:15px;}
.fdi-page-link.active{background:var(--custom-primary);color:#fff;}
.fdi-page-link[disabled],.fdi-page-link:disabled{opacity:.45;cursor:not-allowed;}

/* =========================================================================
    ADMIN (correção do checkbox duplo na meta box de cidades)
    ========================================================================= */

body.post-type-documento #postbox-container-1,
body.post-type-documento #rank_math_metabox,
body.post-type-documento #slugdiv,
body.post-type-documento .page-title-action,
body.post-type-documento #titlediv,
body.post-type-documento .update-nag{display:none!important;}

body.post-type-documento #post-body.columns-2 #post-body-content{width:100%;float:none;margin-right:0;}
body.post-type-documento #fdi_meta{background:#fff;border-radius:8px;border:1px solid #ccd0d4;box-shadow:0 1px 1px rgba(0,0,0,.04);}
body.post-type-documento #fdi_meta .inside{padding:20px;margin:0;}
.fdi-fields-wrapper{display:grid;grid-template-columns:repeat(4,1fr);gap:20px;}
.fdi-field{display:flex;flex-direction:column;}
.fdi-field-full{grid-column:1 / -1;}
.fdi-field label{font-weight:600;color:#333;margin-bottom:8px;font-size:14px;}
.fdi-field #upload_arquivo_button{background:#2271b1;border-color:#2271b1;color:#fff;cursor:pointer;width:fit-content;}
#arquivo_nome{margin-top:10px;color:#666;font-size:13px;}
.fdi-field input[type="number"], .fdi-field select, #fdi-title-container #title{
  width:100%;padding:0 12px;border-radius:6px;border:1px solid #ccd0d4;box-sizing:border-box;font-size:14px;height:44px;background:#fff;box-shadow:inset 0 1px 2px rgba(0,0,0,.07);color:#32373c;
}

/* Título movido */
#fdi-title-container{grid-column:1 / -1;}
#fdi-title-container #titlediv{display:block!important;}
#fdi-title-container #titlewrap{position:relative;}
#fdi-title-container #title-prompt-text{display:none;}
#fdi-title-container #title{font-size:1.2em;}
#fdi-title-container #titlediv .inside{display:none;}

/* Caixa de cidades movida */
#fdi-cidades-container{border:1px solid #ccd0d4;border-radius:6px;padding:15px;background:#fff;}
#fdi-cidades-container .tabs-panel{max-height:none;overflow:visible;}
#fdi-cidades-container .categorychecklist{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:0 16px;list-style:none;padding:0;margin:0;}
#fdi-cidades-container .categorychecklist li label{display:flex;align-items:flex-start;gap:.5em;}

/* ⛑️ Corrige checkbox com "check" duplicado no WP-Admin */
#fdi-cidades-container .categorychecklist li input[type="checkbox"]{
  -webkit-appearance:checkbox!important;appearance:checkbox!important;
  position:static!important; /* evita overlays absolutos do tema */
  width:16px;height:16px;margin-top:.2em;flex-shrink:0;
  border:1px solid #8c8f94;background:#fff;
  box-shadow:none!important;background-image:none!important;
}
#fdi-cidades-container .categorychecklist li input[type="checkbox"]::before,
#fdi-cidades-container .categorychecklist li input[type="checkbox"]::after{
  content:none!important; /* remove pseudo-ícone do WP/tema */
}

/* Hierarquia das listas */
#fdi-cidades-container .children{margin:10px 0 10px 20px;border-left:2px solid #eee;padding-left:15px;grid-column:1 / -1;}
#fdi-cidades-container .toggle-select-cidades{margin-bottom:15px;}

/* Publicação movida */
body.post-type-documento #submitdiv{grid-column:1 / -1;display:block!important;background:transparent!important;border:none!important;box-shadow:none!important;padding:0!important;margin-top:20px;}
body.post-type-documento #submitdiv .postbox-header,
body.post-type-documento #submitdiv .hndle,
body.post-type-documento #submitdiv .handlediv,
body.post-type-documento #submitdiv .handle-actions,
body.post-type-documento #submitdiv #minor-publishing,
body.post-type-documento #submitdiv #delete-action{display:none!important;}
body.post-type-documento #submitdiv .inside,
body.post-type-documento #submitdiv #submitpost{padding:0!important;margin:0!important;background:transparent!important;}
body.post-type-documento #major-publishing-actions{padding:0!important;margin-top:20px;display:flex;justify-content:flex-end;border:none!important;background:transparent!important;}
body.post-type-documento #submitdiv #publishing-action #publish{float:none;font-size:14px;padding:8px 24px;height:auto;}