/* Mobile performance and usability refinements. Keeps the existing visual design. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  width: 100%;
  height: auto !important;
  min-height: 100%;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior-y: auto;
  touch-action: pan-y;
}

body {
  min-width: 0;
  width: 100%;
  height: auto !important;
  min-height: 100%;
  max-height: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior-y: auto;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(78px + env(safe-area-inset-bottom)) !important;
}

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

img {
  height: auto;
}

.top-header {
  padding-top: env(safe-area-inset-top);
}

.cart-header,
.category-page-header,
.checkout-topbar {
  padding-top: env(safe-area-inset-top);
}

.page-footer.fixed-bottom,
.shop-bottom-nav,
.category-bottom-nav {
  position: fixed !important;
  inset: auto 0 0 0 !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff !important;
  z-index: 1050 !important;
  transform: translate3d(0, 0, 0) !important;
  -webkit-transform: translate3d(0, 0, 0) !important;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  isolation: isolate;
  box-sizing: border-box !important;
  height: calc(64px + env(safe-area-inset-bottom)) !important;
}

.page-footer.fixed-bottom .navbar {
  width: 100%;
  height: 64px !important;
  min-height: 64px !important;
  padding: 0 !important;
}

.page-footer.fixed-bottom .navbar-nav {
  height: 100%;
  flex-direction: row !important;
  align-items: stretch;
}

.page-footer.fixed-bottom .nav-item {
  height: 100%;
  min-width: 0;
}

.page-footer.fixed-bottom .nav-link {
  height: 100%;
  padding: 4px 2px !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.page-footer.fixed-bottom .nav-link .small {
  font-size: 11px;
  line-height: 1.1;
  text-align: center;
}

.page-content {
  height: auto !important;
  min-height: calc(100vh - 60px);
  max-height: none !important;
  overflow: visible !important;
  touch-action: pan-y;
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
  padding-bottom: calc(5rem + env(safe-area-inset-bottom));
}

.site-whatsapp-float {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  top: auto;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 9998;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 54px;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #25d366;
  color: #fff !important;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
  transform: none;
  transition: box-shadow .18s ease, background-color .18s ease;
}

.site-whatsapp-float i {
  font-size: 27px;
  line-height: 1;
}

.site-whatsapp-float span {
  display: none;
}

.site-whatsapp-float:hover,
.site-whatsapp-float:focus-visible {
  background: #1fbd5a;
  color: #fff;
  box-shadow: 0 11px 28px rgba(0, 0, 0, .26);
}

/* Slick keeps horizontal swiping while vertical gestures continue to scroll the page. */
.banner-slider,
.banner-slider .slick-list,
.review-slider,
.sales-category-slider,
.brands-slider,
.sales-accessories-slider {
  touch-action: pan-y pinch-zoom !important;
}

/* Keep every image inside the same homepage section at one visual height. */
.category .category-img img {
  display: block;
  width: 72px !important;
  height: 72px !important;
  margin: 0 auto 8px;
  border-radius: 50%;
  object-fit: cover !important;
}

.banner-slider .banner-item img {
  display: block;
  width: 100% !important;
  height: clamp(260px, 28vw, 340px) !important;
  object-fit: cover !important;
}

.topic-list-thumb {
  display: block;
  width: 88px !important;
  height: 88px !important;
  flex: 0 0 88px;
  overflow: hidden;
  border-radius: 14px;
}

.topic-list-thumb img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

.sales-category-slider .card > a,
.sales-accessories-slider .card > a {
  display: block;
  width: 100%;
  height: 220px;
  overflow: hidden;
  background: #f7f7f7;
}

.sales-category-slider .card > a img,
.sales-accessories-slider .card > a img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

.brands-slider .card-body {
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.brands-slider .card-body a {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
}

.brands-slider .card-body img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}

.language-switcher {
  margin-right: 2px;
}

.language-toggle {
  min-width: 58px;
  min-height: 42px;
  padding: 7px 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #fff;
  color: #212529;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.language-toggle::after {
  margin-left: 1px;
}

.language-menu {
  min-width: 164px;
  padding: 6px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .14);
}

.language-menu .dropdown-item {
  min-height: 46px;
  display: flex;
  align-items: center;
  border-radius: 10px;
  font-weight: 700;
}

.language-menu .dropdown-item.active,
.language-menu .dropdown-item:active {
  background: #212529;
  color: #fff;
}

.mobile-language-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f8f9fa;
}

.mobile-language-panel a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  color: #495057;
  font-weight: 700;
  text-decoration: none;
}

.mobile-language-panel a.active {
  background: #212529;
  color: #fff;
}

.offcanvas,
.modal,
.dropdown-menu {
  max-width: 100vw;
}

@media (max-width: 576px) {
  .site-whatsapp-float {
    right: max(14px, env(safe-area-inset-right));
  }

  .banner-slider .banner-item img {
    height: auto !important;
    aspect-ratio: 16 / 9;
  }

  .sales-category-slider .card > a,
  .sales-accessories-slider .card > a {
    height: 160px;
  }

  .brands-slider .card-body {
    height: 90px;
  }

  .top-header {
    padding-left: .65rem;
    padding-right: .65rem;
  }

  .top-header .navbar {
    gap: .35rem !important;
  }

  .top-header .brand-logo a {
    font-size: 1.05rem !important;
  }

  .top-header .top-right-menu .nav-link {
    padding-left: .45rem;
    padding-right: .45rem;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  button,
  .btn,
  .nav-link,
  .list-group-item,
  [role="button"] {
    touch-action: manipulation;
  }

  .top-header .nav-button a,
  .top-header .top-right-menu .nav-link {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .page-footer.fixed-bottom .nav-link {
    min-height: 56px;
  }

  .row {
    --bs-gutter-x: 1rem;
  }

  .table-responsive {
    -webkit-overflow-scrolling: touch;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
