/**
 * ElectroBazzar responsive fixes v2.1
 * Breakpoints: 320, 768, 992, 1200, 1440
 */

/* --- Global: prevent horizontal scroll --- */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

img, video, iframe, svg, table {
  max-width: 100%;
  height: auto;
}

/* --- Tap targets (mobile) --- */
@media (max-width: 767px) {
  a.button, button, .btn, .elementor-button,
  .add_to_cart_button, .single_add_to_cart_button,
  .woocommerce-mini-cart__buttons .button,
  input[type="submit"], .et-close-popup {
    min-height: 44px;
    min-width: 44px;
  }
}

/* --- Mobile: 320px–767px --- */
@media (max-width: 767px) {
  .container, .elementor-container, .et-container {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  /* Hero / banner text scaling */
  .elementor-heading-title,
  h1, .h1 {
    font-size: clamp(1.5rem, 6vw, 2.25rem) !important;
    line-height: 1.2 !important;
    word-wrap: break-word;
  }

  h2, .h2 {
    font-size: clamp(1.25rem, 5vw, 1.75rem) !important;
  }

  /* Stack Elementor columns */
  .elementor-column {
    width: 100% !important;
  }

  .elementor-row,
  .elementor-inner-section .elementor-container {
    flex-wrap: wrap !important;
  }

  /* Product grids: 2 columns on mobile */
  ul.products,
  .products-grid,
  .elementor-widget-woocommerce-products .products {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  ul.products li.product,
  .products-grid .product {
    width: 100% !important;
    margin: 0 !important;
    padding: 8px !important;
  }

  ul.products li.product .product-title,
  ul.products li.product h2 {
    font-size: 0.85rem !important;
    line-height: 1.3 !important;
  }

  /* Header / nav */
  .header-wrapper, .et-header-overlap,
  .mobile-header-wrapper {
    max-width: 100vw;
  }

  .et-mobile-menu, .navbar-toggle {
    z-index: 9999;
  }

  /* Hide overflow from sliders/carousels */
  .swiper-container, .slick-slider, .et-slider {
    overflow: hidden;
    max-width: 100%;
  }

  /* Footer stacks */
  .footer .elementor-column,
  .prefooter .elementor-column {
    width: 100% !important;
    margin-bottom: 1.5rem;
  }

  /* Reviews / testimonials */
  .elementor-testimonial, .testimonial-item {
    padding: 12px !important;
  }

  /* Blog cards */
  .et-post-slider .post-slide,
  article.post-item {
    max-width: 100%;
  }

  /* Fix wide tables */
  .woocommerce table.shop_table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Single product */
  .single-product .product .images,
  .single-product .product .summary {
    width: 100% !important;
    float: none !important;
  }

  .single-product .product_title {
    font-size: 1.25rem !important;
  }

  /* Search bar */
  .dgwt-wcas-search-wrapp,
  .et-search-form {
    max-width: 100%;
  }

  /* Icon boxes / features row */
  .elementor-icon-box-wrapper {
    text-align: center;
  }

  /* Prevent text overflow in cards */
  .product-content, .product-details {
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* --- Small phones: 320px–479px --- */
@media (max-width: 479px) {
  ul.products,
  .products-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  .elementor-button {
    font-size: 0.875rem !important;
    padding: 10px 16px !important;
  }

  .et_b_header-logo img {
    max-height: 40px;
    width: auto;
  }
}

/* --- Tablet: 768px–991px --- */
@media (min-width: 768px) and (max-width: 991px) {
  .container, .elementor-container {
    padding-left: 24px !important;
    padding-right: 24px !important;
  }

  ul.products,
  .products-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 16px !important;
  }

  .elementor-column[data-col="50"],
  .elementor-col-50 {
    width: 50% !important;
  }

  .elementor-column[data-col="33"],
  .elementor-col-33 {
    width: 33.333% !important;
  }

  h1, .h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem) !important;
  }

  .single-product .product .images {
    width: 45% !important;
  }

  .single-product .product .summary {
    width: 52% !important;
  }
}

/* --- Laptop: 992px–1199px --- */
@media (min-width: 992px) and (max-width: 1199px) {
  ul.products,
  .products-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }

  .elementor-section.elementor-section-boxed > .elementor-container {
    max-width: 960px;
  }
}

/* --- Desktop: 1200px–1439px --- */
@media (min-width: 1200px) and (max-width: 1439px) {
  .elementor-section.elementor-section-boxed > .elementor-container {
    max-width: 1140px;
  }

  ul.products,
  .products-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

/* --- Large desktop: 1440px+ --- */
@media (min-width: 1440px) {
  .elementor-section.elementor-section-boxed > .elementor-container {
    max-width: 1320px;
  }

  ul.products,
  .products-grid {
    grid-template-columns: repeat(5, 1fr) !important;
  }
}

/* --- Fix Elementor section overflow --- */
.elementor-section,
.elementor-widget-wrap {
  overflow: hidden;
}

/* --- WooCommerce sale badge --- */
.onsale {
  font-size: 0.75rem;
  padding: 4px 8px;
}

/* --- Sticky header spacing on mobile --- */
@media (max-width: 991px) {
  body.et-fixed-header-on .page-wrapper {
    padding-top: 0;
  }
}

/* --- Compare/add-to-cart buttons on mobile --- */
@media (max-width: 767px) {
  .et-compare-holder,
  .yith-wcwl-add-to-wishlist {
    display: none;
  }

  .add_to_cart_button {
    width: 100%;
    text-align: center;
  }
}
