/*
 * BathnKitchen Mobile UI v3
 * Mobile-only presentation layer.
 * Does not modify Elementor templates or WooCommerce data.
 */

@media (max-width: 767px) {

  html, body {
    max-width: 100%;
    overflow-x: clip;
  }

  body {
    -webkit-text-size-adjust: 100%;
  }

  /* Better mobile rhythm without touching full-bleed Elementor backgrounds */
  .elementor-widget-text-editor,
  .elementor-widget-heading,
  .elementor-widget-button {
    max-width: 100%;
  }

  .elementor-widget-heading h1,
  .elementor-widget-heading h2,
  .elementor-widget-heading h3 {
    overflow-wrap: anywhere;
  }

  .elementor-widget-heading h1 {
    font-size: clamp(26px, 8vw, 36px);
    line-height: 1.12;
  }

  .elementor-widget-heading h2 {
    font-size: clamp(22px, 7vw, 30px);
    line-height: 1.16;
  }

  .elementor-widget-heading h3 {
    font-size: clamp(18px, 5.8vw, 24px);
    line-height: 1.22;
  }

  /* Touch targets */
  a.button,
  button,
  input[type="submit"],
  .woocommerce a.button,
  .woocommerce button.button,
  .woocommerce input.button {
    min-height: 42px;
  }

  /* WooCommerce archive/category product grid: 2 clean columns */
  body.woocommerce ul.products,
  body.woocommerce-page ul.products {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px 10px !important;
    margin: 0 !important;
  }

  body.woocommerce ul.products::before,
  body.woocommerce ul.products::after,
  body.woocommerce-page ul.products::before,
  body.woocommerce-page ul.products::after {
    display: none !important;
  }

  body.woocommerce ul.products li.product,
  body.woocommerce-page ul.products li.product {
    width: auto !important;
    float: none !important;
    clear: none !important;
    margin: 0 !important;
    min-width: 0;
    display: flex;
    flex-direction: column;
  }

  body.woocommerce ul.products li.product a.woocommerce-LoopProduct-link {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  body.woocommerce ul.products li.product img,
  body.woocommerce-page ul.products li.product img {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    margin: 0 0 8px !important;
  }

  body.woocommerce ul.products li.product .woocommerce-loop-product__title,
  body.woocommerce-page ul.products li.product .woocommerce-loop-product__title {
    font-size: 14px !important;
    line-height: 1.32 !important;
    min-height: 2.64em;
    margin: 0 0 5px !important;
    padding: 0 !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  body.woocommerce ul.products li.product .price,
  body.woocommerce-page ul.products li.product .price {
    font-size: 15px !important;
    line-height: 1.25 !important;
    margin: 2px 0 8px !important;
  }

  body.woocommerce ul.products li.product .button,
  body.woocommerce-page ul.products li.product .button {
    width: 100%;
    margin-top: auto !important;
    padding: 9px 8px !important;
    font-size: 12.5px !important;
    line-height: 1.2 !important;
    text-align: center;
    white-space: normal;
  }

  body.woocommerce span.onsale {
    min-width: 0 !important;
    min-height: 0 !important;
    width: auto !important;
    height: auto !important;
    padding: 5px 7px !important;
    font-size: 11px !important;
    line-height: 1 !important;
    border-radius: 5px !important;
  }

  /* Archive controls */
  .woocommerce .woocommerce-result-count,
  .woocommerce-page .woocommerce-result-count {
    width: 100%;
    float: none;
    margin: 0 0 8px;
    font-size: 13px;
  }

  .woocommerce .woocommerce-ordering,
  .woocommerce-page .woocommerce-ordering,
  .woolentor_archive_catalog_ordering form.woocommerce-ordering {
    width: 100% !important;
    float: none !important;
    margin: 0 0 14px !important;
  }

  .woocommerce .woocommerce-ordering select,
  .woocommerce-page .woocommerce-ordering select,
  .woolentor_archive_catalog_ordering form.woocommerce-ordering select {
    width: 100% !important;
    min-height: 44px;
  }

  /* Single product */
  body.single-product div.product {
    overflow: visible;
  }

  body.single-product div.product .woocommerce-product-gallery,
  body.single-product div.product .summary {
    width: 100% !important;
    float: none !important;
    clear: both !important;
  }

  body.single-product div.product .summary {
    margin-top: 18px !important;
  }

  body.single-product .product_title {
    font-size: clamp(22px, 6.5vw, 30px) !important;
    line-height: 1.18 !important;
  }

  body.single-product div.product p.price,
  body.single-product div.product span.price {
    font-size: 21px !important;
  }

  body.single-product form.cart {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  body.single-product form.cart .quantity {
    margin: 0 !important;
  }

  body.single-product form.cart .single_add_to_cart_button {
    flex: 1 1 190px;
    min-height: 46px;
  }

  body.single-product .woocommerce-tabs ul.tabs {
    display: flex !important;
    overflow-x: auto;
    gap: 6px;
    padding: 0 0 5px !important;
    scrollbar-width: none;
  }

  body.single-product .woocommerce-tabs ul.tabs::-webkit-scrollbar {
    display: none;
  }

  body.single-product .woocommerce-tabs ul.tabs li {
    flex: 0 0 auto;
    margin: 0 !important;
  }

  /* Cart */
  body.woocommerce-cart table.shop_table_responsive tr,
  body.woocommerce-cart .woocommerce-cart-form,
  body.woocommerce-cart .cart-collaterals,
  body.woocommerce-cart .cart_totals {
    width: 100% !important;
  }

  body.woocommerce-cart .cart-collaterals .cart_totals {
    float: none !important;
  }

  /* Checkout */
  body.woocommerce-checkout .woocommerce .col2-set,
  body.woocommerce-checkout .woocommerce .col2-set .col-1,
  body.woocommerce-checkout .woocommerce .col2-set .col-2,
  body.woocommerce-checkout #order_review_heading,
  body.woocommerce-checkout #order_review {
    width: 100% !important;
    float: none !important;
  }

  body.woocommerce-checkout .form-row-first,
  body.woocommerce-checkout .form-row-last {
    width: 100% !important;
    float: none !important;
  }

  body.woocommerce-checkout input.input-text,
  body.woocommerce-checkout select,
  body.woocommerce-checkout textarea {
    min-height: 44px;
    font-size: 16px; /* avoids iOS zoom */
  }

  /* Search fields */
  input[type="search"],
  input[type="text"],
  input[type="email"],
  input[type="tel"] {
    max-width: 100%;
  }

  /* Media */
  img,
  video,
  iframe {
    max-width: 100%;
  }

  /* Footer: more compact on phones */
  .custom-elementor-footer {
    overflow-x: clip;
  }

  .custom-elementor-footer .elementor-widget-heading {
    margin-bottom: 6px;
  }

  .custom-elementor-footer .elementor-widget-text-editor p {
    margin-bottom: 7px;
  }
}

/* Very small phones */
@media (max-width: 359px) {
  body.woocommerce ul.products,
  body.woocommerce-page ul.products {
    grid-template-columns: 1fr !important;
  }
}


/* === BATHNKITCHEN MOBILE FILTER SHORTCODE V6 === */

/* Safety: shortcode exists in page markup but never shows above mobile breakpoint. */
.bk-mobile-direct-filters {
  display: none;
}

@media (max-width: 767px) {
  .bk-mobile-direct-filters {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    clear: both !important;
    margin: 0 0 16px !important;
  }

  .bk-mobile-direct-filters .custom-woo-filters {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 12px !important;
    background: #fff !important;
    border: 1px solid #e7e7e7 !important;
    border-radius: 8px !important;
  }

  .bk-mobile-direct-filters .filter-group {
    margin: 0 !important;
    padding: 0 !important;
    border-bottom: 1px solid #eeeeee !important;
  }

  .bk-mobile-direct-filters .filter-group:last-child {
    border-bottom: 0 !important;
  }

  .bk-mobile-direct-filters .filter-toggle {
    min-height: 44px !important;
    margin: 0 !important;
    padding: 10px 2px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    font-size: 14px !important;
    line-height: 1.25 !important;
    font-weight: 600 !important;
  }

  .bk-mobile-direct-filters .filter-content {
    padding: 0 0 8px !important;
  }

  .bk-mobile-direct-filters .filter-content ul {
    max-height: 190px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .bk-mobile-direct-filters .filter-item {
    min-height: 36px !important;
    margin: 0 !important;
    padding: 5px 0 !important;
    display: flex !important;
    align-items: center !important;
    font-size: 13px !important;
  }

  .bk-mobile-direct-filters .filter-item input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    margin-right: 8px !important;
  }

  .bk-mobile-direct-filters .filter-item a {
    line-height: 1.25 !important;
  }
}
/* === END BATHNKITCHEN MOBILE FILTER SHORTCODE V6 === */


/* === BATHNKITCHEN MOBILE FILTER V6.1 CLEANUP ===
 * Keep the Elementor shortcode filter, hide the old theme sidebar only on mobile.
 */
@media (max-width: 767px) {
  /* Old Product Category Sidebar wrappers produced by the theme */
  .woocommerce-custom-sidebar,
  .product-sidebar {
    display: none !important;
  }

  /* Safety: if the shortcode filter is ever nested inside one of those wrappers,
     keep it visible. In the current Elementor setup it is outside them. */
  .bk-mobile-direct-filters {
    display: block !important;
  }
}
/* === END BATHNKITCHEN MOBILE FILTER V6.1 CLEANUP === */


/* === BATHNKITCHEN MOBILE FILTER V6.2 DUPLICATE FIX ===
 * The old filter is a WordPress widget:
 * Woo Multi-Select Filter -> widget_gthee_ultimate_filter_widget
 *
 * The Elementor mobile shortcode does NOT use this widget wrapper,
 * so we can safely hide the old widget itself on phones.
 */
@media (max-width: 767px) {
  section.widget_gthee_ultimate_filter_widget,
  .widget.widget_gthee_ultimate_filter_widget,
  .widget_gthee_ultimate_filter_widget {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }

  /* Our direct Elementor shortcode remains visible. */
  .bk-mobile-direct-filters,
  .bk-mobile-direct-filters .custom-woo-filters {
    display: block !important;
    visibility: visible !important;
    height: auto !important;
    overflow: visible !important;
  }
}
/* === END BATHNKITCHEN MOBILE FILTER V6.2 DUPLICATE FIX === */
