/* ═══════════════════════════════════════════════════════════════════════
   VITALEDGE — MOBILE-FIRST RESPONSIVE OVERHAUL
   Shared across all pages. Loaded via <link> in each HTML file.
   Targets: 375px (iPhone SE), 390px (iPhone 14), 412px (Android)
   ═══════════════════════════════════════════════════════════════════════ */

/* ── MOBILE NAV: Hamburger + Full-screen Menu ── */
.mobile-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.mobile-hamburger span {
  width: 18px;
  height: 2px;
  background: #1a1a1a;
  border-radius: 2px;
  transition: all 0.3s ease;
  display: block;
}
.mobile-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-hamburger.open span:nth-child(2) { opacity: 0; }
.mobile-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-nav-menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(250,250,248,0.99);
  z-index: 150;
  padding: 80px 24px 40px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  transition: opacity 0.25s ease;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.mobile-nav-menu.open {
  display: flex;
  flex-direction: column;
  opacity: 1;
}
.mobile-nav-menu a {
  display: block;
  padding: 16px 20px;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 500;
  color: #555;
  transition: all 0.15s;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-menu a:hover,
.mobile-nav-menu a:active {
  color: #1a1a1a;
  background: rgba(0,0,0,0.04);
}
.mobile-nav-cta {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(0,0,0,0.08);
}
.mobile-nav-cta a {
  display: block;
  text-align: center;
  padding: 16px 24px;
  background: #00a89e;
  color: #0a0b0d !important;
  font-weight: 700;
  border-radius: 12px;
  font-size: 1.05rem;
  min-height: 52px;
}
.mobile-nav-cta a:hover {
  background: #00c4b8;
}

/* ── RESPONSIVE BREAKPOINTS ── */

/* Tablet & below: 768px */
@media (max-width: 768px) {
  /* Show hamburger, hide desktop nav */
  .mobile-hamburger { display: flex; }
  .nav-links,
  .nav-center,
  .nav-shop-btn,
  .nav-shop { display: none !important; }

  /* Nav adjustments */
  .nav-inner {
    padding: 0 16px;
    height: 60px;
  }

  /* Enforce minimum body text */
  body {
    font-size: 16px;
    line-height: 1.6;
  }

  /* Container padding */
  .container { padding: 0 16px; }

  /* Minimum tap targets */
  button,
  [role="button"],
  .btn,
  .btn-primary,
  .btn-ghost,
  .cart-btn,
  .filter-btn,
  .qty-btn,
  .add-btn,
  .add-cart-btn,
  .view-btn,
  .checkout-btn,
  .submit-btn,
  .cart-close,
  .modal-close {
    min-height: 44px;
  }

  /* Cart button */
  .cart-btn {
    padding: 10px 14px;
    font-size: 0.9rem;
    min-height: 44px;
  }

  /* Product grids — 2 columns on tablet */
  .products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
  }

  /* Section spacing */
  .section { padding: 64px 16px; }
  .section-header { margin-bottom: 40px; }
  .section-title { font-size: 1.8rem; }
  .section-sub { font-size: 0.95rem; }

  /* Footer */
  .footer-top {
    grid-template-columns: 1fr 1fr !important;
    gap: 32px;
  }

  /* Trust bar — compact on mobile */
  .trust-bar {
    padding: 10px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .trust-bar-inner {
    gap: 0;
    flex-wrap: nowrap;
    justify-content: flex-start;
    min-width: max-content;
  }
  .trust-item {
    font-size: 0.7rem;
    padding: 3px 10px;
    white-space: nowrap;
  }

  /* Press logos */
  .press-logos {
    gap: 20px;
  }
  .press-logo {
    font-size: 0.85rem;
  }

  /* Stats bar */
  .stats-inner {
    grid-template-columns: 1fr 1fr !important;
    gap: 20px;
  }

  /* Steps grid */
  .steps-grid {
    grid-template-columns: 1fr !important;
    gap: 36px;
  }
  .steps-grid::before { display: none !important; }

  /* Testimonials */
  .testimonials-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }
  .testimonials-grid .testimonial-card:last-child { display: block !important; }

  /* Categories grid */
  .categories-grid {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }

  /* Newsletter */
  .signup-box {
    padding: 36px 20px;
  }
  .signup-form {
    flex-direction: column;
  }
  .signup-input {
    min-width: unset;
    width: 100%;
  }

  /* Page headers */
  .page-header { padding: 32px 16px 24px; }
  .page-title { font-size: 1.6rem; }
  .page-sub { font-size: 0.9rem; }

  /* Shop layout: hide sidebar */
  .sidebar { display: none !important; }
  .shop-layout {
    grid-template-columns: 1fr !important;
    padding: 24px 16px;
    gap: 0;
  }

  /* Mobile filters button — show it */
  .mobile-filters-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 12px;
    color: #1a1a1a;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    margin-bottom: 16px;
    min-height: 48px;
  }

  /* Product card image height — taller on mobile */
  .product-img {
    height: 200px;
  }
  .product-img-wrap {
    height: 200px;
  }

  /* Product detail layout */
  .product-layout {
    grid-template-columns: 1fr !important;
    gap: 24px;
    padding: 0 16px 80px;
    margin-top: 20px;
  }

  /* Gallery — full width */
  .gallery-main {
    border-radius: 16px;
  }

  /* Product info spacing */
  .product-title {
    font-size: 1.5rem !important;
  }
  .price-current {
    font-size: 1.8rem;
  }

  /* CTA buttons — full width stacked */
  .cta-row {
    flex-direction: column;
    gap: 10px;
  }
  .btn-add-cart,
  .btn-buy-now {
    width: 100%;
    min-height: 52px;
    font-size: 1rem;
    justify-content: center;
  }

  /* Trust badges — wrap properly */
  .trust-badges {
    gap: 10px;
  }
  .trust-badge {
    font-size: 0.78rem;
    flex: 1 1 45%;
    min-width: 0;
  }

  /* Reviews section */
  .reviews-section {
    padding: 0 16px 60px;
    padding-top: 48px;
  }
  .reviews-summary {
    grid-template-columns: 1fr !important;
    gap: 20px;
  }

  /* Related products — 2 column */
  .related-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
  }

  /* Category page */
  .cat-hero-inner { padding: 32px 16px; }
  .cat-title { font-size: 1.8rem; }
  .cat-products { padding: 24px 16px 60px; }
  .cats-grid { grid-template-columns: 1fr 1fr !important; gap: 10px; }
  .other-cats-section { padding: 0 16px 60px; padding-top: 36px; }

  /* Cart drawer — full width on mobile */
  .cart-drawer {
    width: 100vw !important;
    max-width: 100vw;
  }

  /* Checkout modal — full screen on mobile */
  .modal-overlay { padding: 0; }
  .modal {
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    height: 100vh;
  }
  .modal-body { padding: 20px 16px 28px; }
  .modal-header { padding: 20px 16px 0; }

  /* Contact layout */
  .contact-layout {
    grid-template-columns: 1fr !important;
    padding: 32px 16px 60px;
    gap: 24px;
  }

  /* Form inputs — larger on mobile */
  .form-input,
  .form-textarea,
  .form-select {
    font-size: 16px !important;
    padding: 14px 16px;
    min-height: 48px;
  }

  /* Footer — single column */
  .footer-top {
    gap: 24px;
  }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  /* Breadcrumbs */
  .breadcrumb {
    font-size: 0.78rem;
  }
  .breadcrumb-bar {
    padding: 16px 16px 0;
  }

  /* Hero adjustments */
  .hero {
    min-height: 75vh;
  }
  .hero-content {
    padding: 60px 20px 80px;
  }
  .hero h1 {
    font-size: 2.2rem !important;
    line-height: 1.1;
  }
  .hero-sub {
    font-size: 1rem;
    line-height: 1.65;
  }
  .hero-cta-wrap {
    flex-direction: column;
    align-items: center;
  }
  .hero-cta-wrap .btn {
    width: 100%;
    max-width: 320px;
    min-height: 52px;
    font-size: 1rem;
    justify-content: center;
  }
}

/* Small phones: 480px and below */
@media (max-width: 480px) {
  .nav-inner {
    padding: 0 12px;
    height: 56px;
  }

  /* Single column products */
  .products-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }

  /* Product card bigger images */
  .product-img,
  .product-img-wrap {
    height: 220px;
  }

  /* Hero */
  .hero h1 {
    font-size: 1.85rem !important;
  }
  .hero-content {
    padding: 50px 16px 70px;
  }

  /* Stats — still 2 col but compact */
  .stats-inner {
    gap: 16px;
  }
  .stat-number {
    font-size: 1.6rem;
  }

  /* Related products — single column */
  .related-grid {
    grid-template-columns: 1fr !important;
  }

  /* Footer */
  .footer-top {
    grid-template-columns: 1fr !important;
    gap: 20px;
  }

  /* Trust bar — scrollable, always visible */
  .trust-bar {
    display: block !important;
    padding: 8px 8px;
  }
  .trust-item {
    font-size: 0.65rem;
    padding: 2px 8px;
  }

  /* Brand section */
  .brand-statement {
    font-size: 1.3rem !important;
  }
  .brand-desc {
    font-size: 0.95rem;
  }

  /* Section spacing tighter */
  .section {
    padding: 48px 16px;
  }

  /* Category cards */
  .categories-grid {
    gap: 10px;
  }
  .category-card {
    padding: 24px 20px 20px;
  }

  /* Signup */
  .signup-box {
    padding: 28px 16px;
  }

  /* Reviews */
  .reviews-section-title {
    font-size: 1.3rem;
  }
  .review-card {
    padding: 16px;
  }
  .review-card-top {
    flex-direction: column;
    gap: 6px;
  }
}

/* ── GALLERY TOUCH SWIPE SUPPORT ── */
.gallery-main {
  touch-action: pan-y pinch-zoom;
  -webkit-user-select: none;
  user-select: none;
}

@media (max-width: 768px) {
  .gallery-main {
    border-radius: 0;
    margin-left: -16px;
    margin-right: -16px;
    width: calc(100% + 32px);
  }
  .gallery-thumbs {
    padding: 0;
    gap: 8px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .gallery-thumbs::-webkit-scrollbar { display: none; }
  .gallery-thumb {
    min-width: 64px;
    width: 64px;
    height: 48px;
    flex-shrink: 0;
  }

  /* Swipe indicator dots for gallery */
  .gallery-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 12px 0 4px;
  }
  .gallery-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0,0,0,0.15);
    transition: all 0.2s;
  }
  .gallery-dot.active {
    background: #00a89e;
    width: 24px;
    border-radius: 4px;
  }
}

/* ── STICKY ADD TO CART BAR (product page mobile) ── */
@media (max-width: 900px) {
  .sticky-cart-bar {
    display: block;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }
  .sticky-add-btn {
    min-height: 48px;
    padding: 14px 24px;
    font-size: 0.95rem;
  }

  /* Add bottom padding to page content so sticky bar doesn't overlap */
  .product-layout,
  .reviews-section,
  .related-section {
    padding-bottom: 100px;
  }
}

/* ── MOBILE FILTER DRAWER ── */
.mobile-filter-drawer {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 300;
  background: #fafaf8;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.15);
  padding: 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  max-height: 70vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.mobile-filter-drawer.open {
  display: block;
  transform: translateY(0);
}
.mobile-filter-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 299;
}
.mobile-filter-overlay.open {
  display: block;
}
.filter-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.filter-drawer-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
}
.filter-drawer-close {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.08);
  color: #1a1a1a;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
}
.filter-drawer-section {
  margin-bottom: 20px;
}
.filter-drawer-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #999;
  margin-bottom: 10px;
}
.filter-drawer-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #555;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  margin-bottom: 4px;
  min-height: 48px;
}
.filter-drawer-btn:hover,
.filter-drawer-btn:active {
  background: #f7f5f0;
  color: #1a1a1a;
}
.filter-drawer-btn.active {
  background: rgba(0,168,158,0.08);
  border-color: rgba(0,212,200,0.2);
  color: #00a89e;
  font-weight: 600;
}

/* ── SAFE AREA INSETS (for notched phones) ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .sticky-cart-bar,
  .cart-footer,
  .mobile-filter-drawer {
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }
}

/* ── SMOOTH SCROLL & MOMENTUM ── */
@media (max-width: 768px) {
  html {
    -webkit-overflow-scrolling: touch;
  }

  /* Prevent horizontal overflow */
  body {
    overflow-x: hidden;
  }

  /* Smooth image loading — reserve space */
  img {
    background: #f7f5f0;
  }

  /* Improve touch response */
  a, button {
    -webkit-tap-highlight-color: rgba(0,168,158,0.08);
  }
}
