/* Styles pour les listes d'articles */

/* Container principal */
.articles-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  overflow: visible; /* Assure que rien n'est coupé */
}

/* Grid pour les articles */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}

/* Article individuel - style carte moderne */
.article-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: all 0.3s ease;
  border: 1px solid rgba(0, 0, 0, 0.05);
  position: relative;
  animation: slideInUp 0.6s ease-out forwards;
}

.article-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* Header de la carte avec date */
.article-card__header {
  background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
  color: white;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.article-card__header::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  transform: translate(30px, -30px);
}

.article-card__date {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-block;
  margin-bottom: 1rem;
  backdrop-filter: blur(10px);
}

.article-card__title {
  color: white;
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.3;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.article-card__title a {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.3s ease;
}

.article-card__title a:hover {
  opacity: 0.9;
  color: rgba(255, 255, 255, 0.9);
}

/* Contenu de la carte */
.article-card__content {
  padding: 1.5rem;
}

.article-card__meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: #666;
}

.article-card__meta-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.article-card__meta-item i {
  color: #0073aa;
}

.article-card__meta a {
  color: #0073aa;
  text-decoration: none;
  font-weight: 500;
}

.article-card__meta a:hover {
  color: #005a87;
  text-decoration: underline;
}

.article-card__excerpt {
  color: #444;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Footer de la carte */
.article-card__footer {
  padding: 0 1.5rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.article-card__read-more {
  background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
  color: white;
  padding: 0.7rem 1.5rem;
  border-radius: 25px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 15px rgba(0, 115, 170, 0.3);
}

.article-card__read-more:hover {
  background: linear-gradient(135deg, #005a87 0%, #004066 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 115, 170, 0.4);
  color: white;
  text-decoration: none;
}

.article-card__categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.article-card__category {
  background: rgba(0, 115, 170, 0.1);
  color: #0073aa;
  padding: 0.3rem 0.8rem;
  border-radius: 15px;
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s ease;
}

.article-card__category:hover {
  background: #0073aa;
  color: white;
  text-decoration: none;
}

/* Filtres de catégories améliorés */
.category-filters {
  background: #f8f9fa;
  padding: 2rem;
  border-radius: 16px;
  margin: 2rem 0;
  text-align: center;
  position: relative;
  overflow: visible; /* Assure que les boutons ne sont pas coupés */
  z-index: 10; /* Assure que les filtres sont au-dessus des autres éléments */
}

.category-filters h3 {
  color: #333;
  margin-bottom: 1.5rem;
  font-size: 1.2rem;
  font-weight: 600;
}

.category-filters__list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
  overflow: visible; /* Assure que les boutons ne sont pas coupés */
}

.category-filter-btn {
  background: white;
  color: #666;
  padding: 0.8rem 1.5rem;
  border-radius: 25px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  border: 2px solid #e9ecef;
  font-size: 0.9rem;
}

.category-filter-btn:hover,
.category-filter-btn.active {
  background: #0073aa;
  color: white;
  border-color: #0073aa;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 115, 170, 0.3);
  text-decoration: none;
}

/* Message "aucun article" */
.no-articles {
  text-align: center;
  padding: 4rem 2rem;
  background: #f8f9fa;
  border-radius: 16px;
  margin: 2rem 0;
}

.no-articles i {
  font-size: 4rem;
  color: #ccc;
  margin-bottom: 1.5rem;
  display: block;
}

.no-articles h3 {
  color: #666;
  margin-bottom: 1rem;
}

.no-articles p {
  color: #888;
  margin-bottom: 2rem;
}

/* Pagination améliorée */
.pagination-wrapper {
  text-align: center;
  margin: 3rem 0;
}

.page-numbers {
  display: inline-flex;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.page-numbers .page-numbers {
  background: white;
  color: #666;
  padding: 0.8rem 1.2rem;
  border-radius: 8px;
  text-decoration: none;
  border: 2px solid #e9ecef;
  transition: all 0.3s ease;
  font-weight: 500;
}

.page-numbers .page-numbers:hover,
.page-numbers .current {
  background: #0073aa;
  color: white;
  border-color: #0073aa;
  text-decoration: none;
}

/* Responsif */
@media (max-width: 768px) {
  .articles-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  /* Amélioration des filtres sur mobile */
  .category-filters {
    padding: 2.5rem 1rem 1.5rem;
    margin: 1.5rem 0;
  }

  .category-filters h3 {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
  }

  .category-filters__list {
    gap: 1rem;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: visible; /* Assure que les boutons ne sont pas coupés verticalement */
    padding-bottom: 0.5rem;
    padding-top: 0.5rem; /* Ajoute un padding en haut */
    scrollbar-width: thin;
    scrollbar-color: #0073aa transparent;
  }

  .category-filters__list::-webkit-scrollbar {
    height: 6px;
  }

  .category-filters__list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
  }

  .category-filters__list::-webkit-scrollbar-thumb {
    background: #0073aa;
    border-radius: 3px;
  }

  .category-filter-btn {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: fit-content;
    position: relative;
    z-index: 15; /* Assure que les boutons sont au-dessus */
  }

  .category-filter-btn:hover,
  .category-filter-btn.active {
    transform: none; /* Supprime l'animation translateY sur mobile */
  }

  .article-card__header {
    padding: 1.2rem;
  }

  .article-card__title {
    font-size: 1.2rem;
  }

  .article-card__content {
    padding: 1.2rem;
  }

  .article-card__footer {
    padding: 0 1.2rem 1.2rem;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .article-card__read-more {
    text-align: center;
    justify-content: center;
  }
}

/* Responsif pour très petits écrans */
@media (max-width: 480px) {
  .articles-container {
    padding: 0 15px;
  }

  .category-filters {
    padding: 2.5rem 0.5rem 1rem;
    margin: 1rem 0;
    position: relative;
    overflow: visible; /* Assure que les boutons ne sont pas coupés */
    z-index: 10; /* Assure que les filtres sont au-dessus */
  }

  /* Indicateur de défilement pour les filtres sur mobile */
  .category-filters::after {
    content: "←→";
    position: absolute;
    right: 10px;
    top: 20px;
    background: rgba(0, 115, 170, 0.1);
    color: #0073aa;
    padding: 0.3rem 0.6rem;
    border-radius: 15px;
    font-size: 0.7rem;
    font-weight: bold;
    opacity: 0.8;
    animation: pulse 2s infinite;
  }

  .category-filters__list {
    gap: 0.6rem;
    padding: 0.5rem 0.5rem; /* Padding uniforme en haut et en bas */
    margin-top: 1rem;
    overflow-x: auto;
    overflow-y: visible; /* Assure que les boutons ne sont pas coupés */
  }

  .category-filter-btn {
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
    border-radius: 20px;
    position: relative;
    z-index: 15; /* Assure que les boutons sont au-dessus */
  }

  .category-filter-btn:hover,
  .category-filter-btn.active {
    transform: none; /* Supprime l'animation translateY sur très petits écrans */
  }

  .articles-grid {
    gap: 1rem;
  }

  .article-card__header {
    padding: 1rem;
  }

  .article-card__title {
    font-size: 1.1rem;
  }

  .article-card__content {
    padding: 1rem;
  }

  .article-card__footer {
    padding: 0 1rem 1rem;
  }

  .article-card__read-more {
    padding: 0.6rem 1.2rem;
    font-size: 0.85rem;
  }
}

/* Animation pulse pour l'indicateur de défilement */
@keyframes pulse {
  0%,
  100% {
    opacity: 0.8;
  }
  50% {
    opacity: 0.4;
  }
}

/* Animation d'apparition */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Délai d'animation pour effet cascadé */
.article-card:nth-child(1) {
  animation-delay: 0.1s;
}
.article-card:nth-child(2) {
  animation-delay: 0.2s;
}
.article-card:nth-child(3) {
  animation-delay: 0.3s;
}
.article-card:nth-child(4) {
  animation-delay: 0.4s;
}
.article-card:nth-child(5) {
  animation-delay: 0.5s;
}
.article-card:nth-child(6) {
  animation-delay: 0.6s;
}

/* Améliorations supplémentaires */

/* Style spécial pour les articles en vedette (sticky posts) */
.article-card.sticky {
  border: 3px solid #0073aa;
  position: relative;
}

.article-card.sticky::before {
  content: "Article en vedette";
  position: absolute;
  top: -12px;
  left: 20px;
  background: #0073aa;
  color: white;
  padding: 0.3rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  z-index: 10;
}

/* Indicateur de lecture estimée */
.article-card__reading-time {
  color: #888;
  font-size: 0.85rem;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Styles pour la search page */
.search-results .articles-grid {
  margin-top: 2rem;
}

.search-highlight {
  background: yellow;
  padding: 0.1rem 0.2rem;
  border-radius: 3px;
}

/* Animation de chargement pour les articles */
.article-card.loading {
  opacity: 0.6;
  pointer-events: none;
}

.article-card.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #0073aa;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  transform: translate(-50%, -50%);
}

@keyframes spin {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}
