/* =========================================================
   SINGLE PRODUCT DISCOGS
   CLEANED + PATCHED VERSION
   - fixes purchase box layout
   - fixes duplicated cart icon
   - fixes main image proportions
========================================================= */

.discogs-product-container {
  display: grid;
  grid-template-areas:
    "block1 block2 sidebar"
    "block1 block3 sidebar"
    "tabs tabs sidebar"
    "suggestions suggestions suggestions"
    "artist artist artist";
  grid-template-columns: 360px 1fr 260px;
  gap: 22px;
  max-width: 1320px;
  margin: 30px auto;
  padding: 0 18px;
  box-sizing: border-box;
  color: #222;
}

.discogs-product-container a {
  color: inherit;
  text-decoration: none;
}

.block1,
.block2,
.block3,
.sidebar,
.product-tabs,
.suggestions,
.artist-products,
.mobile-variants {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 18px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
  min-width: 0;
}

.block1 { grid-area: block1; }
.block2 { grid-area: block2; }
.block3 { grid-area: block3; }
.sidebar { grid-area: sidebar; }
.product-tabs { grid-area: tabs; }
.suggestions { grid-area: suggestions; }
.artist-products { grid-area: artist; }
.mobile-variants {
  grid-area: mobilevariants;
  display: none;
}

/* ===== MAIN IMAGE FIX ===== */

.main-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  overflow: hidden;
  background: #f5f5f5;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.main-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  background: #f5f5f5;
}

.no-image {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
}

.gallery-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  line-height: 36px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  font-size: 18px;
  color: #333;
  user-select: none;
  z-index: 2;
}

.gallery-arrow.left { left: 10px; }
.gallery-arrow.right { right: 10px; }

.thumbs-row {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.thumbs-row .thumb {
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #e6e6e6;
  cursor: pointer;
  background: #fff;
}

.thumbs-row .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumbs-row .thumb.active {
  border: 2px solid #1e3a5f;
}

.cover-credit {
  margin-top: 10px;
  font-size: 12px;
  color: #777;
}

.block2 h1 {
  font-size: 20px;
  line-height: 1.2;
  font-weight: 700;
  color: #1e3a5f;
  margin: 0 0 8px;
  word-break: break-word;
}

.block2 .meta {
  font-size: 13px;
  color: #666;
  margin-top: 0;
  line-height: 1.5;
}

.desktop-variants {
  margin-top: 16px;
}

.variants {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.variant-card {
  position: relative;
  width: 100px;
  border: none;
  border-radius: 8px;
  padding: 6px;
  background: #fff;
  text-align: center;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.variant-card.active-variant {
  border: 2px solid #1e3a5f;
  box-shadow: 0 4px 10px rgba(30, 58, 95, 0.08);
  transform: scale(1.02);
}

.variant-thumb-wrap {
  position: relative;
  width: 78px;
  height: 78px;
  margin: 0 auto;
  overflow: visible;
  border-radius: 6px;
  padding: 2px;
  background: #fff;
}

.variant-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 4px;
}

.variant-badge {
  position: absolute;
  top: 2px;
  left: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
}

.variant-badge img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

.variant-badge span {
  background: #1e3a5f;
  color: #fff;
  font-weight: 700;
  font-size: 10px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 3px;
  margin-top: 2px;
}

.block3 {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.block3-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.block3 h2 {
  font-size: 18px;
  line-height: 1.2;
  margin: 0;
  color: #1e3a5f;
  font-weight: 700;
  word-break: break-word;
}

.tags-wrap,
.block3 .tags,
.tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-pill,
.block3 .tag {
  background: #e9f1ec;
  color: #1e3a5f;
  padding: 6px 10px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 12px;
  line-height: 1.25;
}

.product-ids,
.block3 .ids {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12px;
  color: #555;
  margin-top: 6px;
  line-height: 1.5;
}

.product-ids > *,
.block3 .ids > * {
  display: inline-flex;
  align-items: center;
}

.discogs-link {
  color: #153e7e !important;
  text-decoration: none;
  font-weight: 600;
  word-break: break-all;
}

/* ===== PURCHASE BOX FIX ===== */

.purchase-box-inline {
  margin-top: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 6px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: none;
}

.purchase-box-inline .price-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.price-condition {
  min-width: 0;
  font-size: 15px;
  line-height: 1.3;
  color: #666;
}

.purchase-box-inline .price {
  min-width: 0;
  text-align: right;
  font-size: clamp(20px, 3vw, 28px);
  line-height: 1.05;
  font-weight: 700;
  color: #1e3a5f;
}

.purchase-box-inline .price .woocommerce-Price-amount {
  white-space: nowrap;
}

.product-stock-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 12px;
  align-items: start;
  margin: 0;
}

.availability-line {
  min-width: 0;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
}

.restock-eta-box {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f4f6f8;
  border: 1px solid #d9e0e6;
  color: #334155;
  font-size: 13px;
  line-height: 1.3;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.actions-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

.purchase-box-inline form.cart {
  margin: 0;
}

.purchase-box-inline .add-to-cart,
.purchase-box-inline button.add-to-cart {
  background: #1e3a5f;
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 700;
  transition: background 0.2s ease;
  text-align: center;
}

.purchase-box-inline .add-to-cart.icon-only,
.purchase-box-inline form.cart .add-to-cart.icon-only {
  width: 52px;
  min-width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
}

.purchase-box-inline .add-to-cart::before,
.purchase-box-inline button.add-to-cart::before {
  content: none !important;
  display: none !important;
}

.purchase-box-inline .add-to-cart .cart-icon {
  display: inline-block;
  font-size: 22px;
  line-height: 1;
}

.purchase-box-inline button.add-to-cart:disabled {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #999;
  cursor: not-allowed;
  font-size: 13px;
}

.purchase-box-inline .add-to-cart:hover,
.purchase-box-inline button.add-to-cart:hover {
  background: #274d7d;
}

.wishlist-button {
  margin: 0;
  text-align: left;
}

.wishlist-button .yith-wcwl-add-to-wishlist,
.wishlist-button .yith-wcwl-add-to-wishlist div {
  margin: 0;
  text-align: left;
}

.wishlist-button a.add_to_wishlist,
.wishlist-button .add_to_wishlist {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #ccc;
  border-radius: 999px;
  width: 52px;
  height: 52px;
  line-height: 1;
  text-align: center;
  color: #111;
  font-size: 17px;
  background: #fff;
  transition: all 0.2s ease;
}

.wishlist-button a.add_to_wishlist:hover,
.wishlist-button .add_to_wishlist:hover {
  background: #1e3a5f;
  color: #fff;
  border-color: #1e3a5f;
}

.wishlist-button a.added,
.wishlist-button .add_to_wishlist.added {
  background: #1e3a5f;
  color: #fff;
}

.wishlist-error {
  color: #c62828;
  margin: 0;
}

.sidebar {
  background: #fdfdfd;
  border: 1px solid #e6e6e6;
  padding: 16px;
}

.artist-sidebar {
  border: 1px solid #ddd;
  padding: 15px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  text-align: left;
}

.artist-sidebar-image,
.artist-sidebar img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 10px;
}

.artist-sidebar-title,
.artist-sidebar h3 {
  font-weight: 700;
  margin-bottom: 8px;
  color: #1e3a5f;
  font-size: 16px;
}

.artist-sidebar-text,
.artist-sidebar p {
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  word-break: break-word;
  white-space: normal;
  margin-bottom: 10px;
}

.artist-sidebar-link,
.artist-sidebar a {
  display: inline-block;
  font-weight: 600;
  color: #006400;
  text-decoration: none;
}

.product-tabs {
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
}

.tab-titles {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  background: #fafafa;
  border-bottom: 1px solid #eee;
}

.tab-titles li {
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
  color: #444;
  border-right: 1px solid #eee;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tab-label {
  display: block;
}

.tab-helper {
  display: none;
  font-size: 11px;
  font-weight: 500;
  color: #7a7a7a;
}

.tab-titles li.active {
  background: #fff;
  color: #1e3a5f;
  border-bottom: 3px solid #1e3a5f;
}

.tab-content {
  padding: 14px;
  color: #333;
  font-size: 14px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.details-table {
  width: 100%;
  border-collapse: collapse;
}

.details-table th,
.details-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #eee;
  text-align: left;
  vertical-align: top;
}

.details-table th {
  width: 180px;
  color: #1e3a5f;
  font-weight: 700;
}

.details-table td a {
  color: #153e7e;
  text-decoration: none;
}

.rating-stars {
  display: inline-flex;
  align-items: center;
}

.star {
  font-size: 16px;
  color: #bbb;
  margin-right: 1px;
}

.star.full,
.star.half {
  color: #f5b301;
}

.rating-number {
  margin-left: 8px;
  font-size: 13px;
  color: #555;
}

#tab-tracklist pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: inherit;
  font-size: 14px;
  margin: 0;
}

.tracklist {
  display: flex;
  flex-direction: column;
}

.track-row {
  display: flex;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid #eee;
}

.track-code {
  min-width: 36px;
  color: #1e3a5f;
  font-weight: 700;
}

.track-name,
.track-title {
  flex: 1;
  font-size: 14px;
  color: #333;
}

.track-title strong,
.track-title span:first-child {
  color: #1e3a5f;
  font-weight: 600;
}

.stock-state--in-stock .availability-line {
  color: #2e7d32;
}

.stock-state--low-stock .availability-line,
.stock-state--last-unit .availability-line {
  color: #b26a00;
}

.stock-state--incoming .availability-line,
.stock-state--supplier .availability-line,
.stock-state--pre-release .availability-line {
  color: #1e3a5f;
}

.stock-state--unavailable .availability-line {
  color: #c62828;
}

.suggestions,
.artist-products {
  text-align: left;
  padding-top: 18px;
  padding-bottom: 18px;
  min-height: 360px;
}

.suggestions-products-title,
.artist-products-title {
  font-size: 1.4em;
  font-weight: 700;
  color: #1e3a5f;
  margin: 0 0 18px;
  line-height: 1.2;
}

.products-slider {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 240px;
}

.products-slider-viewport {
  overflow: hidden;
  width: 100%;
  min-width: 0;
  min-height: 240px;
}

.products-slider-track {
  display: flex;
  gap: 16px;
  align-items: stretch;
  justify-content: flex-start;
  transition: transform 0.35s ease;
  will-change: transform;
  min-height: 240px;
}

.products-slider-slide {
  flex: 0 0 170px;
  width: 170px;
  min-width: 170px;
  box-sizing: border-box;
}

.products-slider-slide > * {
  width: 100%;
  max-width: 100%;
}

.products-slider-slide article.product-card,
.products-slider-slide .product,
.products-slider-slide li.product {
  width: 100%;
  max-width: 100%;
}

.products-slider-arrow,
.products-slider-arrow-spacer {
  width: 40px;
  height: 40px;
}

.products-slider-arrow {
  border: 1px solid #ddd;
  background: #fff;
  color: #1e3a5f;
  border-radius: 50%;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.products-slider-arrow:hover {
  background: #1e3a5f;
  color: #fff;
  border-color: #1e3a5f;
}

.products-slider-arrow-spacer {
  visibility: hidden;
  pointer-events: none;
}

@media (max-width: 1024px) {
  .discogs-product-container {
    grid-template-areas:
      "block2"
      "block1"
      "mobilevariants"
      "block3"
      "tabs"
      "suggestions"
      "artist";
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .sidebar {
    display: none;
  }

  .desktop-variants {
    display: none;
  }

  .mobile-variants {
    margin-top: 4px;
    display: block;
    padding: 14px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
  }

  .mobile-variants .variants {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 10px;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .mobile-variants .variant-card {
    background: #fff;
  }

  .block2 {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .block2 h1 {
    font-size: 30px;
    margin-bottom: 6px;
  }

  .block2 .meta {
    font-size: 16px;
  }

  .products-slider {
    grid-template-columns: 36px minmax(0, 1fr) 36px;
    gap: 10px;
  }

  .products-slider-track {
    gap: 12px;
  }

  .products-slider-slide {
    flex: 0 0 185px;
    width: 185px;
    min-width: 185px;
  }
}

@media (max-width: 768px) {
  .discogs-product-container {
    margin: 24px auto;
    padding: 0 14px;
    gap: 14px;
  }

  .block1,
  .block3,
  .product-tabs,
  .suggestions,
  .artist-products {
    padding: 16px;
  }

  .block2 h1 {
    font-size: 22px;
    line-height: 1.2;
  }

  .block2 .meta {
    font-size: 14px;
  }

  .gallery-arrow {
    width: 38px;
    height: 38px;
    line-height: 38px;
    font-size: 18px;
  }

  .thumbs-row .thumb {
    width: 64px;
    height: 64px;
  }

  .mobile-variants .variant-card {
    width: 84px;
    min-width: 84px;
    padding: 4px;
  }

  .mobile-variants .variant-thumb-wrap {
    width: 64px;
    height: 64px;
  }

  .block3 {
    gap: 10px;
  }

  .block3-header h2 {
    display: none;
  }

  .block3-header {
    gap: 8px;
  }

  .tags-wrap {
    gap: 6px;
  }

  .tag-pill {
    padding: 5px 8px;
    font-size: 11px;
  }

  .product-ids {
    gap: 4px 10px;
    font-size: 11px;
    margin-top: 2px;
  }

  .tab-titles {
    flex-wrap: nowrap;
  }

  .tab-titles li {
    flex: 1 1 50%;
    text-align: center;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    padding: 10px 8px;
  }

  .product-tabs.is-collapsed .tab-helper {
    display: block;
  }

  .tab-content {
    padding: 0;
    margin-top: 10px;
  }

  .tab-pane {
    border-top: 1px solid #eee;
    padding: 14px 0 0;
  }

  .details-table th,
  .details-table td {
    display: block;
    width: 100%;
  }

  .details-table th {
    padding-bottom: 2px;
    border-bottom: none;
  }

  .details-table td {
    padding-top: 0;
  }

  .suggestions-products-title,
  .artist-products-title {
    font-size: 1.4rem;
  }

  .suggestions,
  .artist-products {
    min-height: auto !important;
    height: auto;
    padding-bottom: 12px;
  }

  .products-slider {
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    gap: 8px;
    min-height: auto;
  }

  .products-slider-slide {
    flex: 0 0 160px;
    width: 160px;
    min-width: 160px;
    scroll-snap-align: start;
  }

  .products-slider-arrow {
    width: 34px;
    height: 34px;
    font-size: 18px;
  }

  .products-slider-viewport {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    min-height: 0 !important;
    height: auto;
  }

  .products-slider-viewport::-webkit-scrollbar {
    display: none;
  }

  .products-slider-track {
    transform: none !important;
    width: auto;
    min-height: 0 !important;
    height: auto;
  }
}

@media (max-width: 560px) {
  .discogs-product-container {
    padding: 0 12px;
  }

  .block1,
  .block3,
  .product-tabs,
  .suggestions,
  .artist-products {
    padding: 14px;
  }

  .thumbs-row .thumb {
    width: 56px;
    height: 56px;
  }

  .block2 h1 {
    font-size: 19px;
  }

  .block2 .meta,
  .tab-content,
  .details-table td,
  .details-table th {
    font-size: 13px;
  }

  .mobile-variants .variant-card {
    width: 76px;
    min-width: 76px;
  }

  .mobile-variants .variant-thumb-wrap {
    width: 56px;
    height: 56px;
  }

  .variant-badge span {
    font-size: 9px;
    padding: 2px 5px;
  }

  .products-slider {
    grid-template-columns: 30px minmax(0, 1fr) 30px;
  }

  .products-slider-slide {
    flex: 0 0 148px;
    width: 148px;
    min-width: 148px;
  }

  .products-slider-arrow {
    width: 30px;
    height: 30px;
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .purchase-box-inline .price-row {
    gap: 10px;
  }

  .product-stock-box {
    gap: 8px 10px;
  }

  .price-condition,
  .availability-line {
    font-size: 14px;
  }

  .purchase-box-inline .price {
    font-size: 18px;
  }

  .restock-eta-box {
    font-size: 12px;
    padding: 7px 9px;
  }

  .actions-row {
    gap: 8px;
  }

  .purchase-box-inline .add-to-cart.icon-only,
  .purchase-box-inline form.cart .add-to-cart.icon-only,
  .wishlist-button a.add_to_wishlist,
  .wishlist-button .add_to_wishlist {
    width: 46px;
    min-width: 46px;
    height: 46px;
  }

  .purchase-box-inline .add-to-cart .cart-icon {
    font-size: 20px;
  }
}

@media (max-width: 420px) {
  .discogs-product-container {
    margin: 18px auto;
    padding: 0 10px;
  }

  .block1,
  .block3,
  .product-tabs,
  .suggestions,
  .artist-products {
    padding: 12px;
    border-radius: 6px;
  }

  .gallery-arrow {
    width: 34px;
    height: 34px;
    line-height: 34px;
  }

  .thumbs-row {
    gap: 6px;
  }

  .thumbs-row .thumb {
    width: 52px;
    height: 52px;
  }

  .mobile-variants .variant-card {
    width: 70px;
    min-width: 70px;
    padding: 4px;
  }

  .mobile-variants .variant-thumb-wrap {
    width: 50px;
    height: 50px;
  }

  .product-ids {
    font-size: 11px;
  }

  .tab-titles li {
    font-size: 13px;
    min-height: 50px;
  }

  .suggestions-products-title,
  .artist-products-title {
    font-size: 1.25rem;
    margin-bottom: 14px;
  }

  .products-slider-slide {
    flex: 0 0 calc(50% - 6px);
    width: calc(50% - 6px);
    min-width: calc(50% - 6px);
  }
}