/* Global Responsive Utilities and Overrides */

/* Fluid media */
img, video { max-width: 100%; height: auto; }

/* Containers */
.container,
.section-container,
.main-container,
.checkout-container { width: 100%; padding-left: 16px; padding-right: 16px; }

/* Responsive grid helper (auto-fit) */
.resp-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* Utility visibility */
.hide-sm { display: none !important; }
.show-sm { display: block !important; }

/* Tables: make scrollable on small screens */
@media (max-width: 576px) {
  table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  thead, tbody, tr { width: 100%; }
}

/* Navbar collapse alignment for header.php */
@media (max-width: 820px) {
  #primaryNav { display: none; }
  #primaryNav.open { display: flex; flex-direction: column; gap: 8px; width: 100%; }
  #primaryNav a { padding: 10px 12px; border-radius: 8px; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2); }
}

/* Checkout paddings for medium screens */
@media (max-width: 1024px) {
  .checkout-container { flex-direction: column; gap: 20px; padding-left: 16px; padding-right: 16px; }
}

/* Generic spacing adjustments */
@media (max-width: 768px) {
  .container,
  .section-container,
  .main-container { padding-left: 12px; padding-right: 12px; }
}

/* Footer spacing tweaks */
@media (max-width: 576px) {
  .footer-section .row > [class*="col-"] { margin-bottom: 12px; }
}

/* Product/feature grids fallback */
.best-sellers-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }

/* Cart: ensure items block layout stacks nicely */
@media (max-width: 768px) {
  .cart-items { padding: 12px; }
  .cart-table th, .cart-table td { padding: 10px; }
}

/* Mobile search overrides - commented out to favor modern-styles.css */
/* 
@media (max-width: 820px) {
  header .search-container {
    ...
  }
  header .search-container.search-open .search-bar {
    width: 100%;
    max-width: 100%;
    background: #fff !important;
    border-radius: 10px;
    padding: 6px 8px;
    box-shadow: 0 10px 24px rgba(0,0,0,0.12);
  }
}
*/

@media (max-width: 576px) {
  /* Product detail image area: reduce max height for mobile */
  .ratio-1x1 { max-height: 240px; }
  /* Thumbnails: smaller touch targets on mobile */
  .thumbnail-container .h-80 { height: 60px; }
  .thumbnail-container .w-90 { width: 72px; }
  /* Buttons: ensure comfortable spacing */
  .btn-pad-md { padding-left: 12px; padding-right: 12px; }
}