/**
 * Site-wide mobile UI fixes (overflow, nav drawer, product/cart layouts).
 * Loaded after responsive.css from menu.php.
 */

/* Prevent horizontal scroll / white strip on the right */
html {
  overflow-x: hidden;
  max-width: 100%;
}

body {
  overflow-x: hidden;
  max-width: 100%;
}

.pageWrapper,
#page-content,
.main-content,
.product-template__container {
  max-width: 100%;
  overflow-x: hidden;
}

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

/* Desktop top header (PC only — bar hidden on mobile via d-none d-lg-block) */
@media only screen and (min-width: 992px) {
  .top-header {
    height: auto;
    min-height: 38px;
    padding-top: 8px;
    padding-bottom: 10px;
  }

  .top-header__row {
    flex-wrap: nowrap;
  }

  .top-header__left {
    padding-right: 15px;
  }

  .top-header__contact {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px 18px;
  }

  .top-header__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    font-size: 12px;
    line-height: 1.35;
    margin: 0;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .top-header__item i {
    flex-shrink: 0;
    color: #fff;
  }

  .top-header__right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 4px;
  }

  .top-header__right .user-menu {
    display: inline-block;
    margin-right: 6px;
  }

  .top-header__right .customer-links {
    display: inline-block;
    vertical-align: middle;
  }

  .top-header__right .customer-links li {
    display: inline-block;
  }
}

/* Mobile sidebar contact block */
.mobile-nav__contact {
  display: none;
}

/* ----- Mobile nav: overlay drawer (no page push = no white sidebar gap) ----- */
@media only screen and (max-width: 991px) {
  body.menuOn {
    overflow: hidden;
    position: relative;
  }

  body.menuOn .pageWrapper {
    left: 0 !important;
  }

  body.menuOn::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    pointer-events: auto;
    cursor: pointer;
  }

  .mobile-nav-wrapper {
    display: flex;
    flex-direction: column;
    width: min(280px, 88vw);
    left: calc(-1 * min(280px, 88vw));
    -webkit-overflow-scrolling: touch;
    z-index: 1001 !important;
    pointer-events: none;
  }

  .mobile-nav-wrapper.active {
    left: 0;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
    pointer-events: auto;
  }

  .mobile-nav-wrapper .closemobileMenu {
    flex-shrink: 0;
  }

  .mobile-nav__contact {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    gap: 10px;
    padding: 12px 15px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
  }

  .mobile-nav__contact-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: #222;
    font-size: 13px;
    line-height: 1.4;
    text-decoration: none;
    word-break: break-word;
  }

  a.mobile-nav__contact-item:hover {
    color: #000;
    text-decoration: none;
  }

  .mobile-nav__contact-item i {
    flex-shrink: 0;
    width: 18px;
    margin-top: 2px;
    text-align: center;
    color: #555;
  }

  .mobile-nav__contact-item span {
    flex: 1;
    min-width: 0;
  }

  #MobileNav {
    flex: 1 1 auto;
    height: auto !important;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #MobileNav li a {
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.08);
    z-index: 1;
  }

  #MobileNav li a.is-expanded {
    background: #f5f5f5;
  }

  #MobileNav li a .anm {
    pointer-events: auto;
    cursor: pointer;
    z-index: 2;
  }

  .mobile-nav-wrapper .closemobileMenu {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .header-wrap .container-fluid {
    padding-left: 12px;
    padding-right: 12px;
  }

  .header-wrap .row {
    flex-wrap: wrap;
  }

  #AccessibleNav,
  #siteNav {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
  }

  .header-wrap .row.align-items-center {
    flex-wrap: nowrap;
    margin-left: 0;
    margin-right: 0;
  }

  .header-wrap .col-2.col-sm-3.col-md-3.col-lg-8 {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
    padding-left: 8px;
    padding-right: 0;
  }

  .header-wrap .mobile-logo {
    flex: 1 1 auto;
    max-width: none;
    text-align: center;
    padding-left: 4px;
    padding-right: 4px;
  }

  .header-wrap .col-4.col-sm-3.col-md-3.col-lg-2 {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
    padding-left: 4px;
    padding-right: 8px;
    text-align: right;
  }

  .header-wrap .site-header__menu {
    min-width: 44px;
    min-height: 44px;
    padding: 8px;
    line-height: 1;
  }

  .mobile-logo {
    padding-left: 8px;
    padding-right: 8px;
  }

  .mobile-logo .logo img {
    max-height: 44px;
    width: auto;
  }

  .top-header .user-menu {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
    cursor: pointer;
  }

  .whish {
    margin-left: 8px !important;
  }

  .site-cart {
    display: inline-block;
  }

  #header-cart {
    max-width: calc(100vw - 24px);
    right: 12px;
    left: auto;
  }

  /* Listing filter drawer */
  .filterbar.active {
    max-width: min(280px, 88vw);
  }
}

@media only screen and (max-width: 767px) {
  .container-fluid {
    padding-left: 15px !important;
    padding-right: 15px !important;
  }

  .bredcrumbWrap .breadcrumbs {
    font-size: 12px;
    word-break: break-word;
  }

  /* Product page */
  .template-product .product-single__title,
  .template-product h1.product-single__title {
    font-size: 1.15rem !important;
    line-height: 1.35;
    word-break: break-word;
  }

  .template-product .tabs-listing .product-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-bottom: 1px solid #e8e9eb;
  }

  .template-product .tabs-listing .product-tabs li {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
  }

  .template-product .tabs-listing .product-tabs a {
    padding: 12px 8px !important;
    font-size: 11px;
    letter-spacing: 0.02em;
    white-space: normal;
    line-height: 1.25;
  }

  .template-product .tabs-listing .tab-container iframe {
    width: 100% !important;
    height: auto !important;
    min-height: 200px;
    aspect-ratio: 16 / 9;
  }

  .pd-meta-item {
    grid-template-columns: 1fr !important;
    gap: 0.25rem !important;
  }

  .pd-wholesale-card,
  .pd-purchase-box,
  .pd-live-price {
    margin-left: 0;
    margin-right: 0;
  }

  .pd-wholesale-table {
    font-size: 0.8rem;
  }

  .pd-action-btn__text {
    align-items: center;
    text-align: center;
  }

  .pd-actions {
    grid-template-columns: 1fr !important;
  }

  .pd-action-btn--cart,
  .pd-action-btn--wishlist {
    grid-column: auto !important;
  }

  /* Related products carousel */
  .grid-products.productSlider,
  .grid-products.productSlider .slick-list,
  .productPageSlider .slick-list {
    overflow: hidden;
    max-width: 100%;
  }

  .grid-products .item {
    padding-left: 8px;
    padding-right: 8px;
  }

  /* Cart / checkout tables */
  .table-content.table-responsive,
  .your-order-table.table-responsive,
  .wishlist-table.table-responsive {
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
  }

  .store-info {
    display: block !important;
  }

  .store-info li.display-table-cell {
    display: block !important;
    width: 100% !important;
    padding: 12px 15px;
  }

  /* Footer columns */
  .footer-top .row > [class*="col-"] {
    margin-bottom: 8px;
  }
}

@media only screen and (max-width: 575px) {
  .product-gallery-thumbs__scroller {
    mask-image: none;
    -webkit-mask-image: none;
  }

  .pd-sale-lg {
    font-size: 1.45rem !important;
  }

  .pd-variant-card {
    padding: 0.65rem 0.75rem;
  }
}
