/* ==========================================================
 * WUShop Mobile Fixes — WB-style grid + all mobile issues
 * Applied after all other CSS
 * ========================================================== */

/* ============================================================
 * 1. HOMEPAGE: Products grid — 2 columns like WB, NOT horizontal scroll
 * ============================================================ */
@media (max-width: 640px) {
  .wu-products-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    overflow-x: visible !important;
    scroll-snap-type: none !important;
    padding-bottom: 0 !important;
  }
  .wu-product-card,
  .wu-products-grid > .wu-card {
    flex-shrink: unset !important;
    width: auto !important;
    max-width: none !important;
    scroll-snap-align: unset !important;
  }
}

/* ============================================================
 * 2. PRODUCT CARD: Compact mobile style (WB-like)
 * ============================================================ */
@media (max-width: 640px) {
  .wu-card {
    border-radius: 12px;
  }
  .wu-card__body {
    padding: 8px 10px 12px;
  }
  .wu-card__title {
    font-size: 13px;
    line-height: 1.3;
    -webkit-line-clamp: 2;
    min-height: 34px;
  }
  .wu-card__category {
    font-size: 11px;
    margin-bottom: 4px;
  }
  .wu-card__price {
    font-size: 16px;
  }
  .wu-card__price-old {
    font-size: 12px;
  }
  .wu-card__price-label,
  .wu-card__price-mp-label {
    font-size: 10px;
  }
  .wu-card__savings {
    font-size: 11px;
    padding: 2px 6px;
  }
  .wu-card__cta {
    font-size: 13px;
    padding: 10px 12px;
    border-radius: 10px;
  }
  .wu-card__mp-links {
    font-size: 11px;
  }
  .wu-card__mp-buttons {
    gap: 4px;
  }
  .wu-card__mp-btn {
    font-size: 12px;
    padding: 8px 10px;
  }
  .wu-price-dynamic {
    font-size: 10px;
  }
  .wu-badge {
    font-size: 11px;
    padding: 3px 8px;
  }
}

/* ============================================================
 * 3. CATALOG: Grid fixes for <480px
 * ============================================================ */
@media (max-width: 480px) {
  #wu-catalog-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  .wu-catalog-section {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* Subcategory arrows — keep visible or use scroll indicator */
@media (max-width: 640px) {
  .wu-scroll-wrap {
    position: relative;
  }
  .wu-scroll-wrap .wu-slider-arrow {
    display: none;
  }
  .wu-scroll-wrap .wu-scroll-inner {
    -webkit-overflow-scrolling: touch;
  }
}

/* Toolbar: stack on narrow screens */
@media (max-width: 600px) {
  .wu-catalog-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .wu-catalog-toolbar > * {
    width: 100%;
  }
  .wu-stock-toggle {
    justify-content: center;
  }
}

/* Pagination: bigger touch targets */
@media (max-width: 640px) {
  .wu-pagination a,
  .wu-pagination span {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
  }
}

/* Breadcrumbs: wrap on mobile */
@media (max-width: 640px) {
  .wu-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 4px;
    font-size: 12px;
  }
}

/* ============================================================
 * 4. PDP: Gallery, buybox, MP buttons, sticky CTA
 * ============================================================ */

/* MP buttons: single column on narrow screens */
@media (max-width: 768px) {
  .wu-pdp__mp-section--primary .wu-pdp__mp-links {
    grid-template-columns: 1fr;
  }
}

/* Sticky CTA: safe area for notched devices */
@media (max-width: 767px) {
  .wu-pdp__sticky-cta {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .wu-pdp {
    padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  }
}

/* Thumbnail strip: scroll snap */
.wu-pdp__thumbs {
  scroll-snap-type: x mandatory;
}
.wu-pdp__thumb {
  scroll-snap-align: center;
}

/* Review badge: compact on mobile */
@media (max-width: 640px) {
  .wu-pdp__reviews-btn {
    font-size: 12px;
    padding: 4px 10px;
  }
  .wu-pdp__reviews-stars {
    font-size: 11px;
  }
}

/* Review modal: full width on mobile */
@media (max-width: 640px) {
  .wu-rv-modal__panel {
    width: 100vw;
    max-width: 100vw;
  }
}

/* PDP specs table on very small screens */
@media (max-width: 480px) {
  .wu-pdp__specs-table th,
  .wu-pdp__specs-table td {
    font-size: 13px;
    padding: 8px 10px;
  }
}

/* ============================================================
 * 5. TRUST PAGES: Reviews, Delivery, Returns
 * ============================================================ */
@media (max-width: 640px) {
  .wu-trust-page {
    padding: 20px 16px 60px;
  }
  .wu-trust-hero h1 {
    font-size: 26px;
  }
  .wu-trust-hero p {
    font-size: 14px;
  }
  /* Steps: better spacing without connector lines */
  .wu-step {
    padding: 0 8px;
    margin-bottom: 16px;
  }
  .wu-step__num {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
}

/* Reviews feed grid: proper 1 column on mobile */
@media (max-width: 640px) {
  .wu-reviews-feed {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .wu-rc__content {
    padding: 14px 14px 16px;
  }
  .wu-reviews-more__btn {
    width: 100%;
    padding: 16px;
    font-size: 15px;
  }
}

/* ============================================================
 * 6. ARTICLE PAGES
 * ============================================================ */
@media (max-width: 640px) {
  .wu-article-hero__img {
    max-height: 280px;
  }
  .wu-rec-card {
    width: 280px;
    max-width: calc(100vw - 32px);
  }
}

/* ============================================================
 * 7. GLOBAL: Container padding, footer, touch targets
 * ============================================================ */
@media (max-width: 640px) {
  /* Consistent horizontal padding */
  .wu-container {
    padding-left: 16px;
    padding-right: 16px;
  }

  /* Footer links: bigger touch targets */
  .wu-footer__menu a,
  .wu-footer__links a {
    display: block;
    padding: 8px 0;
    min-height: 44px;
    line-height: 28px;
  }

  /* Section titles */
  .wu-section-title {
    font-size: 20px;
  }
}

/* ============================================================
 * 8. SEARCH RESULTS
 * ============================================================ */
@media (max-width: 640px) {
  .wu-search-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .wu-search-hero h1 {
    font-size: 24px;
  }
}

/* ============================================================
 * 9. 404 PAGE
 * ============================================================ */
@media (max-width: 640px) {
  .wu-404-recs {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
}

/* ============================================================
 * 10. LIGHTBOX: Better mobile sizing
 * ============================================================ */
@media (max-width: 640px) {
  .wu-lightbox__img {
    max-width: 95vw;
    max-height: 85vh;
    border-radius: 8px;
  }
  .wu-lightbox__close {
    top: 12px;
    right: 16px;
    font-size: 36px;
  }
}
