/* Estilos específicos para a página de pesquisa */

/* Grid layout para cards */
.cards-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.cards-view.active {
  display: grid;
}

.grid-view {
  display: none;
}

.grid-view.active {
  display: block;
}

@media (max-width: 1200px) {
  .cards-view {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
  }
}

@media (max-width: 992px) {
  .cards-view {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
  }
}

@media (max-width: 768px) {
  .cards-view {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
  }

  .search-card {
    margin-bottom: 0;
  }
}

@media (max-width: 576px) {
  .cards-view {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* Ajustes para integração com o tema existente */
.search-container {
  margin-top: 100px; /* Compensa o header fixo */
}

/* Melhorias nos cards de resultado */
.search-card {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.search-card:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

/* Melhorias no modal */
.modal-content {
  border: none;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

/* Responsividade melhorada */
@media (max-width: 768px) {
  .search-container {
    padding: 20px 15px;
    margin: 15px 0;
  }

  .search-form {
    padding: 20px;
  }

  .form-row {
    flex-direction: column;
    gap: 10px;
  }

  .form-group {
    min-width: auto;
    margin-bottom: 10px;
  }

  .card-inner {
    gap: 10px;
    padding: 10px;
  }

  .card-thumbnail-container {
    width: 90px;
    min-height: 120px;
  }

  .snippet {
    font-size: 11px;
  }

  .card-header {
    padding: 6px 0;
  }

  .card-body {
    padding: 0;
    min-height: 50px;
  }

  .card-footer {
    padding: 6px 0 0 0;
  }

  .btn-ver-completo {
    padding: 5px 10px;
    font-size: 10px;
  }

  .card-fonte {
    font-size: 11px;
  }
}

@media (max-width: 576px) {
  .search-container {
    padding: 15px 10px;
    margin: 10px 0;
  }

  .search-form {
    padding: 15px;
    border-radius: 8px;
  }

  .card-inner {
    flex-direction: column;
    gap: 8px;
    padding: 8px;
  }

  .card-thumbnail-container {
    width: 100%;
    height: 120px;
    min-height: 120px;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 4px 0;
    gap: 4px;
  }

  .card-meta {
    font-size: 9px;
    gap: 6px;
  }

  .card-id {
    font-size: 8px;
    padding: 1px 3px;
  }

  .card-fonte {
    font-size: 11px;
    margin-bottom: 4px;
  }

  .snippet {
    font-size: 11px;
    -webkit-line-clamp: 2;
  }

  .card-footer {
    flex-direction: column;
    align-items: stretch;
    padding: 6px 0 0 0;
  }

  .btn-ver-completo {
    width: 100%;
    padding: 8px 10px;
    font-size: 10px;
  }

  .arquivo-ref {
    font-size: 9px;
    padding-bottom: 4px;
  }

  .title-box h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }

  .title-box p {
    font-size: 0.9rem;
    line-height: 1.5;
  }

  .results-header h2 {
    font-size: 1.2rem;
    margin-bottom: 12px;
  }

  .results-header {
    padding: 12px;
  }

  .badge {
    font-size: 9px;
    padding: 3px 6px;
  }

  .modal {
    padding: 10px;
  }

  .modal-content {
    width: 100%;
    margin: 0;
    max-height: 95vh;
  }
}

/* Destaque para termos encontrados */
mark {
  background-color: #fff3cd;
  padding: 2px 4px;
  border-radius: 3px;
  color: #856404;
  font-weight: 600;
}

/* Animações suaves */
.search-form {
  animation: slideInUp 0.6s ease-out;
}

.search-card {
  animation: fadeInCard 0.5s ease-out;
}

@keyframes fadeInCard {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Melhorias na acessibilidade */
.search-btn:focus,
.btn-ver-completo:focus,
input:focus,
select:focus {
  outline: 3px solid rgba(0, 123, 255, 0.3);
  outline-offset: 2px;
}

/* Estilo para loading state */
.search-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Melhorias visuais nos badges */
.badge {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Estilo para texto selecionado */
::selection {
  background-color: rgba(0, 123, 255, 0.2);
}

::-moz-selection {
  background-color: rgba(0, 123, 255, 0.2);
}

/* Tipografia com fontes serifadas para títulos */
.title-box h1,
.results-header h2,
.welcome-section h3,
.modal-title {
  font-family: "Merriweather", serif;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.title-box h1 {
  font-size: 2.5rem;
  color: #6a4f00;
  margin-bottom: 1rem;
}

.title-box p {
  font-family: "Inter", sans-serif;
  font-size: 1.1rem;
  color: #5a6c7d;
  line-height: 1.6;
}

/* Labels com ícones */
.form-group label {
  font-family: "Inter", sans-serif;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 600;
  color: #6a4f00;
  font-size: 14px;
}

.label-icon {
  color: #6a4f00;
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* Corpo do texto com fonte serifada */
.snippet,
.modal-body {
  font-family: "Merriweather", serif;
}

/* Textos da interface com fonte sem serifa */
body,
.form-group input,
.form-group select,
.btn,
.badge,
.pagination {
  font-family: "Inter", sans-serif;
}

.search-container {
  background: #f8f9fa;
  border-radius: 15px;
  padding: 30px;
  margin: 20px 0;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}
.search-form {
  background: #fff;
  padding: 25px;
  border-radius: 10px;
  margin-bottom: 30px;
  border: 1px solid #e9ecef;
}
.form-row {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}
.form-group {
  flex: 1;
  min-width: 200px;
}
.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: #6a4f00;
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 12px;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.3s;
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #6a4f00;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}
.search-btn {
      width: 100%;
    background: linear-gradient(45deg, #fabc05, #b58700);
    color: white;
    border: none;
    padding: 14px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    
    text-shadow: 0px 3px 3px rgba(104, 104, 104, 0.5);
}
.search-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(104, 104, 104, 0.9);
   filter:brightness(1.1);
}
.filters-toggle {
  background: #6a4f00;
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 5px;
  cursor: pointer;
  margin-bottom: 15px;
}
.filters-advanced {
  display: none;
}
.filters-advanced.show {
  display: block;
}
.results-header {
  background: antiquewhite;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  border-left: 4px solid #6a4f00;
}
.search-card {
  border: 1px solid #e9ecef;
  margin-bottom: 16px;
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s;
  background: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.search-card:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
  transform: translateY(-3px);
  border-color: #6a4f00;
}

.card-inner {
  display: flex;
  gap: 12px;
  padding: 12px;
  align-items: stretch;
  flex: 1;
}

.card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.card-thumbnail-container {
  flex: 0 0 auto;
  width: 100px;
  height: 100%;
  min-height: 130px;
  background: #f8f9fa;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #dee2e6;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
  display: block;
}

.search-card:hover .card-thumbnail {
  transform: scale(1.08);
}

.card-thumbnail[data-loading="true"] {
  opacity: 0.5;
}

.card-thumbnail[data-error="true"] {
  display: none;
}

.card-thumbnail-container.no-image {
  background: linear-gradient(135deg, #e9ecef 0%, #f0f0f0 100%);
  color: #adb5bd;
  font-size: 12px;
  text-align: center;
  padding: 8px;
}

.card-thumbnail-container.no-image::before {
  content: "\f03e";
  font-family: "Font Awesome 5 Free";
  font-weight: 400;
  font-size: 32px;
  color: #dee2e6;
}
.card-header {
  background: linear-gradient(90deg, #f8f9fa, #e9ecef);
  padding: 8px 0;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: #6c757d;
  font-weight: 500;
  flex-wrap: wrap;
}

.card-id {
  font-size: 9px;
  color: #adb5bd;
  background: #f8f9fa;
  padding: 2px 4px;
  border-radius: 3px;
  flex-shrink: 0;
}

.card-fonte {
  font-size: 12px;
  color: #6a4f00;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  line-height: 1.3;
}

.card-body {
  padding: 0;
  flex: 1;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.snippet {
  font-family: "Georgia", serif;
  line-height: 1.4;
  color: #495057;
  font-size: 12px;
  margin: 0;
  text-align: justify;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  padding: 8px 0 0 0;
  background: transparent;
  border-top: 1px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
}
.btn-ver-completo {
  background: #b58700;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 11px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  flex-shrink: 0;
}

.btn-ver-completo:hover {
  background: #6a4f00;
  transform: translateY(-1px);
}

.arquivo-ref {
  font-size: 10px;
  color: #6c757d;
  font-style: italic;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.3s;
}
.modal-content {
  background-color: #fff;
  margin: 3% auto;
  padding: 0;
  border-radius: 12px;
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  overflow: hidden;
  animation: slideIn 0.3s;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.modal-header {
  background: linear-gradient(45deg, #fabc05, #b58700);
  color: white;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.close {
  color: white;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  line-height: 1;
}
.close:hover {
  opacity: 0.7;
}
.modal-body {
  padding: 25px;
  max-height: 60vh;
  overflow-y: auto;
  font-family: "Georgia", serif;
  line-height: 1.7;
  font-size: 15px;
  color: #6a4f00;
}
.modal-meta {
  background: #f8f9fa;
  padding: 15px;
  margin-bottom: 20px;
  border-radius: 8px;
  border-left: 4px solid #6a4f00;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.nenhum-resultado {
  text-align: center;
  color: #6c757d;
  padding: 40px;
  background: #f8f9fa;
  border-radius: 10px;
  border: 2px dashed #dee2e6;
}
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-noticia {
  background: #d4edda;
  color: #155724;
}
.badge-anuncio {
  background: #fff3cd;
  color: #856404;
}
.badge-social {
  background: #d1ecf1;
  color: #0c5460;
}
.badge-expediente {
  background: #f8d7da;
  color: #721c24;
}
.badge-telegrama {
  background: #e2e3e5;
  color: #383d41;
}
.stats {
  display: flex;
  justify-content: space-around;
  background: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
}
.stat-item {
  text-align: center;
}
.stat-number {
  font-size: 24px;
  font-weight: bold;
  color: #6a4f00;
}
.stat-label {
  font-size: 12px;
  color: #6c757d;
  text-transform: uppercase;
}
.welcome-section {
  text-align: center;
  padding: 60px 20px;
  color: #6c757d;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 15px;
  margin: 20px 0;
}
.welcome-section h3 {
  color: #6a4f00;
  margin-bottom: 20px;
}

/* Estilos para visualização em grid */
.view-toggle {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  justify-content: center;
}
.view-btn {
  width: 100%;
    background: linear-gradient(45deg, #fabc05, #b58700);
    color: white;
    border: none;
    padding: 14px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    
    text-shadow: 0px 3px 3px rgba(104, 104, 104, 0.5);
}
.view-btn.active {
  background: #6a4f00;
  color: white;
}
.view-btn:hover {
  transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(250, 188, 5, 0.7);
    filter:brightness(1.1);
}

.grid-view {
  display: none;
}
.grid-view.active {
  display: block;
}
.cards-view.active {
  display: block;
}
.cards-view {
  display: none;
}

.results-table {
  background: white;
  border-radius: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.results-table table {
  width: 100%;
  border-collapse: collapse;
}
.results-table th {
  background: linear-gradient(45deg, #fabc05, #b58700);
  color: white;
  padding: 15px;
  text-align: left;
  font-weight: 600;
}
.results-table td {
  padding: 12px 15px;
  border-bottom: 1px solid #e9ecef;
  vertical-align: top;
  transition: background-color .16s ease, color .12s ease;
}
.results-table tr:hover {
  background: #e9ecef; /* slightly darker gray for full-row hover */
  cursor: pointer;
}
/* Keep per-cell hover neutral because row hover handles visual feedback */
.results-table td:hover {
  background: transparent;
}
.table-snippet {
  max-width: 400px;
  font-size: 13px;
  line-height: 1.4;
}
.table-meta {
  font-size: 11px;
  color: #6c757d;
}

/* Thumbnails na visualização em tabela */
.table-image-cell {
  text-align: center;
  vertical-align: middle;
  width: 120px;
  padding: 6px 8px;
}
.grid-thumbnail {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 4px;
  display: inline-block;
  border: 1px solid #e9ecef;
  transition: transform .15s ease, box-shadow .15s ease;
  cursor: pointer;
}
.grid-thumbnail:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.table-image-cell.no-image {
  background: linear-gradient(135deg,#f0f0f0,#fafafa);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  color: #6c757d;
  font-size: 12px;
}

/* Paginação */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  margin: 30px 0;
}
.pagination a,
.pagination span {
  padding: 8px 12px;
  border: 1px solid #dee2e6;
  color: #6a4f00;
  text-decoration: none;
  border-radius: 4px;
  transition: all 0.3s;
}
.pagination a:hover {
  background: #007bff;
  color: white;
  border-color: #6a4f00;
}
.pagination .current {
  background: #007bff;
  color: white;
  border-color: #6a4f00;
}
.pagination .disabled {
  color: #6c757d;
  cursor: not-allowed;
}
.pagination .disabled:hover {
  background: transparent;
  color: #6c757d;
}

/* Loading animation */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}
.loading-content {
  text-align: center;
  padding: 40px;
  background: white;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
.loading-text {
  color: #007bff;
  font-weight: 600;
  font-size: 16px;
}

/* Estilos personalizados para o slider de anos */
#ano-slider {
  height: 8px;
}

.noUi-connect {
  background: linear-gradient(90deg, #6a4f00 0%, #d4a574 100%);
}

.noUi-handle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  border: 3px solid #6a4f00;
  box-shadow: 0 2px 8px rgba(106, 79, 0, 0.3);
  cursor: pointer;
  transition: all 0.2s ease;
}

.noUi-handle:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 12px rgba(106, 79, 0, 0.4);
}

.noUi-handle:active {
  transform: scale(1.05);
}

.noUi-handle::before,
.noUi-handle::after {
  display: none;
}

.noUi-target {
  background: #e9ecef;
  border: none;
  box-shadow: none;
  border-radius: 4px;
}

.noUi-horizontal {
  height: 8px;
}

.noUi-horizontal .noUi-handle {
  top: -6px;
}

/* Botões de ação na barra de pesquisa */
.btn-search-action, .btn-filters-action {
    height: 42px;
    padding: 0 20px;
    border: none;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.btn-search-action {
    background-color: #6a4f00;
    color: white;
    min-width: 130px;
}

.btn-search-action:hover {
    background-color: #8a6d00;
}

.btn-filters-action {
    background-color: #f8f9fa;
    color: #6a4f00;
    border: 1px solid #ddd;
    min-width: 130px;
}

.btn-filters-action:hover {
    background-color: #e9ecef;
    color: #8a6d00;
}

/* Modal de Filtros Avançados - Animação via JS */
.filters-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
}

.filters-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
}

.filters-modal-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    width: 90%;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: none; /* Controlado pelo JS */
}

.filters-modal-header {
    padding: 15px 20px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filters-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #6a4f00;
    font-weight: 600;
}

.close-modal-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.close-modal-btn:hover {
    color: #333;
}

.filters-modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.filters-modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    background-color: #f8f9fa;
    text-align: right;
}

.btn-apply-filters {
    background-color: #6a4f00;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-apply-filters:hover {
    background-color: #8a6d00;
}

/* Estilo para links de arquivo */
.link-arquivo {
    color: #6c757d;
    text-decoration: none;
    transition: color 0.2s ease;
    cursor: pointer;
}

.link-arquivo:hover {
    color: #007bff;
    text-decoration: underline;
}
