:root {
  --detail-card: #ffffff;
  --detail-line: #dfe8e4;
  --detail-soft: #f7faf8;
  --detail-green: #117c68;
  --detail-green-dark: #0a5549;
  --detail-red: #a83b43;
  --detail-pink: #e83f73;
  --detail-shadow: 0 14px 38px rgba(20, 65, 56, 0.08);
}

body {
  font-family: IRANSans, Tahoma, "Segoe UI", sans-serif;
}

.page.product-detail-shell {
  width: min(1680px, calc(100% - 48px));
  margin: 28px auto 0;
}


.product-detail-responsive-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.72fr) minmax(0, 1.55fr);
  grid-template-areas:
    "articles hero"
    "ad ad"
    "specs sellers"
    "similar similar";
  gap: 26px 28px;
  align-items: start;
  direction: ltr;
}

.detail-area {
  min-width: 0;
  direction: rtl;
}

.detail-area > .product-primary,
.detail-area > .product-section {
  margin-top: 0;
}

.detail-area--hero {
  grid-area: hero;
}

.detail-area--articles {
  grid-area: articles;
}

.detail-area--ad {
  grid-area: ad;
}

.detail-area--specs {
  grid-area: specs;
}

.detail-area--sellers {
  grid-area: sellers;
}

.detail-area--similar {
  grid-area: similar;
}

.detail-area--hero > .product-primary,
.detail-area--articles > .product-section,
.detail-area--specs > .product-section,
.detail-area--sellers > .product-section {
  height: 100%;
}

.detail-ad-slot {
  min-height: 148px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 24px 34px;
  overflow: hidden;
  border: 1px solid #dbe7e3;
  border-radius: 20px;
  background:
    radial-gradient(circle at 15% 20%, rgba(232, 63, 115, 0.13), transparent 32%),
    linear-gradient(125deg, #ffffff 0%, #f5faf8 56%, #edf5f2 100%);
  box-shadow: var(--detail-shadow);
}

.detail-ad-copy {
  display: grid;
  gap: 5px;
}

.detail-ad-copy span {
  color: var(--detail-pink);
  font-size: 0.74rem;
  font-weight: 800;
}

.detail-ad-copy strong {
  color: #173d38;
  font-size: clamp(1.15rem, 2vw, 1.75rem);
}

.detail-ad-copy small {
  color: #6b7f7b;
  line-height: 1.8;
}

.detail-ad-visual {
  width: 94px;
  height: 94px;
  flex: 0 0 94px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: linear-gradient(145deg, var(--detail-green), var(--detail-green-dark));
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(17, 124, 104, 0.18);
}

.detail-ad-visual span {
  font: 900 2.2rem/1 "Segoe UI", sans-serif;
}

.desktop-site-footer {
  margin-top: 34px;
  padding: 22px 24px;
  border-top: 1px solid #dfe7e4;
  background: rgba(255, 255, 255, 0.8);
  text-align: center;
}

.desktop-site-footer nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 0;
}

.desktop-site-footer nav > * {
  padding: 0 18px;
  color: #526663;
  font-size: 0.82rem;
  text-decoration: none;
  border-left: 1px solid #d9e2df;
}

.desktop-site-footer nav > *:last-child {
  border-left: 0;
}

.desktop-site-footer a:hover {
  color: var(--detail-green);
}

.desktop-site-footer .is-pending {
  opacity: 0.68;
  cursor: default;
}

.desktop-site-footer p {
  margin: 14px 0 0;
  color: #8a9895;
  font-size: 0.75rem;
}

.product-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 4px 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

.product-breadcrumb a {
  color: var(--detail-green);
  text-decoration: none;
  font-weight: 700;
}

.product-primary,
.product-section,
.product-empty--page {
  background: var(--detail-card);
  border: 1px solid var(--detail-line);
  border-radius: 20px;
  box-shadow: var(--detail-shadow);
}

.product-primary {
  display: grid;
  grid-template-columns: minmax(240px, 0.85fr) minmax(0, 1.45fr);
  gap: 28px;
  padding: 28px;
  min-height: 370px;
}

.product-visual {
  min-height: 300px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(145deg, #f8fbfa, #eef5f2);
  overflow: hidden;
}

.product-visual img {
  width: 100%;
  height: 100%;
  max-height: 330px;
  object-fit: contain;
  padding: 18px;
}

.product-image-placeholder {
  display: grid;
  justify-items: center;
  gap: 10px;
  color: #7f9691;
}

.product-image-placeholder span {
  font-size: 4rem;
  line-height: 1;
}

.product-summary {
  min-width: 0;
  align-self: center;
}

.product-kicker,
.section-heading p {
  margin: 0 0 4px;
  color: var(--detail-green);
  font-size: 0.78rem;
  font-weight: 800;
}

.product-summary h1 {
  margin: 0;
  font-size: clamp(1.65rem, 3vw, 2.65rem);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.product-identifiers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 13px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.product-identifiers code {
  background: #edf4f2;
  color: #214b47;
  padding: 2px 7px;
  border-radius: 6px;
}

.product-price-block {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 22px 0 14px;
}

.product-price-block > strong {
  font-size: 1.5rem;
  color: var(--detail-green-dark);
}

.stock-pill {
  display: inline-flex;
  width: max-content;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  background: #edf1f0;
  color: #687b78;
}

.stock-pill--available {
  background: #e2f4ec;
  color: #137255;
}

.stock-pill--unknown {
  background: #f6ecec;
  color: #96505a;
}

.product-description {
  margin: 0;
  color: #3e5d59;
  line-height: 2.05;
}

.product-muted {
  color: var(--muted);
}

.product-summary-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 22px;
}

.product-summary-stats span {
  padding: 10px;
  border-radius: 11px;
  background: var(--detail-soft);
  color: var(--muted);
  font-size: 0.78rem;
}

.product-summary-stats b {
  display: block;
  color: var(--ink);
  font-size: 0.92rem;
}

.product-section {
  margin-top: 20px;
  padding: 24px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.25rem;
}

.section-heading > span {
  min-width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #edf5f2;
  color: var(--detail-green);
  font-weight: 900;
}

.seller-list {
  display: grid;
  gap: 10px;
}

.seller-row {
  display: grid;
  grid-template-columns: 52px minmax(190px, 1.5fr) minmax(130px, 0.7fr) minmax(145px, 0.7fr) auto;
  grid-template-areas: "logo info status price action";
  gap: 14px;
  align-items: center;
  padding: 15px;
  border: 1px solid var(--detail-line);
  border-radius: 14px;
}

.seller-logo {
  grid-area: logo;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #edf5f2;
  color: var(--detail-green);
  font-weight: 900;
}

.seller-info {
  grid-area: info;
  display: grid;
  gap: 3px;
  min-width: 0;
}

.seller-info span {
  color: #3f5c58;
  overflow-wrap: anywhere;
}

.seller-info small,
.seller-status small {
  color: var(--muted);
}

.seller-status {
  grid-area: status;
  display: grid;
  justify-items: start;
  gap: 5px;
  min-width: 0;
}

.seller-price {
  grid-area: price;
  display: grid;
  justify-items: start;
  gap: 5px;
  min-width: 0;
}

.seller-price strong {
  color: var(--detail-green-dark);
  overflow-wrap: anywhere;
}

.seller-field-label {
  color: #8a9895;
  font-size: 0.68rem;
  font-weight: 700;
}

.seller-action {
  grid-area: action;
}

.product-action {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 40px;
  padding: 8px 15px;
  border-radius: 10px;
  background: var(--detail-green);
  color: #ffffff;
  text-decoration: none;
  font-weight: 800;
  white-space: nowrap;
}

.product-action:hover {
  background: var(--detail-green-dark);
}

.product-action--secondary {
  background: #edf5f2;
  color: var(--detail-green-dark);
}

.product-action--disabled {
  background: #edf0ef;
  color: #84918f;
  cursor: not-allowed;
}

.seller-toggle {
  width: 100%;
  min-height: 44px;
  margin-top: 14px;
  border: 1px solid var(--detail-pink);
  border-radius: 999px;
  background: #ffffff;
  color: var(--detail-pink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.read-only-note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.article-list {
  display: grid;
  gap: 8px;
  max-height: 370px;
  overflow: auto;
  padding-left: 4px;
  scrollbar-width: thin;
}

.article-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px;
  border-radius: 11px;
  text-decoration: none;
  background: var(--detail-soft);
}

.article-item:hover {
  background: #eaf4f0;
}

.article-item img,
.article-thumb {
  width: 64px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  background: #e3efeb;
  display: grid;
  place-items: center;
  color: var(--detail-green);
}

.article-item strong {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.85rem;
  line-height: 1.65;
}

.article-item small {
  color: var(--muted);
}

.datasheet-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid #c8d9d4;
  border-radius: 9px;
  color: var(--detail-green-dark);
  background: #f7faf8;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 800;
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--detail-line);
  border-radius: 14px;
}

.spec-grid > div {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(130px, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--detail-line);
  background: #ffffff;
}

.spec-grid > div:nth-child(odd) {
  border-left: 1px solid var(--detail-line);
}

.spec-grid dt {
  color: #687773;
  font-size: 0.78rem;
  font-weight: 700;
}

.spec-grid dd {
  margin: 0;
  font-weight: 800;
  overflow-wrap: anywhere;
  text-align: left;
}

.similar-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.similar-card {
  display: grid;
  grid-template-rows: 150px auto auto auto;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--detail-line);
  border-radius: 14px;
  text-decoration: none;
  min-width: 0;
  background: #ffffff;
}

.similar-card:hover {
  border-color: #a8c9bf;
  box-shadow: 0 8px 22px rgba(17, 124, 104, 0.08);
}

.similar-image {
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--detail-soft);
  overflow: hidden;
  color: #89a09a;
  font-size: 2rem;
}

.similar-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.similar-card strong {
  overflow-wrap: anywhere;
}

.similar-card code,
.similar-card small {
  color: var(--muted);
}

.product-empty {
  text-align: center;
  color: var(--muted);
}

.product-empty--inline {
  padding: 28px;
  border: 1px dashed #bdcec9;
  border-radius: 14px;
  background: var(--detail-soft);
}

.product-empty--page {
  padding: 64px 20px;
}

.product-empty--page h1 {
  color: var(--ink);
}

.product-empty__icon {
  width: 54px;
  height: 54px;
  margin: auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f9e9eb;
  color: var(--detail-red);
  font-size: 1.5rem;
  font-weight: 900;
}

.detail-back-to-top {
  position: fixed;
  z-index: 990;
  right: 18px;
  bottom: 22px;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--detail-pink);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(232, 63, 115, 0.28);
  font: 900 1.2rem/1 IRANSans, Tahoma, sans-serif;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.detail-back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .product-detail-responsive-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
    direction: rtl;
  }

  .detail-area--hero { order: 1; }
  .detail-area--sellers { order: 2; }
  .detail-area--ad { order: 3; }
  .detail-area--articles { order: 4; }
  .detail-area--specs { order: 5; }
  .detail-area--similar { order: 6; }

  .detail-ad-slot {
    min-height: 96px;
    padding: 16px 18px;
    border-radius: 14px;
  }

  .detail-ad-copy strong {
    font-size: 1rem;
  }

  .detail-ad-copy small {
    font-size: 0.7rem;
  }

  .detail-ad-visual {
    width: 60px;
    height: 60px;
    flex-basis: 60px;
    border-radius: 16px;
  }

  .detail-ad-visual span {
    font-size: 1.45rem;
  }

  .desktop-site-footer {
    display: none;
  }

  .catalog-main-header {
    display: none !important;
  }

  .page.product-detail-shell {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 12px 10px calc(82px + env(safe-area-inset-bottom));
  }

  .product-breadcrumb {
    margin: 6px 4px 10px;
    font-size: 0.72rem;
  }

  .product-primary {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px;
    border-radius: 14px;
  }

  .product-visual {
    min-height: 260px;
  }

  .product-visual img {
    max-height: 300px;
    padding: 12px;
  }

  .product-summary h1 {
    font-size: 1.35rem;
  }

  .product-summary-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .product-section {
    margin-top: 14px;
    padding: 16px;
    border-radius: 14px;
  }

  .seller-row {
    grid-template-columns: 44px minmax(0, 1fr);
    grid-template-areas:
      "logo info"
      "status status"
      "price price"
      "action action";
    gap: 10px 12px;
    align-items: start;
  }

  .seller-logo {
    width: 42px;
    height: 42px;
  }

  .seller-status,
  .seller-price {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 10px;
    border-radius: 9px;
    background: #f8faf9;
  }

  .seller-status .stock-pill,
  .seller-price strong {
    margin-right: auto;
  }

  .seller-action .product-action {
    width: 100%;
  }

  .article-list {
    max-height: 340px;
  }

  .spec-grid {
    grid-template-columns: 1fr;
  }

  .spec-grid > div {
    grid-template-columns: minmax(120px, 0.8fr) minmax(0, 1.2fr);
    border-left: 0 !important;
  }

  .similar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .similar-card {
    grid-template-rows: 135px auto auto auto;
    padding: 9px;
  }

  .detail-back-to-top {
    right: 14px;
    bottom: calc(72px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 520px) {
  .page.product-detail-shell {
    padding-inline: 7px;
  }

  .product-summary-stats {
    grid-template-columns: 1fr;
  }

  .product-price-block > strong {
    font-size: 1.15rem;
  }

  .section-heading {
    align-items: flex-start;
  }

  .spec-grid > div {
    grid-template-columns: minmax(105px, 0.85fr) minmax(0, 1.15fr);
    gap: 8px;
    padding: 11px 10px;
  }

  .spec-grid dt,
  .spec-grid dd {
    font-size: 0.74rem;
  }

  .similar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .similar-card {
    grid-template-rows: 118px auto auto auto;
  }

  .similar-card strong,
  .similar-card code,
  .similar-card small {
    font-size: 0.7rem;
  }
}

@media (min-width: 1200px) {
  .similar-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
