/* IT Promax — customer storefront phone clarity
   Loaded site-wide after store-chrome.css */

/* Safer viewport math */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}
img, video, svg, canvas, iframe {
  max-width: 100%;
  height: auto;
}
* { box-sizing: border-box; }

/* Room for chat FAB + sticky buy on phones */
@media (max-width: 768px) {
  body {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .container {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }

  /* ---- Typography & touch ---- */
  input, select, textarea, button {
    font-size: 16px !important; /* stop iOS zoom */
  }
  .btn-main,
  .btn-add-to-cart,
  .product-add-btn,
  .product-buy-now {
    min-height: 48px;
    border-radius: 12px;
  }

  /* ---- Product cards (shop / related) ---- */
  .store-products-grid,
  .shop-products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }
  .store-product-card,
  .product-card {
    min-width: 0;
  }
  .product-name a,
  .product-card .product-name a {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.35;
  }
  .product-price {
    font-size: 16px;
    font-weight: 800;
  }
  .btn-add-to-cart {
    width: 100%;
    justify-content: center;
  }

  /* ---- Shop ---- */
  .shop-toolbar {
    flex-direction: column;
    align-items: stretch !important;
    gap: 10px;
  }
  .shop-toolbar select,
  .shop-sort,
  .shop-result-count {
    width: 100%;
    white-space: normal;
  }
  .shop-filter-toggle {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }
  .shop-sidebar.is-open,
  .shop-sidebar.open {
    padding: 16px 14px calc(24px + env(safe-area-inset-bottom));
  }

  /* ---- Product detail ---- */
  .product-page .container {
    padding-top: 12px;
    padding-bottom: 120px;
  }
  .product-layout {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .product-gallery {
    position: static !important;
  }
  .product-main-img {
    border-radius: 16px;
  }
  .product-main-img img {
    padding: 16px !important;
  }
  .product-title {
    font-size: clamp(18px, 5.2vw, 22px) !important;
    line-height: 1.3 !important;
    max-width: none !important;
  }
  .product-purchase {
    padding: 16px !important;
    border-radius: 14px;
    gap: 12px !important;
  }
  .product-price-main {
    font-size: clamp(22px, 7vw, 28px);
  }
  .product-actions {
    display: grid !important;
    grid-template-columns: auto 1fr;
    gap: 8px;
    width: 100%;
  }
  .product-actions .qty-control {
    grid-row: 1;
  }
  .product-actions .product-add-btn {
    grid-column: 2;
    min-width: 0 !important;
    width: 100%;
  }
  .product-actions form {
    grid-column: 1 / -1;
    display: block;
    width: 100%;
  }
  .product-actions .product-buy-now {
    width: 100%;
    min-height: 48px;
  }
  .product-tool-row {
    gap: 8px !important;
  }
  .product-tool {
    min-height: 40px;
    padding: 8px 10px;
    font-size: 12px;
  }

  /* Sticky buy strip on phones */
  .product-sticky-buy {
    display: flex !important;
  }

  /* ---- Cart / checkout ---- */
  .checkout-page .form-row,
  .field-grid-2,
  .checkout-layout,
  .cart-layout {
    grid-template-columns: 1fr !important;
  }
  .checkout-page .form-group label,
  .checkout-page label {
    white-space: normal !important;
  }
  .checkout-inline-label {
    flex-wrap: wrap;
    white-space: normal !important;
  }
  .checkout-totals,
  .cart-summary,
  .checkout-sidebar {
    position: static !important;
  }
  .payment-opt,
  .checkout-payment-option {
    min-height: 52px;
  }
  .wa-handoff-inner {
    padding: 0 14px;
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .wa-handoff-btn {
    width: 100%;
    justify-content: center;
  }

  /* ---- Talk CTA ---- */
  .seo-talk-cta {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    padding: 14px !important;
  }
  .seo-talk-cta > div:last-child {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .seo-talk-cta a {
    justify-content: center !important;
    min-height: 44px;
  }

  /* ---- Home (ezone) ---- */
  .ezone-home {
    --ez-pad: 12px;
  }
  .ezone-home .ez-section,
  .ezone-home .ez-bs,
  .ezone-home .ez-dod,
  .ezone-home .ez-cap {
    padding-left: 14px !important;
    padding-right: 14px !important;
    border-radius: 16px !important;
  }
  .ezone-home .ez-bs__title,
  .ezone-home .ez-dod__title {
    font-size: clamp(1.35rem, 6vw, 1.7rem) !important;
  }
  .ezone-home .ez-bs__tabs.ez-tabs,
  .ezone-home .ez-filter-pills {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    scrollbar-width: none;
  }
  .ezone-home .ez-bs__tabs.ez-tabs::-webkit-scrollbar,
  .ezone-home .ez-filter-pills::-webkit-scrollbar {
    display: none;
  }
  .ezone-home .ez-bs__tab.ez-tab,
  .ezone-home .ez-filter-pills a {
    flex: 0 0 auto;
    min-height: 40px;
  }
  .ezone-home .ez-bs__controls {
    width: 100%;
  }
  .ezone-home .ez-bs__all {
    width: 100%;
    justify-content: center;
  }
  .ezone-home .ez-bs__nav {
    display: none !important;
  }
  .ezone-home .ez-card__title,
  .ezone-home .ez-card h3,
  .ezone-home .ez-card h4 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 13px !important;
    line-height: 1.35;
  }
  .ezone-home .ez-trust {
    grid-template-columns: 1fr !important;
    gap: 8px;
    padding: 12px;
  }
  .ezone-home .ez-brands-v3 {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  .ezone-home .ez-hero-nx__title {
    font-size: clamp(1.45rem, 7vw, 1.85rem) !important;
  }
  .ezone-home .ez-hero-nx__sub {
    font-size: 14px !important;
  }
  .ezone-home .ez-hero-nx__cta {
    width: 100%;
    justify-content: center;
  }
  .ezone-home .ez-top {
    bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
    right: 12px !important;
  }

  /* ---- Footer ---- */
  .store-footer-grid {
    grid-template-columns: 1fr !important;
  }
  .footer-newsletter-row {
    flex-direction: column;
  }
  .footer-newsletter-row input,
  .footer-newsletter-row button {
    width: 100%;
    min-height: 44px;
  }

  /* ---- Chat ---- */
  .itp-chat-root {
    right: 12px !important;
    bottom: max(16px, env(safe-area-inset-bottom)) !important;
  }
  .itp-chat-panel {
    position: fixed !important;
    left: 8px !important;
    right: 8px !important;
    bottom: max(84px, calc(72px + env(safe-area-inset-bottom))) !important;
    width: auto !important;
    max-height: min(72vh, 560px) !important;
    border-radius: 16px !important;
  }
  .itp-proactive {
    right: 12px !important;
    bottom: calc(150px + env(safe-area-inset-bottom)) !important;
    left: 12px !important;
    width: auto !important;
  }
}

/* Sticky product buy bar (phones only) */
.product-sticky-buy {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 65;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.96);
  border-top: 1px solid #d7e6f0;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 -8px 24px rgba(3,70,110,.1);
}
.product-sticky-buy .product-sticky-price {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  flex: 0 0 auto;
  padding-right: 4px;
}
.product-sticky-buy .product-sticky-price strong {
  font-size: 16px;
  font-weight: 800;
  color: #03466e;
  line-height: 1.1;
}
.product-sticky-buy .product-sticky-price span {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
}
.product-sticky-buy button,
.product-sticky-buy .btn-main {
  flex: 1;
  min-height: 46px;
  justify-content: center;
}

@media (min-width: 769px) {
  .product-sticky-buy { display: none !important; }
}

@media (max-width: 420px) {
  .store-products-grid,
  .shop-products-grid {
    gap: 8px !important;
  }
  .product-actions {
    grid-template-columns: 1fr !important;
  }
  .product-actions .qty-control {
    width: 100%;
    justify-content: space-between;
  }
  .product-actions .qty-control input {
    flex: 1;
  }
}
