/* ============================================
   CLASS-MARKET - PRODUCTS CSS
   Catalogue, cartes produits, carrousel
============================================ */

:root{
  --space-1:4px; --space-2:8px; --space-3:12px; --space-4:16px; --space-6:24px; --space-8:32px; --space-16:64px; --space-20:80px; --space-32:128px;
  --radius-full:9999px; --radius-xl:18px; --radius-2xl:24px; --radius-3xl:28px;
  --primary-500:#3b82f6; --primary-600:#2563eb;
  --neutral-900:#0f172a; --neutral-700:#334155; --neutral-600:#64748b; --neutral-500:#94a3b8;
  --gradient-primary: linear-gradient(90deg,#7c3aed,#06b6d4);
  --gradient-accent: linear-gradient(90deg,#fb7185,#f59e0b);
  --shadow-glow: 0 6px 20px rgba(99,102,241,0.12);
  --shadow-glow-lg: 0 20px 60px rgba(59,130,246,0.12);
  --shadow-2xl: 0 30px 90px rgba(2,6,23,0.2);
  --shadow-md: 0 8px 30px rgba(2,6,23,0.06);
  --transition-bounce: all 220ms cubic-bezier(.2,.9,.2,1);
  --transition-elastic: transform 320ms cubic-bezier(.22,.98,.39,1);
  --transition-normal: all 180ms ease;
  --transition-slow: transform 600ms cubic-bezier(.2,.8,.2,1);
}

body, .products { font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial; color:var(--neutral-900); }


.products {
  padding: var(--space-32) 0;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  padding-top: calc(80px + var(--space-16));
}
.products .container { margin: 0 auto; text-align: center; }
.products .section-header { text-align: center; margin-bottom: 60px; }

.section-header h2 {
  color: var(--neutral-900);
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  margin-bottom: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, #0f172a 0%, #0ea5e9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-header p {
  color: var(--neutral-600);
  font-size: 1.1rem;
  margin: 0;
}

.products::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, rgba(168, 85, 247, 0.1) 0%, transparent 50%);
  z-index: 1;
}

/* ============================================
   BARRE DE RECHERCHE
============================================ */

.products-search {
  max-width: 980px;
  margin: 1.25rem auto;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 2;
}

.products-search input[type="text"],
.products-search select {
  flex: 1;
  min-width: 200px;
  padding: var(--space-4);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-xl);
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: var(--transition-bounce);
}

.products-search input:focus,
.products-search select:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  transform: scale(1.02);
}

.validation {
  background: var(--primary-500);
  color: white;
  border: none;
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-xl);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-bounce);
}

.validation:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: var(--shadow-glow-lg), var(--shadow-2xl);
  background: var(--primary-600);
}

/* ============================================
   CATÉGORIES
============================================ */

.category-block {
  margin-bottom: var(--space-16);
  position: relative;
  z-index: 2;
}

.category-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: var(--space-6);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

/* ============================================
   CARROUSEL HORIZONTAL
============================================ */

.category-carousel {
  display: flex !important;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-2);
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-500) rgba(255, 255, 255, 0.1);
}

.category-carousel::-webkit-scrollbar {
  height: 8px;
}

.category-carousel::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}

.category-carousel::-webkit-scrollbar-thumb {
  background: var(--primary-500);
  border-radius: var(--radius-full);
}

.category-carousel::-webkit-scrollbar-thumb:hover {
  background: var(--primary-600);
}

/* ============================================
   PRODUCT CARD
============================================ */

.product-card {
  flex: 0 0 auto;
  width: 280px;
  scroll-snap-align: start;
  background: rgba(255, 255, 255, 0.95);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-3xl);
  overflow: hidden;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: var(--transition-elastic);
  position: relative;
  cursor: pointer;
}

.product-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(145deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
  opacity: 0;
  transition: var(--transition-normal);
  z-index: 0;
}

.product-card:hover {
  transform: translateY(-12px) scale(1.02);
  box-shadow: 
    var(--shadow-glow-lg),
    0 20px 40px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.3);
}

.product-card:hover::before {
  opacity: 1;
}

/* Image du produit */
.product-image-container {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition-slow);
}

.product-card:hover .product-image {
  transform: scale(1.1);
}

/* Placeholder SVG or missing image */
.product-image--placeholder {
  width: 100%;
  height: 100%;
  display: block;
}

/* Colors display */
.product-colors {
  margin-bottom: var(--space-3);
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
}
.product-colors span { display:inline-block; margin-left:8px; color:rgba(255, 255, 255, 0.6); }

/* Action buttons look */
.product-actions .btn {
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.product-actions .btn.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.product-actions .btn.btn-secondary {
  background: rgba(15,23,42,0.04);
  color: white;
  border: 1px solid rgba(15,23,42,0.04);
}

/* Improve title and description spacing */
.product-title { font-size: 1.15rem; margin-bottom: 6px; }
.product-description { font-size: 0.95rem; color: rgba(255, 255, 255, 0.7); }


/* Badge promo */
.promo-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--gradient-accent);
  color: white;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: var(--shadow-glow);
  animation: pulse 2s ease-in-out infinite;
  z-index: 10;
}

/* Contenu de la carte */
.product-content {
  padding: var(--space-6);
  position: relative;
  z-index: 2;
}

.product-link {
  text-decoration: none;
  color: inherit;
}

.product-title {
  font-size: 1.2rem;
  margin-bottom: var(--space-3);
  color: white;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-description {
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: var(--space-4);
  line-height: 1.6;
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Prix */
.product-price {
  margin-bottom: var(--space-4);
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.original-price {
  color: rgba(255, 255, 255, 0.5);
  text-decoration: line-through;
  font-size: 1rem;
}

.final-price {
  color: var(--primary-600);
  font-weight: 800;
  font-size: 1.5rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Badge de statut */
.product-status-badge {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-4);
}

.status-available {
  background: #d1fae5;
  color: #065f46;
}

.status-out_of_stock {
  background: #fee2e2;
  color: #991b1b;
}

.status-coming_soon {
  background: #fef3c7;
  color: #92400e;
}

.status-discontinued {
  background: #e5e7eb;
  color: #374151;
}

/* Actions */
.product-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.product-actions .btn {
  flex: 1;
  min-width: 100px;
  font-size: 0.8rem;
  padding: var(--space-2) var(--space-4);
}

/* ============================================
   PAGINATION
============================================ */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-16);
  flex-wrap: wrap;
}

.current-page {
  color: rgba(255, 255, 255, 0.6);
  font-weight: 600;
  padding: var(--space-2) var(--space-4);
}

/* ============================================
   NO PRODUCTS
============================================ */

.no-products {
  text-align: center;
  padding: var(--space-20);
  color: rgba(255, 255, 255, 0.7);
}

.no-products p {
  font-size: 1.5rem;
  margin-bottom: var(--space-6);
}

/* ============================================
   FEATURES CARDS (page accueil)
============================================ */

.features {
  padding: var(--space-20) 0;
  background: rgba(255, 255, 255, 0.05);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-8);
}

.feature-card {
  background: rgba(255, 255, 255, 0.9);
  padding: var(--space-8);
  border-radius: var(--radius-2xl);
  text-align: center;
  transition: var(--transition-bounce);
  box-shadow: var(--shadow-md);
}

.feature-card:hover {
  transform: translateY(-10px);
  box-shadow: var(--shadow-glow), var(--shadow-2xl);
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  animation: bounce 2s infinite;
}

.feature-card h3 {
  color: white;
  margin-bottom: var(--space-3);
  font-size: 1.5rem;
}

.feature-card p {
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.6;
}

/* ============================================
   RESPONSIVE
============================================ */
/* Version mobile - produits */
@media (max-width: 768px) {
  /* Section produits */
  .products {
    padding: 40px 20px;
    background: #f4f7fb;
  }

  /* Titre de la section */
  .section-title {
    margin-top: 30px;
    font-size: 1.6rem;
    font-weight: 700;
    color: #333;
    text-align: center;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
  }

  .section-subtitle {
    font-size: 1rem;
    color: #888;
    font-weight: 500;
    text-align: center;
    margin-bottom: 20px;
  }

  /* Barre de recherche et filtres */
  .products-search {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
  }

  .search-form {
    display: flex;
    gap: 15px;
    width: 100%;
    max-width: 400px;
  }

  #searchInput, #categoryFilter {
    padding: 12px 20px;
    border-radius: 50px;
    font-size: 1rem;
    border: 1px solid #ddd;
    width: 100%;
  }

  button.validation {
    background-color: #ff6b6b;
    color: white;
    border-radius: 50px;
    padding: 12px 20px;
    font-size: 1rem;
    transition: background-color 0.3s ease;
    cursor: pointer;
  }

  button.validation:hover {
    background-color: #ff3e3e;
  }

  /* Affichage des produits par catégories */
  .category-block {
    margin-bottom: 40px;
  }

  .category-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    text-align: center;
    margin-bottom: 20px;
  }

  /* Carrousel des produits (Produits en ligne) */
  .category-carousel {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    padding: 20px 0;
    scroll-snap-type: x mandatory;
  }

  .category-carousel::-webkit-scrollbar {
    display: none;
  }

  /* Carte de produit : Réduire de moitié la taille */
  .product-card {
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 120px; /* Taille réduite */
    height: 180px; /* Hauteur plus petite */
    text-align: center;
    padding: 15px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    flex-shrink: 0;
    cursor: pointer;
    scroll-snap-align: start;
  }

  /* Effet de zoom sur les cartes */
  .product-card:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2);
  }

  .product-card img {
    width: 100%;
    height: auto;
    border-radius: 10px;
  }

  .product-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin: 10px 0;
  }

  .product-card p {
    font-size: 0.85rem;
    color: #777;
    margin-bottom: 10px;
  }

  .product-card .price {
    font-size: 1rem;
    font-weight: 700;
    color: #ff6b6b;
  }

  /* Aucun produit trouvé */
  .no-products {
    text-align: center;
    font-size: 1rem;
    color: #555;
  }

  .no-products a {
    display: inline-block;
    background-color: #ff6b6b;
    padding: 12px 30px;
    color: white;
    border-radius: 50px;
    font-size: 1rem;
    text-decoration: none;
    margin-top: 20px;
    transition: background-color 0.3s ease;
  }

  .no-products a:hover {
    background-color: #ff3e3e;
  }

  /* Pagination mobile */
  .pagination {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 40px;
    flex-wrap: wrap;
  }

  .pagination a {
    padding: 12px 20px;
    background-color: #f4f7fb;
    border-radius: 50px;
    text-decoration: none;
    color: #333;
    font-weight: 600;
    transition: background-color 0.3s ease;
  }

  .pagination a:hover {
    background-color: #ff6b6b;
    color: white;
  }

  .current-page {
    font-size: 1rem;
    color: #333;
    align-self: center;
  }

  /* When using the grid/list view container, make productGrid responsive */
  #productGrid.grid-view {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  #productGrid.list-view {
    display: block;
  }

  /* Make carousels easier to swipe with larger cards */
  .category-carousel { gap: 12px; padding: 12px 0; }
}

/* Further adjustments for very small screens */
@media (max-width: 420px) {
  #productGrid.grid-view { grid-template-columns: 1fr; }
  .product-card { width: 160px; height: auto; padding: 12px; }
  .product-image-container { height: 140px; }
  .product-title { font-size: 1rem; }
  .product-description { display: none; }
  .product-actions .btn { padding: 8px 10px; font-size: 0.85rem; }
}

/* Additional responsive improvements for products page */
@media (max-width: 768px) {
  .products { padding: 20px 12px; }
  .products-search { max-width: 100%; padding: 0 8px; }
  .search-form { width: 100%; display: flex; gap: 8px; }
  .search-form input[type="text"] { flex: 1 1 auto; }
  #productGrid { padding: 8px; }
  /* make product cards more fluid */
  .product-card { width: calc(50% - 12px); }
  .category-carousel { padding: 8px; }
}

@media (max-width: 520px) {
  .product-card { width: calc(100% - 12px); display: block; }
  .category-carousel { display: block; overflow: visible; }
  .product-card { margin: 0 auto 12px; }
  .products-search .validation { width: 100%; }
  .product-actions { flex-direction: column; gap: 8px; }
}