/* ==========================================================
   WooCommerce — Single Product Page
   ========================================================== */

/* ── Page wrapper ─────────────────────────────────────── */
.single-product-page {
  padding-top: var(--space-8);
  padding-bottom: var(--space-16);
}

/* ── Product layout: gallery + summary ───────────────── */
.woocommerce div.product {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-12);
  align-items: start;
  margin-bottom: var(--space-12);
}

/* ── Product Gallery ──────────────────────────────────── */
.woocommerce-product-gallery {
  position: static;
}

.woocommerce-product-gallery__wrapper {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  background-color: var(--color-bg-light);
  border: 1px solid var(--color-border);
  aspect-ratio: 1;
}

.woocommerce-product-gallery__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.woocommerce-product-gallery__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Thumbnails */
.flex-control-nav {
  display: flex;
  gap: var(--space-2);
  list-style: none;
  padding: 0;
  margin: var(--space-3) 0 0;
  overflow-x: auto;
}

.flex-control-nav li { flex-shrink: 0; }

.flex-control-nav li img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity var(--transition-fast), border-color var(--transition-fast);
}

.flex-control-nav li img:hover,
.flex-control-nav li.flex-active img {
  opacity: 1;
  border-color: var(--color-dark);
}

/* ── Product Summary ──────────────────────────────────── */
.woocommerce div.product .summary {
  display: flex;
  flex-direction: column;
}

/* Breadcrumb above title */
.single-product-page .wc-breadcrumb {
  margin-bottom: var(--space-4);
}

/* Product title */
.woocommerce div.product .product_title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: var(--font-bold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  color: var(--color-text);
  margin-bottom: var(--space-3);
}

/* Rating — overlay technique: gray ★★★★★ behind, gold clipped span on top */
.woocommerce .star-rating {
  overflow: hidden;
  position: relative;
  height: 1.1em;
  line-height: 1;
  font-size: var(--text-sm);
  width: 5.6em;
  margin-bottom: var(--space-4);
  flex-shrink: 0;
}

.woocommerce .star-rating::before {
  content: "★★★★★";
  color: var(--color-border);
  position: absolute;
  top: 0;
  left: 0;
  letter-spacing: 0.12em;
}

/* WC sets span width inline (e.g. 60% for 3 stars) — gold stars clip to that width */
.woocommerce .star-rating span {
  display: block;
  overflow: hidden;
  position: absolute;
  top: 0;
  left: 0;
  padding-top: 1.5em;
}

.woocommerce .star-rating span::before {
  content: "★★★★★";
  color: #F59E0B;
  position: absolute;
  top: 0;
  left: 0;
  letter-spacing: 0.12em;
}

.woocommerce-product-rating {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.woocommerce-review-link {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-decoration: none;
}
.woocommerce-review-link:hover { color: var(--color-text); }

/* Price */
.woocommerce div.product .price {
  font-size: var(--text-3xl);
  font-weight: var(--font-extrabold);
  color: var(--color-text);
  margin-bottom: var(--space-5);
  display: block;
}

.woocommerce div.product .price del {
  font-size: var(--text-lg);
  font-weight: var(--font-normal);
  color: var(--color-text-light);
  margin-right: var(--space-2);
}

.woocommerce div.product .price ins {
  text-decoration: none;
  color: var(--color-primary);
}

/* Short description */
.woocommerce div.product .woocommerce-product-details__short-description {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.woocommerce div.product .woocommerce-product-details__short-description p {
  margin: 0;
}

/* ── Add to cart form ─────────────────────────────────── */
.woocommerce form.cart {
  margin-bottom: var(--space-6);
}

.woocommerce form.cart .quantity {
  display: flex;
  align-items: center;
  margin-bottom: var(--space-4);
}

.woocommerce form.cart .quantity .qty {
  width: 80px;
  padding: 0.625rem 0.75rem;
  text-align: center;
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  outline: none;
  font-family: var(--font-sans);
  transition: border-color var(--transition-fast);
}
.woocommerce form.cart .quantity .qty:focus { border-color: var(--color-dark); }

/* Variable product select */
.woocommerce div.product form.cart .variations {
  width: 100%;
  margin-bottom: var(--space-4);
}

.woocommerce div.product form.cart .variations td,
.woocommerce div.product form.cart .variations th {
  padding: var(--space-2) 0;
}

.woocommerce div.product form.cart .variations label {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-text-muted);
  display: block;
  margin-bottom: var(--space-2);
}

.woocommerce div.product form.cart .variations select {
  width: 100%;
  padding: 0.625rem 2rem 0.625rem 0.875rem;
  font-size: var(--text-sm);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: border-color var(--transition-fast);
}
.woocommerce div.product form.cart .variations select:focus { border-color: var(--color-dark); }

.woocommerce div.product .reset_variations {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-decoration: none;
  display: inline-block;
  margin-top: var(--space-2);
}

/* Single add to cart button */
.woocommerce div.product form.cart .single_add_to_cart_button,
.single_add_to_cart_button.button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.75rem 1.75rem;
  background-color: var(--color-primary);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--transition-fast);
  font-family: var(--font-sans);
  text-decoration: none;
  width: 100%;
  justify-content: center;
}
.woocommerce div.product form.cart .single_add_to_cart_button:hover {
  background-color: var(--color-primary-dark);
}

/* Product meta (SKU, category) */
.woocommerce div.product .product_meta {
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.woocommerce div.product .product_meta span {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.woocommerce div.product .product_meta a {
  color: inherit;
  text-decoration: none;
  font-weight: var(--font-medium);
  color: var(--color-text);
}

/* Product trust badges below ATC */
.pp-product-trust {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background-color: var(--color-bg-light);
  border-radius: var(--radius-lg);
  margin-top: var(--space-4);
  flex-wrap: wrap;
}

.pp-product-trust__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: var(--font-medium);
}
.pp-product-trust__item svg { width: 14px; height: 14px; color: var(--color-primary); }

/* ── Product Tabs ─────────────────────────────────────── */
.woocommerce-tabs {
  grid-column: 1 / -1;
}

.woocommerce-tabs .tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--color-border);
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-8);
  overflow-x: auto;
}

.woocommerce-tabs .tabs li {
  flex-shrink: 0;
}

.woocommerce-tabs .tabs li a {
  display: inline-block;
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  white-space: nowrap;
}

.woocommerce-tabs .tabs li.active a,
.woocommerce-tabs .tabs li a:hover {
  color: var(--color-text);
  border-bottom-color: var(--color-dark);
}

.woocommerce-tabs .tabs li.active a {
  border-bottom-color: var(--color-primary);
  color: var(--color-primary);
}

.woocommerce-Tabs-panel {
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--color-text-muted);
  max-width: 720px;
}

.woocommerce-Tabs-panel h2 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-4);
}

.woocommerce-Tabs-panel p { margin-bottom: var(--space-4); }
.woocommerce-Tabs-panel p:last-child { margin-bottom: 0; }

/* Additional info tab table */
.shop_attributes {
  width: 100%;
  border-collapse: collapse;
}
.shop_attributes th,
.shop_attributes td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-border);
}
.shop_attributes th {
  font-weight: var(--font-semibold);
  color: var(--color-text);
  width: 35%;
  background-color: var(--color-bg-light);
}
.shop_attributes td { color: var(--color-text-muted); }

/* ── Related products ─────────────────────────────────── */
.related.products,
.upsells.products {
  grid-column: 1 / -1;
  margin-top: var(--space-12);
  padding-top: var(--space-12);
  border-top: 1px solid var(--color-border);
}

.related.products h2,
.upsells.products h2 {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-6);
}

.related.products .products-grid,
.upsells.products .products-grid {
  grid-template-columns: repeat(4, 1fr);
}

/* ── Reviews ──────────────────────────────────────────── */
#reviews {
  padding-top: var(--space-2);
}

#reviews #comments h2 {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--color-text);
  margin-bottom: var(--space-6);
}

.woocommerce-noreviews,
#review_form_wrapper > p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
}

/* Star rating input */
.comment-form-rating {
  margin-bottom: var(--space-5);
}

.comment-form-rating label {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  letter-spacing: var(--tracking-wide);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.comment-form-rating .stars {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  overflow: initial;
}

.comment-form-rating .stars span {
  display: inline-flex;
  gap: 4px;
}

.comment-form-rating .stars a {
  display: inline-block;
  width: 1.4rem;
  height: 1.4rem;
  overflow: hidden;
  text-indent: 9999px;
  white-space: nowrap;
  position: relative;
  text-decoration: none;
}

.comment-form-rating .stars a::before {
  content: "★";
  display: block;
  position: absolute;
  inset: 0;
  text-indent: 0;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--color-border);
  transition: color var(--transition-fast);
}

/* Hover: colour this star and all before it */
.comment-form-rating .stars a:hover::before,
.comment-form-rating .stars a:hover ~ a::before { color: var(--color-border); }
.comment-form-rating .stars:hover a::before { color: #F59E0B; }
.comment-form-rating .stars a:hover ~ a::before { color: var(--color-border); }

/* Selected state (WC JS adds .selected on wrapper, .active on chosen star)
   Logic: all non-active → gold; stars after active → gray (higher specificity wins) */
.comment-form-rating .stars.selected a.active::before { color: #F59E0B; }
.comment-form-rating .stars.selected a:not(.active)::before { color: #F59E0B; }
.comment-form-rating .stars.selected a.active ~ a::before { color: var(--color-border); }

/* Review comment textarea */
.comment-form-comment label {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  letter-spacing: var(--tracking-wide);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.comment-form-comment textarea {
  width: 100%;
  min-height: 140px;
  padding: 0.75rem 0.875rem;
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  color: var(--color-text);
  background-color: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  outline: none;
  resize: vertical;
  transition: border-color var(--transition-fast);
}

.comment-form-comment textarea:focus {
  border-color: var(--color-dark);
  box-shadow: 0 0 0 3px rgba(15,23,42,.06);
}

/* Reviewer name / email fields */
.comment-form-author,
.comment-form-email {
  margin-bottom: var(--space-4);
}

.comment-form-author label,
.comment-form-email label {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  letter-spacing: var(--tracking-wide);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.comment-form-author input,
.comment-form-email input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast);
}

.comment-form-author input:focus,
.comment-form-email input:focus {
  border-color: var(--color-dark);
}

/* Submit button */
#review_form .form-submit {
  margin-top: var(--space-5);
}

#review_form .form-submit input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.75rem;
  background-color: var(--color-dark);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  font-family: var(--font-sans);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

#review_form .form-submit input[type="submit"]:hover {
  background-color: var(--color-dark-alt);
}

/* Existing reviews list */
#comments .commentlist {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-8);
}

#comments .commentlist .comment {
  padding: var(--space-6) 0;
  border-bottom: 1px solid var(--color-border);
}

#comments .commentlist .comment:last-child {
  border-bottom: none;
}

#comments .commentlist .comment_container {
  display: flex;
  gap: var(--space-4);
}

#comments .commentlist .comment_container .avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

#comments .commentlist .comment-text {
  flex: 1;
  min-width: 0;
}

#comments .commentlist .star-rating {
  margin-bottom: var(--space-2);
}

#comments .commentlist .meta {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

#comments .commentlist .meta .woocommerce-review__author {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-text);
}

#comments .commentlist .meta .woocommerce-review__dash { color: var(--color-text-light); }

#comments .commentlist .meta .woocommerce-review__published-date {
  font-size: var(--text-xs);
  color: var(--color-text-light);
}

#comments .commentlist .description p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: var(--leading-relaxed);
  margin: 0;
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 1024px) {
  .woocommerce div.product {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }

  .woocommerce-product-gallery {
    position: static;
    max-width: 480px;
  }

  .related.products .products-grid,
  .upsells.products .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .related.products .products-grid,
  .upsells.products .products-grid {
    grid-template-columns: 1fr;
  }
}
