/* Styles optimisés pour la page des catégories */

/* Structure de base */
.categories-page {
  margin: 0 auto;
  padding: 20px 15px;
  max-width: 1400px;
}

/* Header avec logo et recherche */
.logo-header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 20px 0;
  padding: 15px;
}

.logo-header img {
  max-width: 200px;
  height: auto;
  transition: transform 0.3s ease;
}

.logo-header img:hover {
  transform: scale(1.05);
}

.nav-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  margin-bottom: 20px;
}

.nav-header .search-box {
  max-width: 600px;
  width: 100%;
  position: relative;
}

.nav-header .search-box form {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 25px;
  padding: 5px;
  backdrop-filter: blur(10px);
}

.nav-header .input-search {
  flex: 1;
  border: none;
  background: transparent;
  color: #fff;
  padding: 12px 20px;
  font-size: 16px;
  outline: none;
}

.nav-header .input-search::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.nav-header .btn-search {
  background: #ff0000;
  border: none;
  color: white;
  padding: 12px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-header .btn-search:hover {
  background: #cc0000;
  transform: scale(1.05);
}

/* En-tête de la page */
.section-header {
  margin-bottom: 30px;
  text-align: center;
  background: rgba(0, 0, 0, 0.3);
  padding: 30px 20px;
  border-radius: 12px;
}

.section-header h1 {
  font-size: 2.2rem;
  margin: 0 0 20px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.section-header i {
  color: #ff0000;
}

.categories-stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.3);
  padding: 10px 20px;
  border-radius: 20px;
  color: #fff;
  font-size: 0.95rem;
}

.stat-item i {
  color: #ff0000;
}

/* Section des filtres optimisée */
.categories-filters {
  margin-bottom: 30px;
  background: rgba(0, 0, 0, 0.2);
  padding: 20px;
  border-radius: 10px;
  backdrop-filter: blur(5px);
}

.filters-form {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: flex-end;
  justify-content: space-between;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 140px;
  flex: 1;
}

.filter-group label {
  font-size: 0.9rem;
  color: #ccc;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.filter-group select {
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 12px 40px 12px 15px;
  font-size: 0.95rem;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filter-group select:hover {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 0, 0, 0.3);
  transform: translateY(-1px);
}

.filter-group select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.2);
  border-color: #ff0000;
}

.btn-filter {
  background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 120px;
  box-shadow: 0 3px 6px rgba(255, 0, 0, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-filter:hover {
  background: linear-gradient(135deg, #ff2020 0%, #dd0000 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(255, 0, 0, 0.4);
}

.btn-filter:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(255, 0, 0, 0.3);
}

/* Grille des catégories optimisée */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 25px;
  margin-bottom: 30px;
  padding: 0 5px;
}

.category-card {
  overflow: hidden;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  height: 100%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(5px);
  will-change: transform, box-shadow;
}

.category-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
  background: rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 0, 0, 0.2);
}

.category-card a {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  height: 100%;
  color: #fff;
  outline: none;
}

.category-card a:focus {
  outline: 2px solid #ff0000;
  outline-offset: 2px;
}

.category-img-container {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: linear-gradient(45deg, #1a1a1a 25%, #2a2a2a 50%, #1a1a1a 75%);
}

.category-img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.category-card:hover .category-img-container img {
  transform: scale(1.1);
}

.category-videos-count {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.category-videos-count i {
  color: #ff0000;
  font-size: 0.9rem;
}

.category-card h2 {
  padding: 16px;
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  transition: color 0.3s ease;
  line-height: 1.4;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  background: rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
}

.category-card:hover h2 {
  color: #ff2020;
  text-shadow: 0 0 8px rgba(255, 32, 32, 0.5);
}

/* Pagination */
.pagination-container {
  margin-top: 40px;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.page-item {
  margin: 0;
}

.page-link {
  min-width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.3s ease;
  padding: 0 10px;
  font-weight: 500;
}

.page-link:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  color: #fff;
}

.page-item.active .page-link {
  background: #ff0000;
  color: #fff;
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.3);
}

.page-link span {
  color: #aaa;
}

/* Message quand pas de résultats */
.no-results {
  grid-column: 1 / -1;
  padding: 40px 20px;
  text-align: center;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  color: #aaa;
}

.no-results i {
  font-size: 3rem;
  margin-bottom: 15px;
  color: #555;
}

.no-results p {
  font-size: 1.1rem;
}

/* Pagination optimisée et moderne */
.pagination-container {
  margin-top: 40px;
  text-align: center;
  padding: 20px 0;
}

.pagination {
  display: inline-flex;
  list-style: none;
  margin: 0;
  padding: 12px;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 25px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.page-item {
  display: flex;
}

.page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.95rem;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.page-link:hover {
  background: rgba(255, 0, 0, 0.3);
  color: #fff;
  transform: translateY(-2px) scale(1.05);
  border-color: rgba(255, 0, 0, 0.5);
  box-shadow: 0 3px 8px rgba(255, 0, 0, 0.2);
}

.page-item.active .page-link {
  background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%);
  color: #fff;
  border-color: #ff0000;
  box-shadow: 0 3px 8px rgba(255, 0, 0, 0.4);
}

.page-link span {
  color: #ccc;
  font-weight: 600;
}

/* Sélecteur de langue moderne */
.language-selector {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  font-size: 14px;
  font-weight: 500;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  transition: all 0.3s ease;
}

.selected-language {
  display: flex;
  align-items: center;
  padding: 10px 15px;
  cursor: pointer;
  color: #fff;
  transition: all 0.3s ease;
}

.selected-language:hover {
  background: rgba(255, 255, 255, 0.1);
}

.flag-emoji {
  font-size: 18px;
  margin-right: 8px;
}

.lang-name {
  margin-right: 8px;
}

.selected-language .fa-chevron-down {
  transition: transform 0.3s ease;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

.language-selector.active .fa-chevron-down {
  transform: rotate(180deg);
}

.languages-dropdown {
  max-height: 0;
  overflow: hidden;
  list-style: none;
  margin: 0;
  padding: 0;
  transition: max-height 0.3s ease;
  background: rgba(0, 0, 0, 0.7);
}

.languages-dropdown.show {
  max-height: 200px;
}

.languages-dropdown li {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.languages-dropdown a {
  display: flex;
  align-items: center;
  padding: 10px 15px;
  color: #fff;
  text-decoration: none;
  transition: all 0.2s ease;
}

.languages-dropdown a:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Responsive */
@media (max-width: 992px) {
  .filters-form {
    flex-direction: column;
    gap: 15px;
  }

  .filter-group {
    width: 100%;
  }

  .btn-filter {
    width: 100%;
  }

  .categories-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
  }

  .categories-stats {
    gap: 15px;
  }
}

@media (max-width: 768px) {
  .section-header {
    padding: 20px 15px;
  }

  .section-header h1 {
    font-size: 1.8rem;
    flex-direction: column;
    gap: 8px;
  }

  .categories-stats {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  .stat-item {
    font-size: 0.85rem;
    padding: 8px 15px;
  }

  .categories-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
  }

  .category-card h2 {
    padding: 10px;
    font-size: 1rem;
  }

  .category-videos-count {
    font-size: 0.75rem;
    padding: 4px 8px;
  }

  .language-selector {
    top: 15px;
    right: 15px;
    font-size: 13px;
  }

  .flag-emoji {
    font-size: 16px;
  }

  .lang-name {
    display: none;
  }
}

@media (max-width: 480px) {
  .logo-header {
    margin: 10px 0;
    padding: 10px;
  }

  .logo-header img {
    max-width: 140px;
  }

  .nav-header {
    padding: 15px;
    margin-bottom: 15px;
  }

  .nav-header .input-search {
    padding: 10px 15px;
    font-size: 14px;
  }

  .nav-header .btn-search {
    padding: 10px 14px;
    min-width: 42px;
    height: 42px;
  }

  .categories-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    padding: 0;
  }

  .category-card h2 {
    font-size: 0.9rem;
    padding: 8px;
  }

  .page-link {
    min-width: 36px;
    height: 36px;
    font-size: 0.9rem;
    padding: 0 8px;
  }

  .categories-filters {
    padding: 15px;
    margin-bottom: 20px;
  }

  .btn-filter {
    padding: 10px 16px;
    font-size: 0.85rem;
    min-width: 100px;
  }
}

/* Optimisations pour les préférences utilisateur */
@media (prefers-reduced-motion: reduce) {
  .category-card,
  .category-img-container img,
  .btn-filter,
  .filter-group select {
    transition: none;
  }

  .category-card:hover .category-img-container img {
    transform: none;
  }

  .category-card:hover {
    transform: none;
  }
}

/* Amélioration du contraste pour l'accessibilité */
@media (prefers-contrast: high) {
  .category-card {
    border: 2px solid rgba(255, 255, 255, 0.2);
  }

  .filter-group select {
    border: 2px solid rgba(255, 255, 255, 0.3);
  }

  .btn-filter {
    border: 2px solid #fff;
  }

  .category-videos-count {
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.3);
  }
}

/* Mode sombre amélioré */
@media (prefers-color-scheme: dark) {
  .filter-group label {
    color: #e0e0e0;
  }

  .category-card {
    background: rgba(20, 20, 20, 0.8);
  }
}

/* Loading skeleton pour un meilleur UX */
.category-card.skeleton {
  background: rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

.category-card.skeleton::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  animation: skeleton-loading 1.5s infinite;
}

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