/* ═══════════════════════════════════════════════
   MAV GROUP — MOBILE RESPONSIVE STYLESHEET
   Loaded on all pages via <link> in <head>
═══════════════════════════════════════════════ */

/* ── Hamburger button (hidden on desktop) ─── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: 1px solid #333;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}
.nav-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: #f5f5f5;
  border-radius: 2px;
  transition: all 0.25s ease;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Mobile drawer overlay ─────────────────── */
.nav-drawer {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1100;
}
.nav-drawer.open { display: block; }
.nav-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
}
.nav-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(320px, 85vw);
  height: 100%;
  background: #111;
  border-left: 1px solid #222;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0;
  padding-top: 64px;
}
.nav-drawer-close {
  position: absolute;
  top: 68px;
  right: 1rem;
  background: none;
  border: none;
  color: #888;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  z-index: 1001;
  padding: 0.5rem;
}
.nav-drawer-links {
  display: flex;
  flex-direction: column;
  margin-top: 2rem;
}
.nav-drawer-links a {
  display: block;
  padding: 1rem 1.5rem;
  color: #ccc;
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid #1a1a1a;
  transition: color 0.15s, background 0.15s;
}
.nav-drawer-links a:hover { color: #fff; background: #1a1a1a; }

/* Vehicles sub-section inside drawer */
.nav-drawer-vehicles-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  color: #ccc;
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid #1a1a1a;
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  width: 100%;
  text-align: left;
}
.nav-drawer-vehicles-toggle .arrow {
  font-size: 12px;
  transition: transform 0.2s;
  color: #555;
}
.nav-drawer-vehicles-toggle.open .arrow { transform: rotate(180deg); }
.nav-drawer-vehicle-links {
  display: none;
  background: #0d0d0d;
}
.nav-drawer-vehicle-links.open { display: block; }
.nav-drawer-vehicle-links a {
  padding: 0.85rem 1.5rem 0.85rem 2rem;
  border-left: 2px solid #dc2626;
  margin-left: 0;
  font-size: 13px;
  color: #aaa;
  letter-spacing: 0.5px;
}
.nav-drawer-vehicle-links a span {
  display: block;
  color: #dc2626;
  font-size: 11px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  margin-top: 2px;
}

/* Auth buttons inside drawer */
.nav-drawer-auth {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.5rem;
  margin-top: auto;
  border-top: 1px solid #222;
}
.nav-drawer-auth button,
.nav-drawer-auth a {
  display: block;
  width: 100%;
  padding: 0.9rem;
  text-align: center;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  text-decoration: none;
}
.nav-drawer-auth .btn-signin {
  background: none;
  border: 1px solid #555;
  color: #ccc;
}
.nav-drawer-auth .btn-join {
  background: #dc2626;
  border: none;
  color: white;
}

/* Cart badge in drawer */
.nav-drawer-cart {
  display: block;
  padding: 1rem 1.5rem;
  color: #ccc;
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid #1a1a1a;
}

/* ── Hide desktop nav on mobile ────────────── */
@media (max-width: 768px) {
  /* Hide desktop nav links + auth slot + inline cart button.
     On mobile these all move into the slide-in drawer. */
  .mav-desktop-nav { display: none !important; }
  .mav-desktop-auth { display: none !important; }
  .nav-menu { display: none !important; }          /* index.html desktop nav */
  #auth-nav-slot { display: none !important; }       /* inline Sign In / Join */
  #cart-btn-link { display: none !important; }       /* inline cart button */

  /* Show hamburger */
  .nav-hamburger { display: flex !important; }

  /* Tighten header padding */
  .mav-header-inner { padding: 0 1rem !important; }

  /* ── Products page ───────────────────────── */
  .container {
    grid-template-columns: 1fr !important;
    padding: 1rem !important;
    gap: 0 !important;
  }

  /* Sidebar filter toggle */
  .sidebar-toggle-btn {
    display: flex !important;
  }
  .sidebar {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
  }
  .sidebar.open {
    max-height: 2000px;
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
  }

  .products-header {
    margin-bottom: 1rem !important;
  }
  .products-header h1 {
    font-size: 1.1rem !important;
  }

  /* ── Product detail page ─────────────────── */
  .product-detail {
    padding: 1.5rem 1rem !important;
  }
  .product-detail-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }
  .product-name { font-size: 1.4rem !important; }
  .product-price { font-size: 1.6rem !important; }
  .btn-add-cart { padding: 0.9rem 1rem !important; font-size: 14px !important; }
  .cart-controls { flex-wrap: wrap !important; }

  /* ── Related grid ────────────────────────── */
  .related-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .related-section {
    padding: 0 1rem 2rem !important;
    margin: 1.5rem auto !important;
  }

  /* ── Cart / Checkout ─────────────────────── */
  .cart-grid, .checkout-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── Account page ────────────────────────── */
  .account-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── About / Services ────────────────────── */
  .about-grid, .services-grid, .team-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── General touch targets ───────────────── */
  .filter-option {
    padding: 0.9rem 0.75rem !important;
    font-size: 14px !important;
  }

  .product-hero {
    padding: 2rem 1rem !important;
    min-height: 160px !important;
  }
}

@media (max-width: 480px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.5rem !important;
  }
  .product-info { padding: 0.6rem !important; }
  .product-name { font-size: 11px !important; }
  .product-price { font-size: 13px !important; }
}

/* ── Sidebar toggle button (hidden on desktop) */
.sidebar-toggle-btn {
  display: none;
  width: 100%;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  color: #f5f5f5;
  padding: 0.85rem 1rem;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.sidebar-toggle-btn .arrow {
  font-size: 12px;
  color: #dc2626;
  transition: transform 0.2s;
}
.sidebar-toggle-btn.open .arrow { transform: rotate(180deg); }

/* ── NAVBAR OVERFLOW FIX ─────────────────────────────────
   On mobile the header collapses to: logo (left) + hamburger
   (right). The desktop nav, inline cart button and auth slot
   are hidden via their explicit classes/ids above; everything
   moves into the slide-in drawer (built by mobile.js). We use
   class/id selectors only — no fragile structural selectors —
   so nested header layouts (e.g. the homepage) keep their logo.
──────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Keep the header inner row tidy: logo left, hamburger right */
  .nav-container,
  .main-header > .container > .nav-container {
    flex-wrap: nowrap !important;
  }

  /* Logo never shrinks */
  header a img,
  header .logo-img {
    flex-shrink: 0 !important;
  }
}

/* ── FORCE HIDE desktop nav/auth on ALL pages at mobile ── */
@media (max-width: 768px) {
  header nav,
  header > div > nav,
  .mav-desktop-nav,
  .mav-desktop-auth,
  #auth-nav-slot,
  #cart-btn-link {
    display: none !important;
  }
  .nav-hamburger {
    display: flex !important;
  }
  header > div {
    overflow: hidden !important;
  }
}

/* ── Homepage-specific mobile fixes ── */
@media (max-width: 768px) {
  .nav-menu { display: none !important; }
  .cart-btn { display: none !important; }
  .nav-container {
    justify-content: space-between !important;
    overflow: hidden !important;
  }
}

/* ── Template pages (products, cart, etc) mobile fixes ── */
@media (max-width: 768px) {
  .mav-desktop-nav { display: none !important; }
  .mav-desktop-auth { display: none !important; }
  #auth-nav-slot { display: none !important; }
  #cart-btn-link { display: none !important; }
}

@media (max-width: 768px) {
  #nav-auth-wrap { display: none !important; }
}
@media (max-width: 768px) { #nav-auth-wrap { display: none !important; } }

/* ── Keep logo visible on homepage ── */
@media (max-width: 768px) {
  .nav-container a:first-child { display: flex !important; }
  .nav-container a:first-child img { display: block !important; }
}
.nav-drawer-close {
  position: fixed !important;
  top: 1rem !important;
  right: 1rem !important;
  z-index: 10000 !important;
  width: 44px !important;
  height: 44px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: #222 !important;
  border: 1px solid #444 !important;
  border-radius: 6px !important;
  color: #fff !important;
  font-size: 1.5rem !important;
  cursor: pointer !important;
  pointer-events: all !important;
}
