/* ═══════════════════════════════════════
   MOBILE RESPONSIVE — Complete Adaptation
   ═══════════════════════════════════════ */

/* ─── Global Mobile ─── */
@media (max-width: 768px) {
  .container { padding: 0 14px !important; }
  
  /* Product Grid — 2 columns on tablet */
  .products-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; }
  .product-info { padding: 10px 12px; }
  .product-name { font-size: 13px; -webkit-line-clamp: 2; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
  .product-price { font-size: 15px; }
  
  /* Cart table */
  .cart-table th:nth-child(n+3), .cart-table td:nth-child(n+3) { display: none; }
  .cart-table { font-size: 13px; }
  
  /* Checkout */
  .checkout-grid { grid-template-columns: 1fr !important; }
  .form-row.two-col { grid-template-columns: 1fr !important; }
  
  /* Search page */
  .search-results-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; }
  
  /* Footer */
  .footer-grid-portal { grid-template-columns: 1fr 1fr !important; gap: 20px !important; }
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }
  .footer-links { flex-wrap: wrap; justify-content: center; }
  
  /* Hero sections */
  .hero h1 { font-size: 24px !important; }
  .hero p { font-size: 14px !important; }
  
  /* Pagination */
  .pagination { gap: 6px; }
  .pagination a, .pagination span { padding: 8px 12px; font-size: 13px; }
  
  /* Blog grid */
  .blog-grid { grid-template-columns: 1fr !important; gap: 16px !important; }
  
  /* Brand grid */
  .brands-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; }
  
  /* Compare */
  .compare-grid { overflow-x: auto; }
  
  /* Wiki / Guide */
  .wiki-grid, .guide-grid { grid-template-columns: 1fr !important; }
  
  /* Collections */
  .collections-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; }
  
  /* Actions */
  .actions-grid { grid-template-columns: 1fr !important; }
  
  /* Product detail: features cards */
  .pd-features-cards { grid-template-columns: 1fr !important; }
  
  /* Sticky bar mobile-friendly */
  .pd-sticky-inner { gap: 10px; }
  .pd-sticky-name { display: none; }
  .pd-sticky-btn { padding: 10px 20px; font-size: 13px; }
}

@media (max-width: 480px) {
  .container { padding: 0 10px !important; }
  
  /* Product Grid — still 2 columns but tighter */
  .products-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
  .product-card { border-radius: 8px; }
  .product-info { padding: 8px 10px; }
  .product-name { font-size: 12px; }
  .product-price { font-size: 14px; }
  .product-rating { font-size: 11px; }
  
  /* Product page */
  .pd-title { font-size: 18px !important; }
  .pd-price { font-size: 24px !important; }
  .pd-was-price { font-size: 15px; }
  .pd-actions { flex-direction: column !important; }
  .pd-qty-wrap { width: 100%; justify-content: center; }
  .pd-add-cart { width: 100% !important; text-align: center; }
  .pd-features-row { grid-template-columns: 1fr !important; }
  .pd-trust-row { grid-template-columns: 1fr !important; }
  .pd-trust-line { flex-direction: column !important; align-items: flex-start !important; gap: 6px !important; }
  .pd-reviews-summary { padding: 16px !important; gap: 16px !important; }
  .pd-reviews-big { font-size: 36px !important; }
  .pd-features-grid { grid-template-columns: 1fr !important; }
  .pd-tabs-nav { gap: 0; }
  .pd-tab { padding: 10px 12px !important; font-size: 12px !important; }
  
  /* Review cards */
  .pd-review { padding: 14px; }
  .pd-review-header { gap: 8px; }
  .pd-review-avatar { width: 32px; height: 32px; font-size: 13px; }
  
  /* Footer */
  .footer-grid-portal { grid-template-columns: 1fr !important; }
  
  /* Cart */
  .cart-table th, .cart-table td { padding: 8px 6px; font-size: 12px; }
  
  /* Checkout */
  .checkout-form input, .checkout-form textarea, .checkout-form select { padding: 10px; font-size: 14px; }
  .payment-methods { flex-direction: column; }
  
  /* Search */
  .search-results-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
  
  /* Category bar */
  .catbar-link { padding: 6px 10px !important; font-size: 11px !important; }
  
  /* Breadcrumbs */
  .bc-list { font-size: 12px; }
  
  /* Forum */
  .ft-products-grid { grid-template-columns: repeat(2, 1fr) !important; }
  
  /* Blog */
  .blog-card-img { height: 160px; }
  
  /* Collections */
  .collections-grid { grid-template-columns: 1fr !important; }
  
  /* Action hero */
  .action-hero h1 { font-size: 22px !important; }
}

/* ─── Touch-friendly improvements ─── */
@media (hover: none) and (pointer: coarse) {
  /* Larger tap targets */
  .pd-tab { min-height: 44px; display: flex; align-items: center; }
  .pd-var-btn { min-height: 44px; }
  .catbar-link { min-height: 40px; display: inline-flex; align-items: center; }
  .pagination a, .pagination span { min-height: 40px; min-width: 40px; display: flex; align-items: center; justify-content: center; }
  
  /* Remove hover effects that don't work on touch */
  .product-card:hover { transform: none; box-shadow: none; }
  .pd-main-wrap:hover .pd-main-img { transform: none; }
}

/* ─── Safe area for phones with notch ─── */
@supports (padding: env(safe-area-inset-bottom)) {
  .pd-sticky-bar.visible {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
}

/* ─── Landscape phone ─── */
@media (max-width: 768px) and (orientation: landscape) {
  .pd-grid { grid-template-columns: 1fr 1fr !important; gap: 16px !important; }
  .hero { padding: 30px 0; }
}

/* Related products - horizontal scroll on mobile */
@media (max-width: 768px) {
  .prod-grid-portal {
    display: flex !important;
    grid-template-columns: unset !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 12px !important;
    padding-bottom: 8px;
    scrollbar-width: none;
  }
  .prod-grid-portal::-webkit-scrollbar { display: none; }
  .prod-grid-portal > div {
    min-width: 42% !important;
    max-width: 42% !important;
    flex-shrink: 0;
    scroll-snap-align: start;
  }
}

/* Hide superadmin bar on mobile */
@media (max-width: 768px) {
  #admin-toolbar { display: none !important; }
}



/* Tabs on mobile - horizontal scroll, NOT sticky */
@media (max-width: 768px) {
  .pd-tabs-nav, .pd-tabs-nav-sticky {
    position: relative !important;
    top: auto !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    box-shadow: none !important;
  }
  .pd-tabs-nav::-webkit-scrollbar, .pd-tabs-nav-sticky::-webkit-scrollbar { display: none; }
}



/* FBT mobile layout */
@media (max-width: 768px) {
  .fbt-main { flex-direction: column !important; gap: 16px !important; }
  .fbt-products { flex-wrap: nowrap !important; overflow-x: auto !important; justify-content: flex-start !important; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .fbt-products::-webkit-scrollbar { display: none; }
  .fbt-card { width: 140px !important; min-width: 140px !important; flex-shrink: 0 !important; padding: 12px !important; }
  .fbt-card div[style*=width:140px] { width: 110px !important; height: 110px !important; }
  .fbt-summary { min-width: unset !important; width: 100% !important; padding: 20px !important; }
}

/* FBT Amazon style mobile */
@media (max-width: 768px) {
  .fbt-row { justify-content: center !important; gap: 8px !important; }
  .fbt-item { width: 100px !important; }
  .fbt-item div[style*=width:120px] { width: 90px !important; height: 90px !important; }
  .fbt-summary-compact { width: 100% !important; padding: 12px !important; border-top: 1px solid #f0f0f0; margin-top: 8px; }
}

/* FBT clean mobile */
@media (max-width: 768px) {
  .fbt-wrapper { flex-direction: column !important; }
  .fbt-products-row { flex-wrap: nowrap !important; overflow-x: auto !important; -webkit-overflow-scrolling: touch; scrollbar-width: none; gap: 10px !important; }
  .fbt-products-row::-webkit-scrollbar { display: none; }
  .fbt-product { min-width: 140px !important; max-width: 140px !important; flex-shrink: 0 !important; }
  .fbt-total-box { min-width: unset !important; width: 100% !important; border-left: none !important; border-top: 1px solid #f0f0f0 !important; padding-left: 0 !important; padding-top: 16px !important; text-align: center; align-items: center !important; }
}
