/**
 * Lin Teas - View Switcher (Grille/Liste)
 * Phase 2.6: Switcher entre vue grille et vue liste
 */

/* ==========================================================================
   View Switcher Controls
   ========================================================================== */

.view-switcher-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid rgba(127, 179, 163, 0.2);
}

.view-switcher-controls {
  display: flex;
  gap: 0.5rem;
  background: var(--color-white, #FEFEFE);
  border-radius: 8px;
  padding: 0.25rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.view-switcher-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--color-text, #2C3E50);
}

.view-switcher-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.view-switcher-btn:hover {
  background: rgba(127, 179, 163, 0.1);
  color: var(--color-primary, #7FB3A3);
}

.view-switcher-btn.active {
  background: var(--color-primary, #7FB3A3);
  color: var(--color-white, #FFFFFF);
  box-shadow: 0 2px 8px rgba(127, 179, 163, 0.3);
}

.view-switcher-label {
  font-size: 0.875rem;
  color: var(--color-text, #2C3E50);
  font-weight: 500;
}

/* ==========================================================================
   Vue Grille (par défaut)
   ========================================================================== */

.products-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  transition: all 0.3s ease;
}

@media (max-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  .products-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* ==========================================================================
   Vue Liste
   ========================================================================== */

.products-grid.view-list {
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.products-grid.view-list .product-card {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  gap: 1.5rem;
  align-items: start;
}

.products-grid.view-list .product-card .card-image-wrapper {
  width: 200px;
  height: 200px;
}

.products-grid.view-list .product-card .card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.products-grid.view-list .product-card .card-title {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.products-grid.view-list .product-card .card-subtitle {
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.products-grid.view-list .product-card .card-description {
  display: block;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--color-text-light, #6B7280);
  margin-bottom: 0.75rem;
  max-width: 600px;
}

.products-grid.view-list .product-card .card-features {
  margin-bottom: 0.75rem;
}

.products-grid.view-list .product-card .card-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 200px;
}

.products-grid.view-list .product-card .card-price {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.products-grid.view-list .product-card .card-formats {
  margin-bottom: 0.75rem;
}

.products-grid.view-list .product-card .btn-add-to-cart {
  width: 100%;
}

/* Masquer certains éléments en vue liste */
.products-grid.view-list .product-card .card-hover-overlay {
  display: none;
}

.products-grid.view-list .product-card .quick-actions {
  position: static;
  opacity: 1;
  transform: none;
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* ==========================================================================
   Responsive Vue Liste
   ========================================================================== */

@media (max-width: 768px) {
  .products-grid.view-list .product-card {
    grid-template-columns: 120px 1fr;
    gap: 1rem;
  }

  .products-grid.view-list .product-card .card-image-wrapper {
    width: 120px;
    height: 120px;
  }

  .products-grid.view-list .product-card .card-actions {
    grid-column: 1 / -1;
    min-width: auto;
  }

  .products-grid.view-list .product-card .card-description {
    display: none;
  }
}

/* ==========================================================================
   Animations de Transition
   ========================================================================== */

.products-grid.transitioning {
  opacity: 0.6;
  pointer-events: none;
}

.products-grid .product-card {
  animation: fadeInScale 0.4s ease-out backwards;
}

.products-grid.view-list .product-card {
  animation: fadeInSlide 0.4s ease-out backwards;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fadeInSlide {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Délais d'animation séquentiels */
.products-grid .product-card:nth-child(1) { animation-delay: 0.05s; }
.products-grid .product-card:nth-child(2) { animation-delay: 0.1s; }
.products-grid .product-card:nth-child(3) { animation-delay: 0.15s; }
.products-grid .product-card:nth-child(4) { animation-delay: 0.2s; }
.products-grid .product-card:nth-child(5) { animation-delay: 0.25s; }
.products-grid .product-card:nth-child(6) { animation-delay: 0.3s; }
.products-grid .product-card:nth-child(7) { animation-delay: 0.35s; }
.products-grid .product-card:nth-child(8) { animation-delay: 0.4s; }
.products-grid .product-card:nth-child(9) { animation-delay: 0.45s; }

/* ==========================================================================
   Compteur de Produits
   ========================================================================== */

.products-count {
  font-size: 0.875rem;
  color: var(--color-text-light, #6B7280);
}

.products-count strong {
  color: var(--color-primary, #7FB3A3);
  font-weight: 600;
}

/* ==========================================================================
   États de Chargement
   ========================================================================== */

.view-switcher-wrapper.loading {
  opacity: 0.6;
  pointer-events: none;
}

