/* Single product page shell, tabs, related products, mobile quantity UI,
   sticky purchase bar and native Woo notices.
   Hero/gallery/buy-box styles live in product-hero.css. */

/* Page shell ------------------------------------------------------------- */
.single-product-page {
  padding: 18px 0 128px;
}

.single-breadcrumbs {
  margin-bottom: 14px;
}

.single-section-card {
  padding: 14px;
  border: 0;
  border-radius: var(--batya-radius-card);
  background: var(--batya-card);
  box-shadow: none;
}

.single-product-main {
  display: grid;
  gap: var(--batya-space-3);
  margin-top: 12px;
}

/* Every major single-product child participates in grids/flex layouts. Keep
   their intrinsic min-content width from making the mobile page a few pixels
   wider than the viewport when a tab, attribute or plugin string is long. */
.single-product-page,
.single-product-layout,
.single-product-hero,
.single-product-main,
.single-product-tabs,
.single-product-tabs .woocommerce-tabs,
.single-product-tabs .woocommerce-Tabs-panel,
.single-product-related,
.single-product-related__content {
  min-width: 0;
  max-width: 100%;
}

/* Product tabs ----------------------------------------------------------- */
.single-product-tabs .woocommerce-tabs ul.tabs {
  display: flex;
  gap: var(--batya-space-2);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.single-product-tabs .woocommerce-tabs ul.tabs li {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
}

.single-product-tabs .woocommerce-tabs ul.tabs li a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--batya-border);
  border-radius: var(--batya-radius-pill);
  background: var(--batya-surface);
  font-size: 14px;
  white-space: nowrap;
}

.single-product-tabs .woocommerce-tabs ul.tabs li.active a {
  border-color: var(--batya-text);
  background: var(--batya-card);
}

.single-product-tabs .woocommerce-tabs ul.tabs::before,
.single-product-tabs .woocommerce-tabs ul.tabs::after {
  border: 0;
}

.single-product-tabs .woocommerce-tabs ul.tabs::before,
.single-product-tabs .woocommerce-tabs ul.tabs::after,
.single-product-tabs .woocommerce-tabs .panel,
.single-product-tabs .woocommerce-tabs .woocommerce-Tabs-panel {
  box-shadow: none;
}

.single-product-tabs .woocommerce-Tabs-panel--description,
.single-product-tabs .woocommerce-Tabs-panel--additional_information,
.single-product-tabs .woocommerce-Tabs-panel--reviews {
  margin: 0;
}

.single-product-tabs .woocommerce-Tabs-panel {
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.single-product-tabs .woocommerce-Tabs-panel > *:last-child {
  margin-bottom: 0;
}

.single-product-tabs .woocommerce-Tabs-panel > h2:first-child,
.single-product-tabs .woocommerce-Tabs-panel > h3:first-child {
  margin-top: 0;
}

.single-product-tabs .woocommerce-Tabs-panel p,
.single-product-tabs .woocommerce-Tabs-panel ul,
.single-product-tabs .woocommerce-Tabs-panel ol {
  margin-top: 0;
  margin-bottom: 12px;
}

.single-product-tabs .shop_attributes {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  border: 0;
}

.single-product-tabs .shop_attributes th,
.single-product-tabs .shop_attributes td {
  padding: 10px 0;
  border-bottom: 1px solid var(--batya-border);
}

.single-product-tabs .shop_attributes tr:last-child th,
.single-product-tabs .shop_attributes tr:last-child td {
  border-bottom: 0;
}

.single-product-tabs .shop_attributes th {
  width: 42%;
  font-weight: var(--batya-weight-medium);
}

.single-product-tabs .shop_attributes td p {
  margin: 0;
}

/* Related products ------------------------------------------------------- */
.single-product-related {
  margin-top: 18px;
}

.single-product-related__title {
  margin: 0 0 14px;
  font-size: 1.35rem;
  line-height: 1.15;
}

.single-product-related .products li.product,
.single-product-related .products[class*="columns-"] li.product {
  float: none;
  width: auto;
  margin: 0;
}

.single-product-related .product-card {
  min-width: 0;
}

.single-product-related__grid,
.single-product-related .products,
.single-product-related__skeleton {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.single-product-related__content:empty {
  display: none;
}

.single-related-skeleton-card {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.single-related-skeleton-card__media,
.single-related-skeleton-card__line,
.single-related-skeleton-card__price {
  border-radius: var(--batya-radius);
  background: linear-gradient(90deg, #f6f1eb 0%, #e9e0d7 50%, #f6f1eb 100%);
  background-size: 200% 100%;
  animation: batyaSkeleton 1.35s linear infinite;
}

.single-related-skeleton-card__media {
  aspect-ratio: var(--batya-product-media-ratio);
}

.single-related-skeleton-card__line {
  height: 14px;
}

.single-related-skeleton-card__line.is-short {
  width: 55%;
}

.single-related-skeleton-card__price {
  width: 42%;
  height: 20px;
}

@keyframes batyaSkeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Mobile sticky purchase bar -------------------------------------------- */
.single-sticky-bar {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: calc(62px + env(safe-area-inset-bottom, 0px));
  z-index: 45;
  display: flex;
  align-items: center;
  gap: var(--batya-space-2);
  padding: 8px 8px 8px 10px;
  border: 1px solid color-mix(in srgb, var(--batya-border) 82%, transparent);
  border-radius: var(--batya-radius-lg);
  background: rgba(255, 253, 250, .97);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 28px rgba(40, 31, 23, .12);
}

.single-sticky-bar[hidden] {
  display: none;
}

.single-sticky-bar__meta {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 1px;
}

.single-sticky-bar__title {
  overflow: hidden;
  color: var(--batya-text-soft);
  font-size: 12px;
  font-weight: var(--batya-weight-medium);
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.single-sticky-bar__price {
  font-size: 14px;
  font-weight: var(--batya-weight-semibold);
  line-height: 1.2;
}

.single-sticky-bar__button {
  flex: 0 0 auto;
  min-width: 108px;
  min-height: 40px;
  padding-inline: 14px;
}

/* Mobile quantity stepper ----------------------------------------------- */
@media (max-width: 991.98px) {
  .single-product-card__cta form.cart.has-batya-mobile-stepper {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--batya-space-2) var(--batya-space-3);
  }

  .single-product-card__cta form.cart.has-batya-mobile-stepper > .batya-mobile-qty-label {
    display: block;
    grid-column: 1;
    grid-row: 1;
    margin: 0;
    color: var(--batya-text-soft);
    font-size: 13px;
    font-weight: var(--batya-weight-medium);
    line-height: 1.3;
  }

  .single-product-card__cta form.cart.has-batya-mobile-stepper > .quantity.batya-quantity-stepper {
    display: grid;
    grid-column: 2;
    grid-row: 1;
    grid-template-columns: 40px 44px 40px;
    align-items: stretch;
    width: 124px;
    height: 42px;
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--batya-border);
    border-radius: var(--batya-radius-control);
    background: var(--batya-surface);
    transition: border-color .15s ease, box-shadow .15s ease;
  }

  .single-product-card__cta form.cart.has-batya-mobile-stepper > .quantity.batya-quantity-stepper:focus-within {
    border-color: var(--batya-border-strong);
    box-shadow: 0 0 0 2px var(--batya-brand-soft);
  }

  .single-product-card__cta .batya-quantity-stepper .batya-qty-stepper__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--batya-text);
    font-size: 20px;
    font-weight: var(--batya-weight-regular);
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
  }

  .single-product-card__cta .batya-quantity-stepper .batya-qty-stepper__button:active:not(:disabled) {
    background: var(--batya-surface-2);
  }

  .single-product-card__cta .batya-quantity-stepper .batya-qty-stepper__button:disabled {
    color: var(--batya-text-faint);
    opacity: .45;
    cursor: default;
  }

  .single-product-card__cta form.cart.has-batya-mobile-stepper > .quantity.batya-quantity-stepper .qty {
    width: 44px;
    min-width: 0;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    text-align: center;
  }

  .single-product-card__cta form.cart.has-batya-mobile-stepper > .quantity.batya-quantity-stepper .qty:focus {
    outline: none;
  }

  .single-product-card__cta form.cart.has-batya-mobile-stepper > .single_add_to_cart_button {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    min-height: var(--batya-control);
    margin: 0;
  }

  .single-product-tabs .woocommerce-tabs .panel,
  .single-product-tabs .woocommerce-Tabs-panel,
  .single-product-tabs .panel,
  .single-product-tabs .woocommerce-tabs__panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 0 !important;
    box-sizing: border-box;
  }

  h2.single-product-related__title,
  .single-product-related__title,
  .related.products > h2,
  .upsells.products > h2,
  .single-product-main > section > h2,
  .single-product-main > div > h2 {
    padding-left: var(--content-gutter, 12px) !important;
    padding-right: var(--content-gutter, 12px) !important;
    box-sizing: border-box;
  }

  .related.products > h2,
  .upsells.products > h2 {
    margin-bottom: 10px;
  }
}

@media (max-width: 767.98px) {
  /* Horizontal scrolling belongs only to the tabs/thumb rails themselves.
     Clip accidental sub-pixel/plugin overflow at the product layout boundary
     so the whole page cannot be dragged sideways on touch devices. */
  .single-product-layout.site-container {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  }

  .single-product-tabs .woocommerce-tabs {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  .single-product-tabs .woocommerce-tabs ul.tabs {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .single-product-tabs .woocommerce-tabs ul.tabs::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }
}

/* Native Woo notices ---------------------------------------------------- */
.single-product-card__native-notices:empty {
  display: none;
}

.single-product-card__native-notices .woocommerce-message[hidden] {
  display: none !important;
}

.single-product-card__native-notices .woocommerce-message,
.single-product-card__native-notices .woocommerce-info,
.single-product-card__native-notices .woocommerce-error {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--batya-radius-control);
  box-shadow: none;
  font-size: 13px;
  line-height: 1.4;
}

.single-product-card__native-notices .woocommerce-message li,
.single-product-card__native-notices .woocommerce-info li,
.single-product-card__native-notices .woocommerce-error li {
  margin: 0;
}

/* JS normalizes success into the custom feedback area; this is the no-JS fallback. */
.single-product-card__native-notices .woocommerce-message {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--batya-space-3);
  margin-top: var(--batya-space-2);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--batya-success-text);
  font-size: 13px;
  font-weight: var(--batya-weight-medium);
}

.single-product-card__native-notices .woocommerce-info {
  border-color: var(--batya-border);
  background: var(--batya-surface-soft);
  color: var(--batya-text);
}

/* A cart/stock limit is a purchase constraint rather than a fatal error.
   Keep it visible but use the same warm palette as the buy box instead of an
   aggressive red alert that competes with the primary CTA. */
.single-product-card__native-notices .woocommerce-error {
  border-color: color-mix(in srgb, var(--batya-brand) 30%, var(--batya-border));
  background: color-mix(in srgb, var(--batya-brand-soft) 52%, #fff);
  color: var(--batya-text);
  font-weight: var(--batya-weight-medium);
}

.single-product-card__native-notices .woocommerce-error a,
.single-product-card__native-notices .woocommerce-info a {
  color: inherit;
  font-weight: var(--batya-weight-semibold);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.single-product-card__native-notices .woocommerce-message .wc-forward {
  min-height: 0;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.single-product-card__native-notices .woocommerce-message .wc-forward:hover {
  background: transparent;
  color: inherit;
  text-decoration-thickness: 2px;
}

/* Responsive page-only layout ------------------------------------------- */
@media (min-width: 768px) {
  .single-product-related__grid,
  .single-product-related .products,
  .single-product-related__skeleton {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 992px) {
  .single-product-page {
    padding-bottom: 32px;
  }

  .single-section-card {
    padding: 18px;
  }

  .single-product-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .single-product-related__grid,
  .single-product-related .products,
  .single-product-related__skeleton {
    gap: var(--batya-space-3);
  }

  .single-sticky-bar {
    display: none;
  }
}

@media (min-width: 1200px) {
  .single-product-related__grid,
  .single-product-related .products,
  .single-product-related__skeleton {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
