/* ======================================== */
/* LAYOUT.CSS — GLOBAL PAGE STRUCTURE       */
/* Using Mobile-First Responsive Approach   */
/* ======================================== */

/* ---------------------------------------- */
/* 1. NAVBAR / HEADER                       */
/* ---------------------------------------- */
header {
  width: 100%;
  background: var(--bvm-bg-light);
  box-shadow: var(--shadow-soft);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
}

.nav-logo img {
  height: 40px;
}

.nav-links {
  display: flex;
  gap: var(--space-sm);
}

.nav-links li a {
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: var(--fs-small);
  color: var(--bvm-text-dark);
}

.nav-links li a.active,
.nav-links li a:hover {
  background: var(--bvm-secondary);
  color: var(--bvm-text-light);
}

/* Mobile navigation stack (future JS optional) */
@media (max-width: 600px) {
  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* ---------------------------------------- */
/* 2. PAGE HERO                             */
/* ---------------------------------------- */
.page-hero {
  position: relative;
  text-align: center;
  margin-bottom: var(--space-lg);
}

.page-hero-image {
  width: 100%;
  height: 220px;
  object-fit: cover;
  filter: brightness(0.75);
}

.page-hero-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--bvm-text-light);
}

.page-hero-text h1 {
  font-size: var(--fs-h1);
  color: var(--bvm-text-light);
  margin-bottom: var(--space-xs);
}

.page-hero-text p {
  font-size: var(--fs-small);
}

@media (min-width: 768px) {
  .page-hero-image {
    height: 350px;
  }
  .page-hero-text p {
    font-size: var(--fs-body);
  }
}

/* ---------------------------------------- */
/* 3. GRID SYSTEM                           */
/* ---------------------------------------- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

.grid-4 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

.grid-5 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

/* Responsive grid expansion */
@media (min-width: 600px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 992px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .grid-5 { grid-template-columns: repeat(5, 1fr); }
}

/* ---------------------------------------- */
/* 4. TWO-COLUMN BLOCKS                     */
/* ---------------------------------------- */
.two-column-block,
.two-column-block-reverse {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  align-items: center;
  margin-bottom: var(--space-xl);
}

.two-col-image img {
  width: 100%;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

@media (min-width: 768px) {
  .two-column-block { grid-template-columns: 1fr 1fr; }
  .two-column-block-reverse {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---------------------------------------- */
/* 5. CTA BANNER                            */
/* ---------------------------------------- */
.cta-banner {
  background: var(--bvm-primary);
  color: var(--bvm-text-light);
  text-align: center;
  padding: var(--space-lg) var(--space-md);
  margin: var(--space-lg) 0;
  border-radius: var(--radius-md);
}

.cta-banner h2 {
  margin-bottom: var(--space-sm);
  color: var(--bvm-text-light);
}

/* ---------------------------------------- */
/* 6. FOOTER                                */
/* ---------------------------------------- */
footer {
  background: var(--bvm-bg-grey);
  padding: var(--space-lg) var(--space-md);
  margin-top: var(--space-xl);
}

.footer-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

.footer-col h3 {
  margin-bottom: var(--space-sm);
  font-size: var(--fs-h3);
}

.footer-col p,
.footer-col li {
  font-size: var(--fs-small);
  color: var(--bvm-text-dark);
}

.footer-col ul li a:hover {
  color: var(--bvm-primary);
}

@media (min-width: 768px) {
  .footer-columns {
    grid-template-columns: repeat(3, 1fr);
  }
}
/* ======= BVM FIXES: MOBILE NAV, OVERLAY, Z-INDEX, FOOTER, HEADER, GRID ======= */

/* Mobile overlay (display controlled via JS) */
.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  z-index: 998;
}
.mobile-overlay.active {
  display: block;
}

/* Mobile nav open state and animation */
.mobile-nav {
  position: fixed;
  top: 0;
  right: -100%;
  width: 280px;
  height: 100vh;
  background: var(--bvm-bg-light, #ffffff);
  transition: right 260ms ease-in-out;
  z-index: 1200; /* ensure above chat widget */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: -8px 0 20px rgba(0,0,0,0.08);
  will-change: right;
}
.mobile-nav.open {
  right: 0;
}

/* Prevent body scroll when menu open */
.no-scroll {
  overflow: hidden !important;
  height: 100% !important;
}

/* Ensure support/chat widget stays below mobile nav but above content */
.support-widget, .chat-float, .widget-container {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1100;
}

/* Footer layout fixes */
.footer-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.2rem;
  padding: 2rem 1rem;
  align-items: start;
}
@media (min-width: 768px) {
  .footer-columns {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    padding: 3rem 2rem;
  }
}

/* Header/logo/menu alignment improvements */
.header-logo img {
  height: 46px;
  max-height: 46px;
  display: block;
}
.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 6px;
}

/* Category/product grid consistency */
.category-grid img,
.product-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

/* Small utilities for safe area */
.u-safe-top { padding-top: env(safe-area-inset-top); }
.u-safe-bottom { padding-bottom: env(safe-area-inset-bottom); }

/* Minor spacing tweaks for mobile */
@media (max-width: 480px) {
  .site-container { padding-left: 12px; padding-right: 12px; }
  .footer-columns { padding: 1.2rem 0.6rem; }
}

/* Accessibility: focus ring on menu toggle */
.menu-toggle:focus { outline: 2px solid rgba(13,115,119,0.14); outline-offset: 2px; }

/* Safety: ensure overlay covers sticky headers on some pages */
.mobile-overlay { top: 0; left: 0; right: 0; bottom: 0; }


/* ===== BVM: Mobile nav + overlay + toggle fixes (PATCH) ===== */

/* Overlay when nav opens */
.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  z-index: 1190;
  transition: opacity 200ms ease;
  opacity: 0;
  -webkit-tap-highlight-color: transparent;
}
.mobile-overlay.active {
  display: block;
  opacity: 1;
}

/* Mobile nav slide-in */
.mobile-nav {
  position: fixed;
  top: 0;
  right: -100%;
  width: 280px;
  height: 100vh;
  background: var(--bvm-bg-light, #ffffff);
  transition: right 260ms ease-in-out;
  z-index: 1200;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: -8px 0 20px rgba(0,0,0,0.08);
  will-change: right;
}
.mobile-nav.open { right: 0; }

/* Mobile nav list */
.mobile-nav ul {
  list-style: none;
  margin: 0;
  padding: 1rem;
}
.mobile-nav ul li { margin: 0.35rem 0; }
.mobile-nav ul li a { display:block; padding: 0.65rem 0.5rem; color: var(--bvm-text-dark); text-decoration:none; font-weight:600; }

/* Hamburger/menu toggle */
.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  cursor: pointer;
}
.menu-toggle span {
  display:block;
  width:18px;
  height:2px;
  background: var(--bvm-text-dark);
  margin:3px 0;
  border-radius:2px;
}

/* Prevent body scroll when menu open */
.no-scroll { overflow: hidden !important; height: 100% !important; }

/* Accessibility */
.menu-toggle:focus { outline: 2px solid rgba(13,115,119,0.14); outline-offset: 2px; }

/* Ensure support widget stays below mobile nav but above content */
.support-widget, .chat-float, .widget-container {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1100; /* must be lower than mobile-nav */
}

/* small screens: hide desktop nav if any */
@media (max-width: 768px) {
  .desktop-nav { display: none !important; }
  .nav-links { display: none !important; }
  .menu-toggle { display: inline-flex; }
}

/* big screens: ensure mobile nav hidden */
@media (min-width: 769px) {
  .mobile-nav { display: none !important; }
  .mobile-overlay { display: none !important; }
}

/* Minor polish */
.mobile-nav.open { box-shadow: -12px 0 30px rgba(0,0,0,0.12); }

