/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green:      #2d6a4f;
  --green-dark: #1b4332;
  --green-light:#52b788;
  --accent:     #f77f00;
  --bg:         #f8f9f4;
  --surface:    #ffffff;
  --border:     #e4e8e0;
  --text:       #1a1f18;
  --muted:      #6b7a66;
  --radius:     12px;
  --shadow:     0 2px 12px rgba(0,0,0,.07);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.13);
  --transition: .2s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container { max-width: 1280px; margin: 0 auto; padding: 0 1.5rem; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1.75rem;
  border-radius: 50px;
  font-weight: 600;
  font-size: .95rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}
.btn-primary {
  background: var(--green);
  color: #fff;
}
.btn-primary:hover {
  background: var(--green-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(45,106,79,.35);
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 68px;
}
.logo {
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.logo-eco  { color: var(--green); }
.logo-bike { color: var(--accent); }

.header-search {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  overflow: hidden;
  transition: border-color var(--transition);
}
.header-search:focus-within { border-color: var(--green-light); }
.header-search input {
  flex: 1;
  border: none;
  background: transparent;
  padding: .55rem 1.2rem;
  font-size: .9rem;
  outline: none;
  color: var(--text);
}
.header-search button {
  background: none;
  border: none;
  padding: .55rem 1rem;
  cursor: pointer;
  color: var(--muted);
  transition: color var(--transition);
}
.header-search button:hover { color: var(--green); }

.menu-toggle { display: none; }

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green) 60%, var(--green-light) 100%);
  color: #fff;
  padding: 6rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg);
  clip-path: ellipse(55% 100% at 50% 100%);
}
.hero-content { position: relative; z-index: 1; }
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 1rem;
}
.hero h1 em {
  font-style: normal;
  color: #a7f3d0;
}
.hero p {
  font-size: 1.15rem;
  opacity: .85;
  margin-bottom: 2rem;
  max-width: 480px;
  margin-inline: auto;
}

/* ── Catalogue layout ─────────────────────────────────────────────────────── */
.catalogue-section {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
  padding-top: 3rem;
  padding-bottom: 5rem;
  align-items: start;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1px solid var(--border);
  position: sticky;
  top: 88px;
}
.sidebar-title {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: 1rem;
}
.category-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.cat-btn {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: .55rem .85rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: .9rem;
  color: var(--text);
  transition: background var(--transition), color var(--transition);
  font-family: inherit;
}
.cat-btn:hover  { background: var(--bg); }
.cat-btn.active { background: var(--green); color: #fff; font-weight: 600; }

/* ── Products zone ────────────────────────────────────────────────────────── */
.products-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: .75rem;
}
.products-count { color: var(--muted); font-size: .9rem; }
.sort-wrap {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  color: var(--muted);
}
.sort-wrap select {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: .4rem .8rem;
  font-size: .85rem;
  background: var(--surface);
  cursor: pointer;
  color: var(--text);
  outline: none;
}

/* ── Product grid ─────────────────────────────────────────────────────────── */
.products-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

/* ── Product card ─────────────────────────────────────────────────────────── */
.product-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: visible;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
  clip-path: inset(0 round var(--radius));
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.card-img-wrap {
  position: relative;
  aspect-ratio: 4/3;
  background: #f0f4ee;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .75rem;
}
.card-img-wrap img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: transform .4s ease;
  transform-origin: center center;
}
.product-card:hover .card-img-wrap img { transform: scale(1.1) rotate(5deg); }

.card-badge {
  position: absolute;
  top: .6rem;
  left: .6rem;
  background: var(--accent);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  padding: .2rem .5rem;
  border-radius: 50px;
  letter-spacing: .03em;
}

.card-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  flex: 1;
}
.card-name {
  font-size: .92rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-price-row {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  margin-top: auto;
}
.card-price {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--green-dark);
}
.card-old-price {
  font-size: .82rem;
  color: var(--muted);
  text-decoration: line-through;
}

/* ── Loading ──────────────────────────────────────────────────────────────── */
.loading-spinner {
  display: flex;
  justify-content: center;
  padding: 3rem 0;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Garantit que hidden prime sur tout display personnalisé */
[hidden] { display: none !important; }

.empty-state {
  text-align: center;
  padding: 4rem 0;
  color: var(--muted);
}

/* ── Pagination ───────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  gap: .5rem;
  margin-top: 2.5rem;
  flex-wrap: wrap;
}
.page-btn {
  width: 40px;
  height: 40px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  font-size: .9rem;
  font-family: inherit;
  color: var(--text);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.page-btn:hover { border-color: var(--green); color: var(--green); }
.page-btn.active { background: var(--green); color: #fff; border-color: var(--green); }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
  animation: fadeIn .2s ease;
}
/* .modal-overlay géré par [hidden] global ci-dessus */

@keyframes fadeIn { from { opacity: 0; } }

.modal {
  background: var(--surface);
  border-radius: 18px;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(24px); opacity: 0; } }

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  background: var(--bg);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  color: var(--muted);
  transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: #fee2e2; color: #dc2626; }

.modal-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.modal-gallery { background: #f0f4ee; border-radius: 18px 0 0 18px; overflow: hidden; }
#modal-main-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}
.modal-thumbs {
  display: flex;
  gap: .5rem;
  padding: .75rem;
  flex-wrap: wrap;
  background: #e8ede5;
}
.modal-thumbs img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--transition);
}
.modal-thumbs img.active { border-color: var(--green); }

.modal-info {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.modal-ref { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.modal-info h2 { font-size: 1.3rem; line-height: 1.3; }

.modal-price-block { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; }
.modal-price { font-size: 1.8rem; font-weight: 700; color: var(--green-dark); }
.modal-old-price { font-size: 1rem; color: var(--muted); text-decoration: line-through; }
.modal-badge {
  background: var(--accent);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  padding: .2rem .6rem;
  border-radius: 50px;
}

.modal-stock { font-size: .85rem; }
.in-stock  { color: var(--green); font-weight: 600; }
.out-stock { color: #dc2626; font-weight: 600; }
.on-order  { color: var(--accent); font-weight: 600; }

.modal-desc {
  font-size: .88rem;
  color: var(--muted);
  line-height: 1.7;
  max-height: 160px;
  overflow-y: auto;
  flex: 1;
}
.modal-desc p + p { margin-top: .5rem; }

.modal-cta { align-self: flex-start; margin-top: auto; }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--green-dark);
  color: rgba(255,255,255,.6);
  text-align: center;
  padding: 1.5rem;
  font-size: .85rem;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .modal-body { grid-template-columns: 1fr; }
  .modal-gallery { border-radius: 18px 18px 0 0; }
  #modal-main-img { aspect-ratio: 16/9; }
}

@media (max-width: 768px) {
  .catalogue-section { grid-template-columns: 1fr; }

  .sidebar {
    position: static;
    overflow-x: auto;
  }
  .category-list {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: .4rem;
  }
  .cat-btn { white-space: nowrap; }

  .header-search { display: none; }
  .menu-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: .4rem;
  }
  .menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
  }
}

@media (max-width: 480px) {
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
  .hero { padding: 4rem 1rem 5rem; }
}
