/* ===== SKELETON LOADERS - États de chargement ===== */

/* Animation de base */
@keyframes skeleton-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes skeleton-shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* Classes de base */
.skeleton {
  background: linear-gradient(
    90deg,
    #f0f0f0 0%,
    #f8f8f8 20%,
    #f0f0f0 40%,
    #f0f0f0 100%
  );
  background-size: 1000px 100%;
  animation: skeleton-shimmer 2s infinite linear;
  border-radius: 8px;
  display: inline-block;
}

.dark-theme .skeleton {
  background: linear-gradient(
    90deg,
    #1e293b 0%,
    #334155 20%,
    #1e293b 40%,
    #1e293b 100%
  );
}

/* Skeleton pour texte */
.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
  border-radius: 4px;
  width: 100%;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-text.medium {
  width: 80%;
}

.skeleton-text.long {
  width: 95%;
}

/* Skeleton pour titres */
.skeleton-title {
  height: 2em;
  margin-bottom: 1em;
  border-radius: 8px;
  width: 70%;
}

.skeleton-subtitle {
  height: 1.5em;
  margin-bottom: 0.75em;
  border-radius: 6px;
  width: 50%;
}

/* Skeleton pour images */
.skeleton-image {
  width: 100%;
  height: 200px;
  border-radius: 12px;
}

.skeleton-image.small {
  height: 120px;
}

.skeleton-image.large {
  height: 300px;
}

/* Skeleton pour avatars */
.skeleton-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton-avatar.small {
  width: 32px;
  height: 32px;
}

.skeleton-avatar.large {
  width: 64px;
  height: 64px;
}

/* Skeleton pour cards */
.skeleton-card {
  padding: 20px;
  background: #ffffff;
  border: 1px solid #e9eef5;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

.dark-theme .skeleton-card {
  background: #1e293b;
  border-color: #334155;
}

.skeleton-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.skeleton-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Skeleton pour météo cards */
.skeleton-weather-card {
  min-width: 200px;
  height: 250px;
  border-radius: 16px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.skeleton-weather-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: skeleton-slide 2s infinite;
}

@keyframes skeleton-slide {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Skeleton pour liste */
.skeleton-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid #e9eef5;
  border-radius: 12px;
}

.dark-theme .skeleton-list-item {
  background: #1e293b;
  border-color: #334155;
}

.skeleton-list-item-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Skeleton pour grille */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

/* Skeleton pour tableau */
.skeleton-table {
  width: 100%;
  border-collapse: collapse;
}

.skeleton-table-row {
  display: flex;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid #e9eef5;
}

.dark-theme .skeleton-table-row {
  border-bottom-color: #334155;
}

.skeleton-table-cell {
  flex: 1;
}

/* Skeleton pour formulaire */
.skeleton-form-group {
  margin-bottom: 20px;
}

.skeleton-label {
  height: 1em;
  width: 30%;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-input {
  height: 48px;
  width: 100%;
  border-radius: 12px;
}

.skeleton-button {
  height: 44px;
  width: 150px;
  border-radius: 999px;
}

/* Container pour skeleton */
.skeleton-container {
  animation: skeleton-pulse 2s ease-in-out infinite;
}

/* États de chargement spécifiques */
.loading-state {
  position: relative;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-state::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(2px);
  z-index: 10;
}

.dark-theme .loading-state::before {
  background: rgba(15, 23, 42, 0.8);
}

/* Spinner de chargement */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e9eef5;
  border-top-color: #1E90FF;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  position: relative;
  z-index: 11;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Transition entre skeleton et contenu réel */
.skeleton-fade-out {
  animation: fade-out 0.3s ease-out forwards;
}

@keyframes fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.content-fade-in {
  animation: fade-in 0.3s ease-in forwards;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 640px) {
  .skeleton-grid {
    grid-template-columns: 1fr;
  }
  
  .skeleton-weather-card {
    min-width: 100%;
  }
}
