/* ================================================================================
   TABLE COMPONENTS - VERSION REFACTORISÉE
   ================================================================================

   Styles pour les tableaux avec effet glassmorphism moderne
   Utilise le système de variables CSS défini dans style.css

   SECTIONS :
   1. Container
   2. Tableau Principal
   3. En-tête (thead)
   4. Corps (tbody)
   5. Cellules (td)
   6. Effets Hover & Interactions
   7. Utilitaires
   8. Responsive
   9. Accessibilité

   ================================================================================ */

/* ========================================
   1. CONTAINER
   ======================================== */

.table-container {
  width: 100%;
  max-width: 1200px;
  margin: var(--spacing-xl) auto;
  overflow-x: auto;
  border-radius: var(--radius-xl);
}

/* ========================================
   2. TABLEAU PRINCIPAL
   ======================================== */

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--font-family);
  font-size: var(--font-size-md);

  /* Effet glass */
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.1),
    rgba(255, 255, 255, 0.25));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

/* ========================================
   3. EN-TÊTE (thead)
   ======================================== */

thead {
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.15),
    rgba(255, 255, 255, 0.3),
    rgba(255, 255, 255, 0.15));
}

th {
  padding: var(--spacing-md) var(--spacing-lg);
  text-align: left;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.3);
  position: relative;
}

th:first-child {
  border-top-left-radius: var(--radius-xl);
}

th:last-child {
  border-top-right-radius: var(--radius-xl);
}

/* Séparateurs entre colonnes */
th:not(:last-child)::after,
td:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 25%;
  height: 50%;
  width: 1px;
  background: linear-gradient(180deg,
    transparent,
    rgba(0, 0, 0, 0.08) 50%,
    transparent);
}

/* ========================================
   4. CORPS (tbody)
   ======================================== */

tbody tr {
  transition: all var(--transition-normal);
  cursor: pointer;
  position: relative;
}

/* Alternance de lignes */
tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.05);
}

tbody tr:last-child td:first-child {
  border-bottom-left-radius: var(--radius-xl);
}

tbody tr:last-child td:last-child {
  border-bottom-right-radius: var(--radius-xl);
}

/* ========================================
   5. CELLULES (td)
   ======================================== */

td {
  padding: var(--spacing-md) var(--spacing-lg);
  color: var(--text-primary);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: all var(--transition-normal);
  position: relative;
}

tbody tr:last-child td {
  border-bottom: none;
}

/* ========================================
   6. EFFETS HOVER & INTERACTIONS
   ======================================== */

tbody tr:hover {
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.85),
    rgba(255, 255, 255, 0.95));
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.15),
    0 4px 8px rgba(0, 0, 0, 0.1);
  z-index: 10;
  border-radius: var(--radius-md);
}

tbody tr:hover td {
  font-weight: var(--font-weight-semibold);
  color: #1a1a1a;
}

/* Flou sur les autres lignes au hover */
tbody:hover tr:not(:hover) {
  opacity: 0.5;
  filter: blur(1px);
  transform: scale(0.98);
}

/* Effet clic */
tbody tr:active {
  transform: translateY(0) scale(1);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.2),
    inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ========================================
   7. UTILITAIRES
   ======================================== */

/* Cellules numériques */
.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Cellules centrées */
.center {
  text-align: center;
}

/* Contenu long */
.long-content {
  max-width: 200px;
  overflow-wrap: break-word;
}

/* ========================================
   8. RESPONSIVE
   ======================================== */

@media (max-width: 990px) {
  table {
    font-size: var(--font-size-base);
  }

  th, td {
    padding: 10px var(--spacing-md);
  }

  th {
    font-size: var(--font-size-xs);
  }

  tbody tr:hover {
    transform: scale(1.01);
  }
}

@media (max-width: 640px) {
  .table-container {
    margin: var(--spacing-lg) 0;
  }

  table {
    font-size: var(--font-size-sm);
  }

  th, td {
    padding: var(--spacing-sm) 10px;
  }
}

/* ========================================
   9. ACCESSIBILITÉ
   ======================================== */

/* Focus visible pour navigation clavier */
tbody tr:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

/* Réduction des animations pour utilisateurs sensibles */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* ========================================
   FIN DU FICHIER TABLE COMPONENTS

   Ce fichier est maintenant harmonisé avec le système de design :
   - Utilise les variables CSS communes (spacing, radius, font-size, etc.)
   - Transitions cohérentes avec le reste de l'application
   - Nomenclature unifiée
   - Support accessibilité complet
   ======================================== */
