/* ===== Product Page v2 ===== */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 24px;
  color: var(--text-light);
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all var(--transition);
}

.back-link svg {
  width: 18px;
  height: 18px;
}

.back-link:hover {
  color: var(--primary);
  transform: translateX(-4px);
}

.product-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

/* Gallery: thumbs left + main image right */
.product-image-area {
  position: sticky;
  top: 90px;
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  max-height: calc(100vh - 120px);
}

/* Thumbnail strip — vertical, left side */
.gallery-thumbs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 100%;
  padding-right: 4px;
  scrollbar-width: thin;
  order: -1;
}

.gallery-thumbs::-webkit-scrollbar {
  width: 4px;
}

.gallery-thumbs::-webkit-scrollbar-thumb {
  background: var(--border-dark);
  border-radius: 2px;
}

.gallery-thumb {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  background: var(--bg-alt);
  transition: border-color 0.2s, opacity 0.2s;
  opacity: 0.55;
}

.gallery-thumb:hover {
  opacity: 0.85;
}

.gallery-thumb.active {
  border-color: var(--primary);
  opacity: 1;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Main image */
.product-main-image {
  aspect-ratio: 4 / 3;
  background: var(--bg-alt);
  border: var(--border-w) solid var(--border-dark);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-clay);
  cursor: pointer;
  user-select: none;
}

.product-main-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s ease;
}

/* Gallery navigation arrows */
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.gallery-nav svg {
  width: 20px;
  height: 20px;
  color: var(--text);
}

.product-main-image:hover .gallery-nav {
  opacity: 1;
}

.gallery-nav:hover {
  background: #fff;
}

.gallery-prev { left: 12px; }
.gallery-next { right: 12px; }

/* Image counter badge */
.gallery-counter {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  z-index: 2;
  pointer-events: none;
}

.product-title {
  font-family: 'Nunito', sans-serif;
  font-size: 1.8rem;
  margin-bottom: 4px;
}

.product-subtitle {
  color: var(--text-light);
  font-size: 0.95rem;
  margin-bottom: 16px;
}

.product-description {
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 24px;
}

/* Specs */
.product-specs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.spec-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-alt);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.spec-icon {
  width: 32px;
  height: 32px;
  background: var(--bg-card);
  border: 2px solid var(--border-dark);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 2px 0 var(--border-dark);
  flex-shrink: 0;
}

.spec-icon svg {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

.spec-label {
  color: var(--text-light);
  font-size: 0.8rem;
}

.spec-value {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
}

/* Price Calculator */
.price-calculator {
  background: var(--bg-alt);
  border: var(--border-w) solid var(--border-dark);
  border-radius: var(--radius-lg);
  padding: 14px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-clay);
}

.price-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Nunito', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
}

/* Order Form */
.order-form {
  padding: 24px;
  margin-bottom: 20px;
}

.order-form h3 {
  font-family: 'Nunito', sans-serif;
  margin-bottom: 20px;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-form h3 svg {
  width: 20px;
  height: 20px;
  color: var(--primary);
}

.order-total {
  background: var(--bg-alt);
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  text-align: center;
  font-family: 'Nunito', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
}

/* MakerWorld link */
.makerworld-link {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--bg-alt);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.makerworld-link svg {
  width: 18px;
  height: 18px;
  color: var(--primary);
  flex-shrink: 0;
}

.makerworld-link a {
  font-weight: 600;
}

/* Reviews */
.reviews-section {
  margin-top: 48px;
  padding-top: 32px;
  border-top: var(--border-w) solid var(--border-dark);
}

.reviews-summary {
  margin-bottom: 20px;
}

.avg-rating {
  font-family: 'Nunito', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--warning);
}

.reviews-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}

.review-item {
  padding: 16px 20px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
}

.review-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.review-stars {
  color: var(--warning);
  font-size: 1rem;
}

.review-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.review-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
}

.review-form {
  padding: 24px;
  margin-bottom: 20px;
}

.review-form h3 {
  font-family: 'Nunito', sans-serif;
  margin-bottom: 20px;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-form h3 svg {
  width: 20px;
  height: 20px;
  color: var(--primary);
}

.star-rating {
  display: flex;
  gap: 4px;
  font-size: 1.8rem;
  cursor: pointer;
}

.star-rating .star {
  color: var(--border);
  transition: color 0.15s, transform 0.15s var(--bounce);
  user-select: none;
}

.star-rating .star.active,
.star-rating .star:hover {
  color: var(--warning);
  transform: scale(1.1);
}

/* Color options */
.color-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.9rem;
}

.color-option.selected {
  border-color: var(--border-dark);
  background: var(--bg-alt);
  box-shadow: 2px 2px 0 var(--border-dark);
}

.color-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-dark);
}

@media (max-width: 768px) {
  .product-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .product-image-area {
    position: static;
    grid-template-columns: 1fr;
    max-height: none;
  }

  .gallery-thumbs {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: none;
    padding-right: 0;
    padding-bottom: 4px;
    order: 1;
  }

  .gallery-thumb {
    width: 52px;
    height: 52px;
  }

  .product-main-image {
    aspect-ratio: 4 / 3;
  }

  .gallery-nav {
    opacity: 1;
    width: 36px;
    height: 36px;
  }

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

  .product-title {
    font-size: 1.4rem;
  }
}
