/* ================================================================
   THE PURE HARVEST GROUP — mobile.css
   Mobile-first responsive system. Loaded on ALL pages.
   Fixes: overflow, category contrast, cards, filter, footer,
          checkout UX, product grid, header, touch targets
   ================================================================ */

/* ── BASE RESET ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: hidden; -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; min-width: 0; }
img, video, svg { max-width: 100%; height: auto; display: block; }
input, button, select, textarea {
  font-family: inherit;
  max-width: 100%;
  -webkit-appearance: none;
}
/* Remove tap highlight */
* { -webkit-tap-highlight-color: transparent; }

/* ── CONTAINER ───────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}
@media (max-width: 480px) { .container { padding: 0 16px; } }

/* ================================================================
   HEADER — Mobile-first
   ================================================================ */
#site-header {
  position: sticky;
  top: 0;
  z-index: 500;
  width: 100%;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 8px;
  padding: 0;
  flex-wrap: nowrap;
  min-width: 0;
}
/* Logo — left side */
.phg-logo {
  flex-shrink: 0;
  min-width: 0;
}
/* Nav — hidden mobile, shown desktop */
.main-nav { display: none; }
/* Actions — right side (cart + auth + hamburger) */
.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.hamburger, #phg-hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  min-width: 40px;
  min-height: 40px;
  align-items: center;
  justify-content: center;
}
/* Tablet+ */
@media (min-width: 769px) {
  .main-nav { display: flex; }
  .hamburger, #phg-hamburger { display: none; }
  .header-inner { height: 72px; gap: 20px; }
}

/* ================================================================
   CATEGORY SECTION — High contrast text fix
   Root cause: --olive (#4a6741) on white background has OK
   contrast but on parch (#f0ebe0) background can look faded.
   Fix: darken to green for guaranteed readability.
   ================================================================ */
.product-category-tag,
.product-cat,
.cat-name,
.category-tag,
.product-card-cat {
  color: #2c4a1e !important;  /* darker than --olive, always readable */
  font-size: 10px !important;
  font-weight: 900 !important;
  letter-spacing: 0.10em !important;
  text-transform: uppercase !important;
  opacity: 1 !important;       /* remove any opacity inheritance */
}

/* ================================================================
   PRODUCT CARDS — Full card clickable, premium mobile UX
   ================================================================ */
.product-card,
article.product-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #e8e4dc;
  box-shadow: 0 2px 8px rgba(30,58,30,0.08);
  cursor: pointer;           /* entire card looks clickable */
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  position: relative;
  -webkit-user-select: none;
  user-select: none;
}
.product-card:hover,
.product-card:focus-within {
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(30,58,30,0.14);
}
/* Touch devices: active state */
@media (hover: none) {
  .product-card:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(30,58,30,0.10);
  }
  .product-card:hover { transform: none; }
}

/* Product image */
.product-image-wrap,
.product-img {
  width: 100%;
  height: 170px;
  background: #f0ebe0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}
.product-image-wrap img,
.product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.product-card:hover .product-image-wrap img,
.product-card:hover .product-img img {
  transform: scale(1.04);
}

/* Product body */
.product-body,
.product-info {
  padding: 14px 14px 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 4px;
}
.product-name,
.product-card-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 15px;
  font-weight: 700;
  color: #1e3a1e;
  line-height: 1.3;
  margin: 0;
}
.product-desc,
.product-card-desc {
  font-size: 12px;
  color: #6b6b5a;
  line-height: 1.55;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Controls: SKU select + price */
.product-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
}
.sku-select {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border: 1.5px solid #e2d9c8;
  border-radius: 7px;
  font-size: 13px;
  background: #faf8f4;
  color: #1e3a1e;
  cursor: pointer;
  font-family: inherit;
}
.product-price,
.product-card-price {
  font-family: 'Playfair Display', serif;
  font-size: 17px;
  font-weight: 700;
  color: #4a6741;
  white-space: nowrap;
}

/* Actions: Add to Cart + Details */
.product-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.btn-add-cart {
  flex: 1;
  background: #1e3a1e;
  color: #fff;
  border: none;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.18s;
  /* Minimum touch target */
  min-height: 42px;
}
.btn-add-cart:hover, .btn-add-cart:active { background: #152e15; }
.btn-add-cart:disabled { opacity: 0.5; cursor: not-allowed; }

/* Details button — smaller, secondary */
.btn-view-product {
  background: transparent;
  border: 1.5px solid #e2d9c8;
  color: #6b6b5a;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.18s;
  white-space: nowrap;
  min-height: 42px;
}
.btn-view-product:hover { border-color: #1e3a1e; color: #1e3a1e; }

/* Product grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (min-width: 640px) {
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 18px; }
}
@media (min-width: 900px) {
  .products-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1100px) {
  .products-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 360px) {
  .products-grid { grid-template-columns: 1fr; }
}

/* ================================================================
   PRODUCT FILTER — Mobile bottom sheet
   ================================================================ */
/* Mobile: hide sidebar, show filter button */
@media (max-width: 767px) {
  .products-layout {
    display: block !important;
    grid-template-columns: unset !important;
  }
  .filter-sidebar {
    display: none !important;
  }
  .mobile-filter-btn {
    display: flex !important;
  }
  .products-main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
  }
}
/* Desktop: show sidebar, hide filter button */
@media (min-width: 768px) {
  .products-layout {
    display: grid !important;
    grid-template-columns: 240px 1fr !important;
    gap: 28px !important;
    align-items: start !important;
  }
  .filter-sidebar { display: block !important; position: sticky; top: 88px; }
  .mobile-filter-btn { display: none !important; }
}

/* Mobile filter button */
.mobile-filter-btn {
  display: none;
  align-items: center;
  gap: 7px;
  background: #1e3a1e;
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  min-height: 40px;
}

/* Filter bottom sheet (mobile) */
.filter-sheet-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 800;
  backdrop-filter: blur(2px);
  align-items: flex-end;
}
.filter-sheet-overlay.open { display: flex; }
.filter-sheet {
  background: #fff;
  width: 100%;
  max-height: 85vh;
  border-radius: 20px 20px 0 0;
  padding: 0;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.filter-sheet-overlay.open .filter-sheet { transform: translateY(0); }
.filter-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid #f0ede8;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.filter-sheet-header h3 {
  font-size: 16px;
  font-weight: 800;
  color: #1e3a1e;
  margin: 0;
}
.filter-sheet-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #888;
  padding: 4px 8px;
  min-width: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.filter-sheet-body { padding: 20px; }
.filter-sheet-actions {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid #f0ede8;
  background: #fff;
  position: sticky;
  bottom: 0;
}
.filter-sheet-actions .btn { flex: 1; min-height: 44px; font-size: 14px; }

/* Filter options in sheet */
.filter-sheet .filter-group { margin-bottom: 20px; }
.filter-sheet .filter-group h4 {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 12px;
}
.filter-sheet .filter-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f8f6f2;
  cursor: pointer;
}
.filter-sheet .filter-option:last-child { border-bottom: none; }
.filter-sheet .filter-option input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #1e3a1e;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-appearance: auto;
}
.filter-sheet .filter-option label {
  font-size: 14px;
  font-weight: 600;
  color: #1e3a1e;
  cursor: pointer;
  flex: 1;
}

/* ================================================================
   FOOTER — Mobile-first stacking
   ================================================================ */
.site-footer {
  background: #1e3a1e;
  color: rgba(250,247,240,0.78);
  padding: 48px 0 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  padding-bottom: 40px;
}
.footer-brand { text-align: center; }
.footer-brand p { max-width: 100% !important; margin-bottom: 16px; }
.footer-col { text-align: center; }
.footer-col h4 {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(250,247,240,0.5);
  margin-bottom: 12px;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col ul li a {
  color: rgba(250,247,240,0.75);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.2s;
}
.footer-col ul li a:hover { color: #c8a030; }
.footer-social {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
}
.footer-bottom {
  border-top: 1px solid rgba(250,247,240,0.12);
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: rgba(250,247,240,0.45);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.footer-bottom-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}
.footer-bottom-links a {
  color: rgba(250,247,240,0.5);
  text-decoration: none;
  font-size: 12px;
}
.footer-bottom-links a:hover { color: #c8a030; }

/* Tablet: 2 columns */
@media (min-width: 600px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .footer-brand { grid-column: 1 / -1; text-align: left; }
  .footer-brand p { max-width: 360px !important; }
  .footer-col { text-align: left; }
  .footer-col h4 { text-align: left; }
  .footer-social { justify-content: flex-start; }
}
/* Desktop: full width */
@media (min-width: 900px) {
  .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr 1fr; gap: 36px; }
  .footer-brand { grid-column: auto; }
  .footer-bottom { flex-direction: row; justify-content: space-between; }
}

/* ================================================================
   CHECKOUT — Mobile-first UX
   Order: Summary top (thumb-accessible) → Form → Button bottom
   ================================================================ */
.checkout-wrap { padding: 24px 0 40px; }
.checkout-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
/* On mobile: summary first (order: -1), form second */
.checkout-right { order: -1; }
.checkout-left  { order: 1; }

.order-summary-card {
  background: #fff;
  border: 1.5px solid #e2d9c8;
  border-radius: 16px;
  padding: 20px;
  position: static; /* not sticky on mobile */
}
.checkout-section-title {
  font-size: 18px;
  font-weight: 700;
  color: #1e3a1e;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e8e4dc;
}
#place-order-btn, .btn-place-order {
  width: 100%;
  padding: 15px 20px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.04em;
  border-radius: 12px;
  min-height: 52px;
}

/* Tablet+: side-by-side */
@media (min-width: 768px) {
  .checkout-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 28px;
    align-items: start;
  }
  .checkout-right { order: 1; position: sticky; top: 88px; }
  .checkout-left  { order: 0; }
  .order-summary-card { position: sticky; top: 88px; }
}
/* Form row */
.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 480px) {
  .form-row { grid-template-columns: 1fr 1fr; }
}
.form-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #e2d9c8;
  border-radius: 9px;
  font-size: 16px; /* prevents iOS zoom */
  font-family: inherit;
  background: #fff;
  color: #1a1a1a;
  outline: none;
  transition: border-color 0.2s;
}
.form-input:focus { border-color: #c8a030; box-shadow: 0 0 0 3px rgba(200,160,48,0.10); }
textarea.form-input { min-height: 80px; resize: vertical; }

/* ================================================================
   HERO — Mobile
   ================================================================ */
.hero, .hero-section {
  min-height: 75vh;
  padding: 60px 0 48px;
  display: flex;
  align-items: center;
}
@media (min-width: 768px) { .hero, .hero-section { min-height: 88vh; padding: 80px 0; } }
.hero-content { max-width: 100%; }
.hero-headline { font-size: clamp(26px, 7vw, 54px) !important; }
.hero-sub { font-size: clamp(14px, 3.5vw, 17px) !important; }
.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
@media (min-width: 480px) {
  .hero-actions { flex-direction: row; flex-wrap: wrap; }
}
.hero-actions .btn, .hero-actions a { width: 100%; text-align: center; justify-content: center; }
@media (min-width: 480px) { .hero-actions .btn, .hero-actions a { width: auto; } }

/* ================================================================
   CATEGORY GRID — Mobile
   ================================================================ */
.category-grid-new {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 640px) { .category-grid-new { gap: 16px; } }
@media (min-width: 900px) { .category-grid-new { grid-template-columns: repeat(4, 1fr); } }

.cat-card-new {
  padding: 18px 12px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  background: #fff;
  border: 1.5px solid #e8e4dc;
  transition: all 0.22s;
  text-align: center;
}
.cat-card-new:active { transform: scale(0.97); }
.cat-card-new .cat-name {
  font-size: 14px;
  font-weight: 700;
  color: #1e3a1e !important;  /* guaranteed readable */
}
.cat-card-new .cat-icon { font-size: 32px; }

/* ================================================================
   CAROUSEL — Mobile
   ================================================================ */
.carousel-track-wrap { overflow: hidden; }
.carousel-track {
  display: flex;
  gap: 16px;
  transition: transform 0.4s cubic-bezier(0.25,0.46,0.45,0.94);
  will-change: transform;
}
.carousel-track .product-card { flex: 0 0 80%; min-width: 0; }
@media (min-width: 480px)  { .carousel-track .product-card { flex: 0 0 calc(50% - 8px); } }
@media (min-width: 900px)  { .carousel-track .product-card { flex: 0 0 calc(25% - 12px); } }

/* ================================================================
   CART PAGE — Mobile
   ================================================================ */
.cart-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.cart-main { width: 100%; min-width: 0; }
.cart-summary { width: 100%; }
.cart-summary-card { position: static; }
@media (min-width: 768px) {
  .cart-layout { flex-direction: row; align-items: flex-start; gap: 28px; }
  .cart-main   { flex: 1; }
  .cart-summary { width: 300px; flex-shrink: 0; }
  .cart-summary-card { position: sticky; top: 88px; }
}
/* Cart table mobile */
.cart-table { width: 100%; border-collapse: collapse; }
@media (max-width: 600px) {
  .cart-table th:nth-child(2),
  .cart-table td:nth-child(2) { display: none; } /* hide unit price */
}

/* ================================================================
   TOUCH TARGETS — All buttons min 44px
   ================================================================ */
button, .btn, a.btn,
input[type="submit"], input[type="button"] {
  min-height: 40px;
}
.btn-sm { min-height: 36px; }

/* ================================================================
   PROFILE — Mobile
   ================================================================ */
.dash-wrap { padding: 24px 0 48px; }
@media (min-width: 768px) { .dash-wrap { padding: 48px 0; } }

/* ================================================================
   MODAL — Mobile full-screen
   ================================================================ */
@media (max-width: 640px) {
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    border-radius: 20px 20px 0 0;
    max-height: 92vh;
    overflow-y: auto;
    grid-template-columns: 1fr !important;
  }
  .modal-gallery { max-height: 260px; }
}

/* ================================================================
   SECTION SPACING — Mobile
   ================================================================ */
.section { padding: 56px 0; }
.section-sm { padding: 36px 0; }
@media (min-width: 768px) {
  .section { padding: 80px 0; }
  .section-sm { padding: 56px 0; }
}

/* ================================================================
   TRUST BAR — prevent overflow
   ================================================================ */
.phg-trust-bar { overflow: hidden; white-space: nowrap; }
.phg-trust-bar-inner { flex-wrap: nowrap; }

/* ================================================================
   MISC FIXES
   ================================================================ */
/* Prevent wide images/embeds breaking layout */
iframe, embed, object { max-width: 100%; }
/* Pre/code blocks */
pre, code { overflow-x: auto; max-width: 100%; }
/* Tables */
table { max-width: 100%; }
.tbl-wrap, .tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* WhatsApp FAB — above mobile cart bar */
.whatsapp-fab {
  position: fixed;
  bottom: 88px;
  right: 20px;
  width: 52px;
  height: 52px;
  background: #25D366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.22);
  z-index: 400;
  text-decoration: none;
  transition: transform 0.2s;
}
.whatsapp-fab:hover { transform: scale(1.08); }
@media (max-width: 640px) { .whatsapp-fab { bottom: 78px; } }
@media (min-width: 641px) { .whatsapp-fab { bottom: 28px; } }

/* ================================================================
   PRINT — hide non-essential elements
   ================================================================ */
@media print {
  .phg-trust-bar, #site-header, .site-footer,
  .mobile-cart-bar, .whatsapp-fab,
  .mobile-filter-btn, .filter-sheet-overlay { display: none !important; }
}
