/**
 * CSS spécifique à la page d'accueil (index)
 * Styles pour la liste des PDFs, upload, et autres fonctionnalités
 */

/* Empêcher la scrollbar horizontale */
.pdf-table-container {
  overflow-x: hidden !important;
  width: 100%;
}

/* S'assurer que le tableau s'adapte à l'écran */
.pdf-table {
  table-layout: fixed;
  width: 100%;
  max-width: 100%;
}

/* Styles pour les cellules de contenu long */
.pdf-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 0;
}

/* Exceptions pour les cellules qui doivent être flexibles */
.pdf-table td:first-child, /* Checkbox */
.pdf-table td:last-child {  /* Actions */
  white-space: normal;
  overflow: visible;
  width: auto;
  max-width: none;
}

/* Styles spécifiques pour les cellules de nom de fichier */
.pdf-table td:nth-child(2) {
  max-width: 250px;
  width: 30%;
}

/* Styles pour les autres cellules avec largeurs fixes */
.pdf-table td:nth-child(3) { width: 10%; } /* Type PDF */
.pdf-table td:nth-child(4) { width: 8%; }  /* Mots */
.pdf-table td:nth-child(5) { width: 8%; }  /* Zones */
.pdf-table td:nth-child(6) { width: 10%; } /* Texte extrait */
.pdf-table td:nth-child(7) { width: 10%; } /* Résumé */
.pdf-table td:nth-child(8) { width: 8%; }  /* PDF anonymisé */
.pdf-table td:nth-child(9) { width: 8%; }  /* Indexation */
.pdf-table td:nth-child(10) { width: 8%; } /* Anonymisation requise */
.pdf-table td:nth-child(11) { width: 10%; } /* Statut */

/* Réduction de 30% de la typographie pour la section listing des documents */
table.listing-pdf td, table.listing-pdf td span span, table.listing-pdf td span *, table.listing-pdf td label span {
      font-size: 0.82em;
}

table.listing-pdf td div {
      font-size: 0.9em;
}

#pdf-filters-form input, #pdf-filters-form select, #uploadList select.file-theme {
    border: 1px solid #d6d6d6;
    padding: 5px;
}



/* Ajustement des paddings pour compenser la réduction de taille */
#pdfs-container th,
#pdfs-container td {
  padding: 0.5rem 0.75rem !important;
}

/* Ajustement spécifique pour les icônes et boutons */
#pdfs-container svg {
  width: 0.8rem !important;
  height: 0.8rem !important;
}

#pdfs-container button {
  padding: 0.25rem 0.5rem !important;
}

/* Maintenir la taille des checkboxes */
#pdfs-container input[type="checkbox"] {
  width: 1rem !important;
  height: 1rem !important;
}

/* Styles pour l'en-tête du tableau */
.pdf-table th {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Pour mobile : permettre le wrap sur le titre et réduire les largeurs */
@media (max-width: 768px) {
  .pdf-table td:nth-child(2) {
    white-space: normal;
    word-break: break-word;
    max-width: 150px;
    width: 25%;
  }
  
  /* Réduire les largeurs sur mobile */
  .pdf-table td:nth-child(3) { width: 15%; }
  .pdf-table td:nth-child(4) { width: 10%; }
  .pdf-table td:nth-child(5) { display: none; } /* Masquer zones sur mobile */
  .pdf-table td:nth-child(6) { width: 15%; }
  .pdf-table td:nth-child(7) { width: 15%; }
  .pdf-table td:nth-child(8) { display: none; } /* Masquer anonymisation sur mobile */
  .pdf-table td:nth-child(9) { width: 15%; }
  
  /* Masquer aussi les en-têtes correspondants */
  .pdf-table th:nth-child(5),
  .pdf-table th:nth-child(8) {
    display: none;
  }
}

/* Styles pour le drag & drop */
.file-input-wrapper {
  position: relative;
  transition: all 0.3s ease;
}

.file-input-wrapper.drag-over {
  border-color: #3b82f6;
  background-color: #eff6ff;
  transform: scale(1.02);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.custom-file-label {
  cursor: pointer;
  transition: all 0.2s ease;
}

.custom-file-label:hover {
  background-color: #f8fafc;
  border-color: #64748b;
}

/* Animations pour les lignes du tableau */
.pdf-table-row {
  transition: all 0.3s ease;
}

.pdf-table-row:hover {
  background-color: #f8fafc;
  transform: translateX(2px);
}

.pdf-table-row.deleting {
  opacity: 0;
  transform: translateX(-20px);
  background-color: rgba(254, 202, 202, 0.3);
}

/* Styles pour les boutons d'action */
.action-button {
  padding: 0.5rem;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
  background: transparent;
  border: none;
  cursor: pointer;
}

.action-button:hover {
  background-color: rgba(0, 0, 0, 0.05);
  transform: scale(1.05);
}

.action-button.edit {
  color: #3b82f6;
}

.action-button.edit:hover {
  background-color: rgba(59, 130, 246, 0.1);
  color: #1d4ed8;
}

.action-button.delete {
  color: #ef4444;
}

.action-button.delete:hover {
  background-color: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

/* Styles pour les statuts */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  transition: all 0.2s ease;
}

.status-badge.processing {
  background-color: #fef3c7;
  color: #d97706;
}

.status-badge.completed {
  background-color: #d1fae5;
  color: #065f46;
}

.status-badge.error {
  background-color: #fee2e2;
  color: #dc2626;
}

.status-badge.waiting {
  background-color: #f3f4f6;
  color: #6b7280;
}

/* Animation de pulsation pour les éléments en traitement */
.processing-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Styles pour la barre de progression d'upload */
.upload-progress {
  width: 100%;
  height: 0.25rem;
  background-color: #e5e7eb;
  border-radius: 0.125rem;
  overflow: hidden;
}

.upload-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #1d4ed8);
  border-radius: 0.125rem;
  transition: width 0.3s ease;
  position: relative;
}

.upload-progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Styles pour les filtres */
.filter-dropdown {
  position: relative;
}

.filter-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.filter-dropdown.open .filter-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Styles pour les tooltips */
.tooltip {
  position: relative;
  cursor: help;
}

.tooltip::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: white;
  padding: 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 1000;
}

.tooltip::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(1px);
  border: 4px solid transparent;
  border-top-color: #1f2937;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.tooltip:hover::before,
.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Styles pour les checkboxes personnalisées */
.pdf-checkbox {
  appearance: none;
  width: 1rem;
  height: 1rem;
  border: 2px solid #d1d5db;
  border-radius: 0.25rem;
  background: white;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pdf-checkbox:checked {
  background: #3b82f6;
  border-color: #3b82f6;
}

.pdf-checkbox:checked::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 4px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.pdf-checkbox:hover {
  border-color: #6b7280;
}

.pdf-checkbox:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Styles pour les modales */
.modal-backdrop {
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.modal-content {
  animation: modal-appear 0.3s ease-out;
}

@keyframes modal-appear {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Styles spécifiques pour la modale d'upload */
#uploadModal {
  transition: opacity 0.3s ease-out;
  z-index: 9999;
}

#uploadModal.hidden {
  opacity: 0;
  pointer-events: none;
}

#uploadModal:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

/* Amélioration de l'apparence de la modale d'upload */
#uploadModal .modal-content {
  border: none;
  border-radius: 0;
}

/* Animation d'entrée de la modale */
#uploadModal:not(.hidden) .modal-content {
  animation: uploadModalFadeIn 0.3s ease-out;
}

@keyframes uploadModalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}


/* Styles pour les indicateurs de connexion WebSocket */
.websocket-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.websocket-indicator.connected {
  background-color: #d1fae5;
  color: #065f46;
}

.websocket-indicator.disconnected {
  background-color: #fee2e2;
  color: #dc2626;
}

.websocket-indicator::before {
  content: '';
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
}

/* Styles pour les listes de fichiers */
.file-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  background: white;
}

.file-item {
  padding: 0.75rem;
  border-bottom: 1px solid #f3f4f6;
  transition: background-color 0.2s ease;
}

.file-item:last-child {
  border-bottom: none;
}

.file-item:hover {
  background-color: #f9fafb;
}

/* Styles pour les transitions de page */
.page-transition {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s ease;
}

.page-transition.loaded {
  opacity: 1;
  transform: translateY(0);
}

/* Styles pour les compteurs animés */
.counter {
  font-variant-numeric: tabular-nums;
  transition: all 0.3s ease;
}

.counter.updating {
  color: #3b82f6;
  transform: scale(1.1);
}

/* Styles responsives */
@media (max-width: 768px) {
  .pdf-table-container {
    overflow-x: hidden;
  }
  
  .action-buttons {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .filter-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .file-input-wrapper {
    padding: 1rem;
  }
  
  .upload-list {
    margin-top: 1rem;
  }
}

/* Styles pour les animations d'apparition */
.fade-in {
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-in-right {
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Styles pour les états de chargement */
.loading-overlay {
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.loading-spinner {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Styles pour les messages d'état vide */
.empty-state {
  padding: 3rem;
  text-align: center;
  color: #6b7280;
}

.empty-state svg {
  margin: 0 auto 1rem;
  opacity: 0.5;
}

/* styles pour liste des notifications */
.list_extraction_notification {
    list-style-type: disc;
    padding-left: 1.5rem;
    margin-top: 5px;
    color: #686868;
}

/* Amélioration de l'accessibilité */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus visible pour l'accessibilité */
.focus-visible:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Styles pour le mode sombre (optionnel) */
@media (prefers-color-scheme: dark) {
  .dark-mode .status-badge.processing {
    background-color: #451a03;
    color: #fbbf24;
  }
  
  .dark-mode .status-badge.completed {
    background-color: #064e3b;
    color: #34d399;
  }
  
  .dark-mode .status-badge.error {
    background-color: #7f1d1d;
    color: #f87171;
  }
} 