/* ═══════════════════════════════════════════════
   RESPONSIVE — Tablet 768px+ then Desktop 1024px+
   Mobile-first: everything below is ENHANCEMENT
   ═══════════════════════════════════════════════ */

/* ── Tablet (768px+) ───────────────────────── */
@media (min-width: 768px) {

  /* Header — tablette : on conserve le menu burger (cf. spec) */
  .header-container { padding: 0 24px; gap: 12px; }
  .logo img { width: 104px; }

  /* Hero */
  .hero { min-height: 80vh; }

  /* Categories: 3 cols */
  .categories-grid { grid-template-columns: repeat(3, 1fr); gap: 20px; }
  .section { padding: 64px 24px; }
  .section-title { margin-bottom: 40px; }

  /* USP: 2 cols dès la tablette */
  .usp-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }

  /* Products: 3 cols */
  .products-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .products { padding: 48px 24px; }
  .products-header { flex-direction: row; align-items: center; justify-content: space-between; }
  .btn-add-cart { font-size: 14px; }
  .product-name { font-size: 14px; }
  .product-price { font-size: 18px; }

  /* Product detail: pd-main en 2 col */
  .pd-main { flex-direction: row; gap: 40px; align-items: flex-start; }
  .pd-main .product-detail-img { flex: 0 0 50%; }
  .pd-main .product-detail-info { flex: 1; }
  .pd-dims-grid { grid-template-columns: repeat(4, 1fr); }

  /* Cart panel: sidebar right */
  .cart-panel {
    left: auto;
    top: 0;
    bottom: 0;
    width: 400px;
    max-height: 100dvh;
    border-radius: 0;
    transform: translateX(100%);
  }
  .cart-panel.open { transform: translateX(0); }

  /* Footer: 2 cols */
  .footer-grid { grid-template-columns: repeat(2, 1fr); padding: 56px 24px 40px; }

  /* Cart page */
  .cart-page { padding: 40px 24px; }

  /* Toast position */
  .toast { bottom: 32px; }
}

/* ── Desktop (1024px+) ─────────────────────── */
@media (min-width: 1024px) {

  /* ── Header desktop : 2 rangées ── */
  .header-container { padding: 0 40px; gap: 16px; }

  /* Burger + extras mobiles cachés */
  .menu-toggle { display: none; }
  .nav-overlay { display: none !important; }
  .nav-mobile-extras { display: none; }

  /* RANGÉE 1 : logo · recherche centrée · actions */
  .header-row-main > .header-container {
    flex-wrap: nowrap;
    min-height: 64px;
  }
  .logo { order: 1; margin-right: 0; }
  .logo img { width: 120px; }
  .header-search {
    order: 2;
    flex: 1 1 auto;
    max-width: 600px;
    margin: 0 auto;
    height: 42px;
  }
  .header-actions { order: 3; gap: 4px; }
  .header-action { min-width: 58px; }

  /* RANGÉE 2 : catégories centrées + pills langue/devise à droite
     Grille 3 colonnes : [1fr vide] [catégories auto, centrées] [1fr → outils à droite] */
  .header-row-nav { border-top: 1px solid #222; }
  .header-row-nav > .header-container {
    min-height: 42px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }
  .header-tools.desktop-only {
    grid-column: 3;
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }

  /* Navigation horizontale (centrée, colonne du milieu) */
  .nav {
    position: static;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    grid-column: 2;
    flex: 0 1 auto;
    width: auto;
    max-width: none;
    gap: 0;
    padding: 0;
    background: transparent;
    border-right: none;
    transform: none;
    overflow: visible;
    z-index: auto;
  }
  /* Séparateur · entre catégories */
  .nav-item:not(:first-child)::before {
    content: "·";
    align-self: center;
    color: rgba(255,255,255,.4);
    margin: 0 8px;
  }
  .nav-link {
    min-height: 0;
    height: auto;
    padding: 8px 2px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 0;
    border-bottom: 2px solid transparent;   /* soulignement au hover */
    white-space: nowrap;
  }
  .nav-link:hover,
  .nav-link:focus-visible {
    background: transparent;
    color: #cccccc;
    border-bottom-color: #ffffff;
  }
  .nav-link.active {
    background: transparent;
    color: #ffffff;
    border-bottom-color: #ffffff;
  }

  /* Nav items desktop : flex row + dropdown hover */
  .nav-item {
    position: relative;
    flex-direction: row;
    align-items: center;
  }
  .nav-caret { display: none; }
  .nav-sub {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    min-width: 210px;
    flex-direction: column;
    background: #111;
    border: 1px solid #333;
    border-radius: var(--radius);
    padding: 6px 0;
    padding-top: 12px;
    z-index: 200;
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
    margin: 0;
    border-left: none;
  }
  .nav-item.has-sub:hover > .nav-sub,
  .nav-item.has-sub:focus-within > .nav-sub { display: flex; }
  .nav-sub a {
    min-height: unset;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 400;
    color: rgba(255,255,255,.75);
    border-radius: 0;
    white-space: nowrap;
  }
  .nav-sub a:hover { background: #222; color: #fff; }

  /* Hero */
  .hero { min-height: 100vh; }

  /* Categories: 5 cols */
  .categories-grid { grid-template-columns: repeat(5, 1fr); gap: 24px; }
  .section { padding: 80px 40px; }
  .section-title { margin-bottom: 48px; }

  /* Products: 4 cols */
  .products-grid { grid-template-columns: repeat(4, 1fr); gap: 20px; }
  .products { padding: 64px 40px; }

  /* Category card hover scale (desktop only) */
  .category-card { transition: box-shadow var(--t-med), transform var(--t-med); }
  .category-card:hover { transform: translateY(-4px); }

  /* Product detail desktop */
  .pd-main { gap: 60px; }
  .pd-main .product-detail-img { flex: 0 0 50%; }
  .product-detail-section { padding: 48px 40px; }
  /* Sticky bar : inutile sur desktop */
  .sticky-cart-bar { display: none; }
  .similar-section { padding: 48px 40px 80px; }

  /* Similar products: 4 cols on desktop, 5 cols on large */
  .similar-section .products-grid { grid-template-columns: repeat(4, 1fr); }

  /* Footer: 4 cols */
  .footer-grid { grid-template-columns: repeat(4, 1fr); padding: 72px 40px 48px; }
}

/* ── Large desktop (1366px+) ───────────────── */
@media (min-width: 1366px) {
  .header-container { padding: 0 60px; }
  .section { padding: 96px 60px; }
  .products { padding: 80px 60px; }
  .product-detail-section { padding: 60px 80px; }
  .similar-section { padding: 60px 80px 96px; }
  .similar-section .products-grid { grid-template-columns: repeat(5, 1fr); }
  .footer-grid { padding: 80px 60px 56px; }
}

/* ── Mobile + tablette (< 1024px) ────────────
   3 icônes (recherche/compte/panier) compactées
   pour ne pas chevaucher le logo centré.
   Desktop (≥1024px) garde les icônes à 48px. */
@media (max-width: 1023px) {
  .search-btn, .account-btn, .cart-btn { width: 40px; }
  .header-actions { gap: 2px; }
}

/* ── Very small phones (< 360px) ───────────── */
@media (max-width: 359px) {
  .products-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 26px; }
  /* Header très compact : logo réduit + icônes resserrées */
  .logo img { width: 64px; }
  .search-btn, .account-btn, .cart-btn { width: 36px; }
  .header-actions { gap: 1px; }
  .menu-toggle { width: 42px; }
  .header-container { padding: 0 8px; }
}

/* ── Print ──────────────────────────────────── */
@media print {
  .header, .cart-overlay, .cart-panel, .toast, .btn-add-cart { display: none !important; }
}
