/* EpinStore V4.0.2 FINAL LAYOUT FIX
   Scope: storefront alignment + product detail + admin stylesheet isolation.
   Does not change database, products, banners or config. */

/* The V4 storefront uses a centered content rail. Older V3/V4 files left
   homepage sections full-bleed; keep the same rail as the header. */
.hero-shell,
.v4-section,
body > .section,
body > section.section,
main > .section,
main.container > .section {
  width: min(var(--v4-max), calc(100% - 48px)) !important;
  max-width: var(--v4-max) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box;
}

.hero-shell {
  margin-top: 10px !important;
  min-width: 0 !important;
}

.v4-section {
  min-width: 0 !important;
}

/* Prevent a section from creating a wider grid than the centered rail. */
.hero-shell,
.v4-section,
.section,
.v31-product-detail,
.product-grid,
.v4-category-grid,
.v4-brand-grid,
.v4-live-strip {
  min-width: 0 !important;
  max-width: 100%;
}

/* Product page: retain the premium 3-column desktop composition until the
   content rail genuinely becomes too narrow. */
.v31-product-detail {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.75fr) minmax(230px, .72fr) !important;
  gap: 16px !important;
  align-items: stretch !important;
}

.product-detail-media,
.product-detail-main,
.product-trust {
  min-width: 0 !important;
  box-sizing: border-box;
}

.product-detail-image {
  aspect-ratio: 1 / 1 !important;
  min-height: 0 !important;
  overflow: hidden !important;
  background: #0b121a !important;
}

.product-detail-image img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  display: block !important;
  padding: 12px !important;
  box-sizing: border-box !important;
  background: #0b121a !important;
}

.product-detail-main {
  overflow: hidden !important;
}

.product-detail-main h1 {
  overflow-wrap: anywhere;
}

.product-spec-grid {
  min-width: 0 !important;
}

.detail-buy {
  min-width: 0 !important;
}

.detail-buy .btn {
  min-width: 0 !important;
  flex: 1 1 auto;
}

.product-trust {
  align-self: stretch !important;
}

/* Keep the header and content rail visually locked together. */
.container.wide-container {
  width: min(var(--v4-max), calc(100% - 48px)) !important;
  max-width: var(--v4-max) !important;
}

/* Explicitly hide any legacy status badge if an older template injects it. */
.v4-status,
.admin-v4-status,
.system-active,
.system-status,
.status-active {
  display: none !important;
}

@media (max-width: 1100px) {
  .v31-product-detail {
    grid-template-columns: minmax(280px, .95fr) minmax(0, 1.45fr) !important;
  }
  .product-trust {
    grid-column: 1 / -1 !important;
  }
}

@media (max-width: 850px) {
  .hero-shell,
  .v4-section,
  body > .section,
  body > section.section,
  main > .section,
  main.container > .section {
    width: calc(100% - 32px) !important;
  }

  .v31-product-detail {
    grid-template-columns: 1fr !important;
  }

  .product-trust {
    grid-column: auto !important;
  }
}

@media (max-width: 680px) {
  .hero-shell,
  .v4-section,
  body > .section,
  body > section.section,
  main > .section,
  main.container > .section,
  .container.wide-container {
    width: calc(100% - 28px) !important;
  }
}
