/* ============================================
   STYLES POUR LA RECHERCHE ET LE TRI
   ============================================ */

/* Barre de recherche */
#search-factures {
  width: 100%;
  padding: 10px 15px;
  font-size: 14px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  transition: all 0.3s;
}

#search-factures:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Suggestions d'autocomplétion */
#search-suggestions {
  position: absolute;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  margin-top: 2px;
  width: calc(100% - 8px);
}

.suggestion-item {
  padding: 10px 15px;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid #f3f4f6;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover {
  background: #eff6ff;
  color: #1d4ed8;
}

/* Boutons de tri actifs */
.btn-active {
  background: #3b82f6 !important;
  color: white !important;
  border-color: #2563eb !important;
  font-weight: 700;
}

.btn-active:hover {
  background: #2563eb !important;
}

/* Animation pour le tri */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.facture-row {
  animation: fadeIn 0.2s ease-out;
}

/* Amélioration de la lisibilité du tableau */
.facture-row:hover {
  background: #f9fafb !important;
}

/* Badge de type amélioré */
.facture-row td span {
  display: inline-block;
  transition: all 0.2s;
}

.facture-row:hover td span {
  transform: scale(1.05);
}

/* Mode sombre */
body.dark-mode #search-factures {
  background: #374151;
  border-color: #4b5563;
  color: #f9fafb;
}

body.dark-mode #search-factures:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

body.dark-mode #search-suggestions {
  background: #1f2937;
  border-color: #374151;
}

body.dark-mode .suggestion-item {
  border-bottom-color: #374151;
}

body.dark-mode .suggestion-item:hover {
  background: #374151;
  color: #60a5fa;
}

/* Responsive */
@media (max-width: 768px) {
  #search-factures {
    font-size: 13px;
    padding: 8px 12px;
  }
  
  .suggestion-item {
    padding: 8px 12px;
    font-size: 13px;
  }
  
  .btn[id^="sort-"] {
    font-size: 11px;
    padding: 6px 10px;
  }
}
