/**
 * SYSTÈME DE FILTRES SIMPLE ET ÉLÉGANT
 * Design minimaliste et moderne pour les pages d'activités
 */

/* ================================
   EN-TÊTE DE SECTION
   ================================ */

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--c-border-light);
}

.section-title h2 {
  margin: 0 0 var(--space-1);
  color: var(--c-text);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
}

.section-subtitle {
  margin: 0;
  color: var(--c-muted);
  font-size: 0.9rem;
  font-weight: 400;
}

.results-info {
  text-align: right;
}

.results-count {
  display: inline-block;
  padding: var(--space-2) var(--space-3);
  background: linear-gradient(
    135deg,
    var(--c-primary-light),
    var(--c-primary-lighter)
  );
  color: var(--c-primary);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid var(--c-primary-light);
  transition: all 0.3s ease;
}

/* ================================
   BARRE DE RECHERCHE ET FILTRES
   ================================ */

.search-filters-bar {
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  align-items: center;
  flex-wrap: wrap;
}

/* Recherche */
.search-wrapper {
  flex: 1;
  min-width: 300px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-field {
  width: 100%;
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-10);
  border: 2px solid var(--c-border);
  border-radius: var(--radius-lg);
  font-size: 1rem;
  background: white;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.search-field:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  transform: translateY(-1px);
}

.search-icon {
  position: absolute;
  left: var(--space-3);
  color: var(--c-muted);
  pointer-events: none;
  transition: color 0.3s ease;
  z-index: 2;
}

.search-field:focus + .search-icon {
  color: var(--c-primary);
}

.search-clear {
  position: absolute;
  right: var(--space-3);
  background: none;
  border: none;
  color: var(--c-muted);
  cursor: pointer;
  padding: var(--space-1);
  border-radius: var(--radius);
  font-size: 1.2rem;
  line-height: 1;
  transition: all 0.2s ease;
  z-index: 2;
}

.search-clear:hover {
  color: var(--c-text);
  background: var(--c-border-light);
}

/* Filtres rapides */
.quick-filters {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}

.filter-dropdown {
  padding: var(--space-3);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: white;
  font-size: 0.875rem;
  color: var(--c-text);
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 120px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.filter-dropdown:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-dropdown:hover {
  border-color: var(--c-primary);
}

.reset-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
  background: none;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  color: var(--c-muted);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.reset-btn:hover {
  background: var(--c-danger-light);
  border-color: var(--c-danger);
  color: var(--c-danger);
  transform: translateY(-1px);
}

/* ================================
   INDICATEUR DE RECHERCHE
   ================================ */

.search-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  background: linear-gradient(135deg, #f8fafc, #e2e8f0);
  border: 1px solid var(--c-border-light);
  border-radius: var(--radius-lg);
  color: var(--c-text);
}

.loading-dots {
  display: flex;
  gap: var(--space-1);
}

.loading-dots span {
  width: 6px;
  height: 6px;
  background: var(--c-primary);
  border-radius: 50%;
  animation: loadingPulse 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) {
  animation-delay: -0.32s;
}
.loading-dots span:nth-child(2) {
  animation-delay: -0.16s;
}
.loading-dots span:nth-child(3) {
  animation-delay: 0s;
}

@keyframes loadingPulse {
  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.status-text {
  font-size: 0.875rem;
  font-weight: 500;
}

/* ================================
   RÉSULTATS ET ANIMATIONS
   ================================ */

.content-results {
  transition: opacity 0.3s ease;
}

.content-results.loading {
  opacity: 0.6;
  pointer-events: none;
}

.posts-grid {
  opacity: 0;
  animation: fadeInUp 0.5s ease forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Animation supprimée - cartes visibles immédiatement */
.posts-grid .post-card,
.posts-grid .materiel-card {
  opacity: 1;
}

/* État vide */
.no-results {
  text-align: center;
  padding: var(--space-8);
  color: var(--c-muted);
  background: linear-gradient(135deg, #f8fafc, #e2e8f0);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--c-border);
}

.no-results h3 {
  margin: 0 0 var(--space-2);
  color: var(--c-text);
  font-size: 1.125rem;
  font-weight: 600;
}

.no-results p {
  margin: 0;
  font-size: 0.875rem;
}

/* ================================
   RESPONSIVE DESIGN
   ================================ */

@media (max-width: 768px) {
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .results-info {
    text-align: left;
  }

  .search-filters-bar {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }

  .search-wrapper {
    min-width: auto;
  }

  .quick-filters {
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .filter-dropdown {
    flex: 1;
    min-width: auto;
  }

  .reset-btn {
    flex-shrink: 0;
  }
}

@media (max-width: 480px) {
  .section-title h2 {
    font-size: 1.5rem;
  }

  .search-field {
    padding: var(--space-2) var(--space-2) var(--space-2) var(--space-8);
    font-size: 0.875rem;
  }

  .search-icon {
    left: var(--space-2);
    width: 16px;
    height: 16px;
  }

  .filter-dropdown {
    padding: var(--space-2);
    font-size: 0.8rem;
  }

  .quick-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .reset-btn {
    align-self: center;
    margin-top: var(--space-2);
  }
}

/* ================================
   AMÉLIORATIONS UX
   ================================ */

/* Focus visible pour l'accessibilité */
.search-field:focus,
.filter-dropdown:focus,
.reset-btn:focus {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
}

/* Survol des éléments interactifs */
.search-box:hover .search-field {
  border-color: var(--c-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Transitions fluides */
* {
  transition: color 0.2s ease, background-color 0.2s ease,
    border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

/* États de chargement */
.search-field[readonly] {
  background: var(--c-bg-light);
  cursor: wait;
}

.filter-dropdown[disabled] {
  background: var(--c-bg-light);
  cursor: not-allowed;
  opacity: 0.6;
}

/* Feedback visuel pour les actions */
.reset-btn:active {
  transform: translateY(0) scale(0.95);
}

.filter-dropdown:active {
  transform: scale(0.98);
}

/* Optimisation pour les appareils tactiles */
@media (hover: none) {
  .search-box:hover .search-field {
    border-color: var(--c-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }

  .reset-btn:hover {
    transform: none;
  }

  .filter-dropdown:hover {
    border-color: var(--c-border);
  }
}

/* Amélioration de la lisibilité */
.results-count {
  letter-spacing: 0.025em;
}

.status-text {
  letter-spacing: 0.025em;
}

/* Animation de focus pour les éléments */
.search-field:focus,
.filter-dropdown:focus {
  animation: focusPulse 0.6s ease;
}

@keyframes focusPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(59, 130, 246, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}
