/* ============================================================
   public/css/skeleton.css
   
   Design system de skeleton screens pour QualiManager
   Utilisation :
     1. Inclure ce fichier dans le <head> :
        <link rel="stylesheet" href="css/skeleton.css?v=1">
     2. Utiliser les classes : .skeleton, .skeleton-row, .skeleton-card,
        .skeleton-text, .skeleton-table, .skeleton-stat
   
   Date : 2026-05-09
   ============================================================ */

/* Animation shimmer - effet de balayage gauche-droite */
@keyframes skeleton-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Classe de base : applicable a tout element */
.skeleton {
  background: linear-gradient(
    90deg,
    #e5e7eb 0%,
    #f3f4f6 50%,
    #e5e7eb 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.6s ease-in-out infinite;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}

/* Variante : ligne de tableau */
.skeleton-row {
  height: 20px;
  width: 100%;
  margin: 8px 0;
  border-radius: 4px;
}

.skeleton-row.short  { width: 30%; }
.skeleton-row.medium { width: 60%; }
.skeleton-row.long   { width: 90%; }

/* Variante : texte (titres, paragraphes) */
.skeleton-text {
  height: 14px;
  width: 80%;
  margin: 6px 0;
}

.skeleton-text.title {
  height: 24px;
  width: 50%;
  margin-bottom: 12px;
}

/* Variante : carte/widget */
.skeleton-card {
  height: 120px;
  width: 100%;
  margin-bottom: 12px;
  border-radius: 10px;
}

/* Variante : avatar circulaire */
.skeleton-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-block;
}

/* Variante : badge / petit label */
.skeleton-badge {
  width: 60px;
  height: 20px;
  border-radius: 12px;
  display: inline-block;
}

/* Variante : bouton */
.skeleton-button {
  width: 100px;
  height: 32px;
  border-radius: 7px;
  display: inline-block;
}

/* Variante : statistique (cartes du dashboard) */
.skeleton-stat {
  height: 100px;
  border-radius: 10px;
  margin-bottom: 16px;
}

/* Composant complet : tableau skeleton */
.skeleton-table {
  width: 100%;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  padding: 0;
}

.skeleton-table .skeleton-table-header {
  display: grid;
  grid-template-columns: 40px 2fr 2fr 1fr 1fr 1fr;
  gap: 16px;
  padding: 14px 16px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.skeleton-table .skeleton-table-row {
  display: grid;
  grid-template-columns: 40px 2fr 2fr 1fr 1fr 1fr;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid #e5e7eb;
  align-items: center;
}

.skeleton-table .skeleton-table-row:last-child {
  border-bottom: none;
}

/* Composant complet : grille de cartes skeleton */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* Conteneur de page entiere skeleton (header + content) */
.skeleton-page {
  padding: 24px;
}

/* Variante decalee pour effet visuel naturel */
.skeleton-row:nth-child(2) { animation-delay: 0.1s; }
.skeleton-row:nth-child(3) { animation-delay: 0.2s; }
.skeleton-row:nth-child(4) { animation-delay: 0.3s; }
.skeleton-row:nth-child(5) { animation-delay: 0.4s; }

/* Spinner classique pour cas ou skeleton ne convient pas */
@keyframes skeleton-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.skeleton-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #e5e7eb;
  border-top-color: #1b7a43;
  border-radius: 50%;
  animation: skeleton-spin 0.8s linear infinite;
  display: inline-block;
}

.skeleton-spinner.large {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

/* Mode sombre (anticipation V1.1) */
@media (prefers-color-scheme: dark) {
  .skeleton {
    background: linear-gradient(
      90deg,
      #2d2d44 0%,
      #3f3f5e 50%,
      #2d2d44 100%
    );
    background-size: 200% 100%;
  }
}
