/* Global Mobile Overflow Fix */
* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Ensure all containers respect viewport width */
@media (max-width: 768px) {
  * {
    max-width: 100%;
  }

  body, html {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  main, section, article, div {
    max-width: 100%;
  }

  img, video, iframe {
    max-width: 100%;
    height: auto;
  }

  /* Fix for grid and flex containers */
  .products-grid,
  .reviews-grid,
  .support-grid,
  .account-grid,
  .top-grid {
    width: 100%;
    max-width: 100%;
  }

  /* Fix for navigation */
  .top-nav {
    max-width: 100%;
  }

  /* Fix for sections */
  .section,
  .hero-intro,
  .reviews-hero,
  .support-hero,
  .account-hero {
    max-width: 100%;
    overflow: hidden;
  }
}

@media (max-width: 768px) {
  .product-card {
    padding: 0.85rem !important;
    border-radius: 20px !important;
    min-height: 320px !important;
  }

  .product-visual {
    height: 160px !important;
    border-radius: 16px !important;
  }

  .product-content {
    padding: 0.85rem 0.4rem 0.4rem !important;
    gap: 0.6rem !important;
  }

  .product-content h3 {
    font-size: 1.05rem !important;
  }

  .product-price {
    font-size: 1.4rem !important;
  }

  .product-btn {
    padding: 0.8rem 0.8rem !important;
    font-size: 0.8rem !important;
    border-radius: 12px !important;
    width: 100% !important;
    white-space: nowrap !important;
  }

  .product-footer {
    margin-top: auto !important;
    gap: 0.6rem !important;
    flex-direction: column !important;
  }

  .products-grid, .recommendations-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) !important;
    gap: 0.8rem !important;
  }
}

@media (max-width: 480px) {
  * {
    max-width: 100%;
    box-sizing: border-box !important;
  }

  body, html {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    position: relative;
  }

  .products-grid, .recommendations-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.6rem !important;
  }

  .product-card {
    padding: 0.7rem !important;
    border-radius: 16px !important;
    gap: 0.5rem !important;
  }

  .product-visual {
    height: 125px !important;
    margin-bottom: 0.5rem !important;
    border-radius: 14px !important;
  }

  .product-title {
    font-size: 0.9rem !important;
    line-height: 1.3 !important;
  }

  .product-price {
    font-size: 1.2rem !important;
  }

  .product-btn {
    padding: 0.65rem 0.5rem !important;
    font-size: 0.75rem !important;
    border-radius: 11px !important;
    font-weight: 700 !important;
    width: 100% !important;
    white-space: nowrap !important;
    letter-spacing: -0.01em !important;
  }

  .product-footer {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.6rem !important;
    margin-top: 0.3rem !important;
  }

  .product-content {
    padding-bottom: 0.65rem !important;
  }

  .cart-panel__sheet {
    max-width: 100% !important;
    padding: 1.25rem !important;
  }

  .cart-item {
    padding: 0.75rem !important;
    border-radius: 12px !important;
  }

  .cart-item__info strong {
    font-size: 0.9rem !important;
  }

  .cart-item__info span {
    font-size: 1rem !important;
  }

  .cart-item__remove {
    width: 28px !important;
    height: 28px !important;
    font-size: 1.2rem !important;
  }

  .cart-item__controls {
    gap: 0.35rem !important;
  }

  .cart-qty-btn {
    width: 28px !important;
    height: 28px !important;
    font-size: 1.1rem !important;
  }

  .cart-qty {
    min-width: 36px !important;
    max-width: 50px !important;
    font-size: 0.9rem !important;
    padding: 0.3rem 0.35rem !important;
  }

  .stock-badge {
    font-size: 0.7rem !important;
    padding: 0.3rem 0.6rem !important;
  }

  .product-info {
    gap: 0.35rem !important;
  }

  .promo-field {
    flex-direction: row !important;
    gap: 0.5rem !important;
  }

  .promo-field input {
    font-size: 0.85rem !important;
    padding: 0.7rem 0.85rem !important;
  }

  .promo-field .btn {
    padding: 0.7rem 1rem !important;
    font-size: 0.8rem !important;
  }

  .cart-panel__body {
    max-height: calc(100vh - 380px) !important;
  }
}

