/**
 * product-sticky.css  —  child_hummingbird
 * Fixed for permanent mobile buy bar - NO overflow issues
 */

/* ── Hide normal add to cart button on mobile ONLY ── */
@media (max-width: 767.98px) {
  .product-add-to-cart-wrapper {
    display: block !important;
  }

  .product-add-to-cart-wrapper .add-to-cart {
    display: none !important;
  }

  .product-add-to-cart-wrapper .product-quantity {
    display: none !important;
  }
}

/* ── DESKTOP STICKY BAR ── */
#product-sticky-bar {
  background-color: #ffffff;
  border-bottom: 2px solid #dee2e6;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  left: 0;
  position: fixed;
  right: 0;
  top: 0;
  width: 100%;
  z-index: 1020;
  
  /* Hidden by default */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-100%);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
}

#product-sticky-bar.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Never shown on mobile */
@media (max-width: 767.98px) {
  #product-sticky-bar {
    display: none !important;
  }
}

/* ── Row 1: image + name | price | ATC button ── */
.product-sticky-bar__row1 {
  border-bottom: 1px solid #dee2e6;
}

.product-sticky-bar__row1 .container-md {
  align-items: center;
  display: flex;
  gap: 16px;
  min-height: 58px;
  padding-block: 8px;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  width: 100%;
}

@media (min-width: 1200px) {
  .product-sticky-bar__row1 .container-md {
    max-width: 1200px !important;
  }
}

.product-sticky-bar__img {
  border-radius: 8px;
  flex-shrink: 0;
  height: 46px;
  object-fit: cover;
  width: 46px;
}

.product-sticky-bar__name {
  flex: 1 1 0;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  color: #1a1a1a;
  /* Allow text to wrap to multiple lines */
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  /* Limit to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  /* Fallback for non-webkit browsers */
  max-height: 2.6em;
}

.product-sticky-bar__price {
  flex-shrink: 0;
  font-size: 1.2rem;
  font-weight: 700;
  white-space: nowrap;
  color: #1a1a1a;
  margin-left: auto;
}

.product-sticky-bar__atc {
  flex-shrink: 0;
  white-space: nowrap;
  border-radius: 10px;
  padding: 0.5rem 1.5rem;
}


/* Responsive adjustments for smaller desktop screens */
@media (max-width: 991.98px) {
  .product-sticky-bar__name {
    font-size: 0.8rem;
    max-height: 2.4em;
  }
  
  .product-sticky-bar__price {
    font-size: 1rem;
  }
  
  .product-sticky-bar__atc {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
  }
}

/* ── Row 2: anchor links ── */
.product-sticky-bar__row2 {
  background-color: #f8f9fa;
}

.product-sticky-bar__row2 .container-md {
  align-items: center;
  display: flex;
  gap: 28px;
  min-height: 36px;
  overflow-x: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  scrollbar-width: none;
  width: 100%;
}

@media (min-width: 1200px) {
  .product-sticky-bar__row2 .container-md {
    max-width: 1200px !important;
  }
}

.product-sticky-bar__row2 .container-md::-webkit-scrollbar {
  display: none;
}

.product-sticky-bar__anchor {
  border-bottom: 2px solid transparent;
  color: #6c757d;
  font-size: 0.8125rem;
  font-weight: 600;
  padding-block: 7px;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.product-sticky-bar__anchor:hover,
.product-sticky-bar__anchor:focus {
  color: #1a1a1a;
  border-color: #1a1a1a;
  outline: 2px solid transparent;
}

/* ── MOBILE QUANTITY STEPPER ── */
.mobile-quantity-wrapper {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid #dee2e6;
  border-radius: 10px;
  overflow: hidden;
  height: 44px;
  background-color: #ffffff;
  flex-shrink: 0;
}

.mobile-qty-btn {
  background: #f8f9fa;
  border: none;
  color: #1a1a1a;
  cursor: pointer;
  font-size: 1.25rem;
  font-weight: 600;
  height: 100%;
  line-height: 1;
  padding: 0 12px;
  transition: background-color 0.15s;
  user-select: none;
  -webkit-user-select: none;
  flex-shrink: 0;
  min-width: 40px;
}

.mobile-qty-btn:hover {
  background: #dee2e6;
}

.mobile-qty-btn:active {
  background: #ced4da;
}

.mobile-qty-input {
  border: none;
  border-left: 1px solid #dee2e6;
  border-right: 1px solid #dee2e6;
  border-radius: 0;
  font-size: 0.9rem;
  font-weight: 600;
  height: 100%;
  text-align: center;
  width: 48px;
  -moz-appearance: textfield;
  padding: 0;
}

.mobile-qty-input:focus {
  outline: none;
  background: #fff;
}

/* ── MOBILE BOTTOM BUY BAR (FULLY FIXED - NO OVERFLOW) ── */
@media (max-width: 767.98px) {
  #product-mobile-buybar {
    background-color: #ffffff;
    border-top: 1px solid #dee2e6;
    bottom: 0;
    left: 0;
    right: 0;
    position: fixed;
    width: 100%;
    z-index: 1030;
    /* Critical fixes for overflow */
    display: block !important;
    padding: 8px 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.10);
    overflow-x: hidden;
    box-sizing: border-box;
  }

  .product-mobile-buybar__inner {
    align-items: center;
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    margin: 0 auto;
    max-width: 540px;
    width: 100%;
    box-sizing: border-box;
  }

  .product-mobile-buybar__quantity {
    flex-shrink: 0;
  }

  /* The Add to Cart button - now with text wrapping */
  .product-mobile-buybar__btn {
    flex: 1 1 auto;
    font-size: 0.9rem;
    font-weight: 600;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 10px;
    white-space: normal;
    word-break: break-word;
    text-align: center;
    line-height: 1.3;
  }

  .product-mobile-buybar__btn i {
    font-size: 1.1rem;
    margin-right: 4px;
    vertical-align: middle;
  }

  /* Extra bottom padding for body to prevent content hiding */
  body.page-product {
    padding-bottom: 80px !important;
  }
}

/* Responsive adjustments for smaller mobile devices */
@media (max-width: 480px) {
  .mobile-qty-btn {
    padding: 0 10px;
    min-width: 38px;
    font-size: 1.1rem;
  }
  .mobile-qty-input {
    width: 44px;
  }
}

/* For very small screens (iPhone SE, small Androids) */
@media (max-width: 400px) {
  #product-mobile-buybar {
    padding: 6px 8px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .product-mobile-buybar__inner {
    gap: 6px;
  }

  .mobile-qty-btn {
    padding: 0 8px;
    min-width: 36px;
    font-size: 1rem;
  }

  .mobile-qty-input {
    width: 40px;
    font-size: 0.85rem;
  }

  .product-mobile-buybar__btn {
    font-size: 0.9rem;
    padding: 1.218rem .31rem
    min-height: 40px;
  }
  
  .product-mobile-buybar__btn i {
    font-size: 1rem;
  }
}

/* For extremely small screens (below 340px) */
@media (max-width: 340px) {
  .product-mobile-buybar__inner {
    gap: 4px;
  }
  
  .mobile-qty-btn {
    padding: 0 6px;
    min-width: 32px;
  }
  
  .mobile-qty-input {
    width: 36px;
  }
  
  .product-mobile-buybar__btn {
    font-size: 0.75rem;
    padding: 6px 6px;
  }
}