/* =========================
   RESET & BASE
========================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  font-family: 'Urbanist', sans-serif;
  background: #fafafa;
  color: #1a1a1a;
  min-height: 100vh;
}

/* =========================
   HEADER
========================= */
header {
  position: sticky;
  top: 0;
  background: white;
  padding: 0.4rem 0.7rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
}

.logo {
  width: 38px;
  height: 54px;
  object-fit: contain;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 800;
  color: #7f0000;
}

nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* =========================
   MAIN WRAPPER
========================= */
main {
  width: 100%;
  padding: 0.8rem;
  margin: 0 auto;
  max-width: 480px; /* mobile-first width */
}

/* =========================
   SEARCH + TRI
========================= */
.search-filter {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 0.9rem;
}

#search-input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  font-size: 1rem;
  border: 1.8px solid #ddd;
  border-radius: 8px;
  background: white;
}

#price-sort {
  width: 100%;
  padding: 0.7rem;
  border-radius: 999px;
  border: 2px solid #7f0000;
  color: #7f0000;
  font-weight: 700;
  background: white;
}

/* =========================
   CATEGORIES (SCROLLABLE)
========================= */
.categories-scroll {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  white-space: nowrap;
}

.categories-scroll::-webkit-scrollbar { display: none; }

.categories {
  display: inline-flex;
  gap: 0.6rem;
}

.categories button {
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  border: 1.8px solid #ddd;
  border-radius: 999px;
  background: white;
  white-space: nowrap;
  cursor: pointer;
}

.categories button.active {
  background: #7f0000;
  color: white;
  border-color: #7f0000;
}

/* =========================
   GRID PRODUITS MOBILE-FIRST
========================= */
.product-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  width: 100%;
  margin-top: 0.8rem;
}

/* 2 colonnes dès 380px */
@media (min-width: 380px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* =========================
   CARD PRODUIT
========================= */
.product-card {
  background: white;
  border-radius: 12px;
  padding: 0.55rem;
  box-shadow: 0 3px 8px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  transition: 0.25s ease;
}

.product-card:hover {
  transform: translateY(-4px);
}

/* Image carrée type Vinted */
.product-img {
  width: 100%;
  aspect-ratio: 1 / 1.2;
  object-fit: cover;
  border-radius: 10px;
}

.product-info {
  padding: 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.product-name {
  font-size: 0.95rem;
  font-weight: 700;
}

.product-price {
  font-size: 1.05rem;
  color: #7f0000;
  font-weight: 800;
}

/* =========================
   ACTIONS CARD
========================= */
.product-actions {
  margin-top: 0.35rem;
  display: flex;
  gap: 0.5rem;
}

.add-cart-btn {
  flex: 1;
  padding: 0.6rem;
  font-size: 0.85rem;
  border-radius: 8px;
  background: #7f0000;
  color: white;
  font-weight: 700;
  border: none;
}

.favorite-icon {
  font-size: 22px;
  color: #7f0000;
  background: none;
  border: none;
  cursor: pointer;
}

/* =========================
   DESKTOP (simple, clean)
========================= */

@media (min-width: 900px) {

  main {
    max-width: 1200px;
  }

  .product-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.6rem;
  }
}

@media (min-width: 1200px) {
  .product-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}


/* ===========================
   DESKTOP : Search left + Tri right
=========================== */

@media (min-width: 900px) {

  /* Le container passe en ligne */
  .search-filter {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
  }

  /* Search devient large */
  #search-input {
    flex: 1;
    height: 48px;
    font-size: 1rem;
  }

  /* Tri compact à droite */
  #price-sort {
    width: 220px;
    height: 48px;
    padding: 0 1rem;
    font-size: 1rem;
    border-radius: 50px;
    margin-left: auto;  /* 🔥 met le tri à droite */
  }

  /* Catégories sous la ligne search/tri */
  .categories-scroll {
    order: 2;
    margin-top: 0.5rem;
  }
}

@media (min-width: 900px) {
  .search-filter {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
  }

  #search-input {
    flex: 1;
    height: 48px;
  }

  #price-sort {
    width: 220px;
    height: 48px;
    margin-left: auto;
  }
}
