:root {
  --bg: #f7f7f7;
  --card: #ffffff;
  --muted: #6b7280;
  --brand: #d84315;
  --accent: #1976d2;
}
/* Reset / base */
body,
button,
input {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}
body {
  background: var(--bg);
  color: #111;
  margin: 0;
  padding: 0;
}

/* Centered page container */
.product-container {
  width: 100%;
  margin: 0;
  padding: 60px 80px 20px 80px;
  transform: scale(1.1);
  transform-origin: top center;
  box-sizing: border-box;
}

/* Hero card */
.product-hero {
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(15, 15, 15, 0.06);
  display: flex;
  gap: 28px;
  align-items: flex-start;
  padding: 22px;
}

/* Images column (left) */
.product-images-column {
  flex: 1 1 auto;
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

/* Thumbnails (left column) */
aside.product-thumbs {
  flex: 0 0 84px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  padding-top: 6px;
  max-height: 640px;
  overflow: auto;
}
aside.product-thumbs .thumb {
  width: 68px;
  height: 68px;
  border-radius: 8px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  padding: 2px;
  background: transparent;
}
aside.product-thumbs .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
aside.product-thumbs .thumb:hover img {
  transform: scale(1.03);
}
aside.product-thumbs .thumb.active {
  border-color: var(--accent);
  box-shadow: 0 6px 18px rgba(25, 118, 210, 0.12);
}
aside.product-thumbs .thumb.empty {
  background: #efefef;
  width: 68px;
  height: 68px;
  border-radius: 8px;
}

/* Main image (center column) */
figure.product-image {
  flex: 1 1 560px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  margin: 0;
  min-height: 520px;
  max-height: 520px;
  background-color: #e8e8e8;
  border-radius: 10px;
}
#main-product-img {
  width: 100%;
  height: 100%;
  max-width: 480px;
  max-height: 520px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid #eee;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
  transition: opacity 0.26s ease, transform 0.18s ease;
}
#main-product-img.loading {
  opacity: 0.25;
  transform: scale(0.997);
}

/* Details (right column) */
section.product-details {
  flex: 0 0 380px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.product-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0;
  color: #0f1724;
}
.product-price {
  font-size: 1.4rem;
  color: var(--brand);
  font-weight: 800;
}
.meta-label {
  font-size: 0.92rem;
  color: var(--muted);
}
.product-desc {
  font-size: 1rem;
  line-height: 1.6;
  color: #222;
  margin: 0;
}

.inventory {
  font-size: 0.95rem;
}
.inv-in {
  color: #1b5e20;
  font-weight: 700;
}
.inv-low {
  color: #8a6d00;
  font-weight: 700;
}
.inv-out {
  color: #b71c1c;
  font-weight: 800;
}

.qty-add {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
}
input#qty-input {
  width: 72px;
  padding: 6px;
  border-radius: 6px;
  border: 1px solid #ddd;
}
.add-to-cart {
  background: var(--brand);
  color: #fff;
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(216, 67, 21, 0.12);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.add-to-cart:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 14px 40px rgba(216, 67, 21, 0.18);
}
.add-to-cart[disabled] {
  opacity: 0.54;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Read more */
.desc-short {
  max-height: 8.4em;
  overflow: hidden;
}
.read-more {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
  padding: 0;
}

/* Modal */
.img-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  z-index: 6000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
}
.img-modal.open {
  opacity: 1;
  pointer-events: auto;
}
.img-modal img {
  max-width: 96%;
  max-height: 96%;
  border-radius: 10px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6);
}

/* Responsive: stack */
@media (max-width: 1000px) {
  .product-hero {
    flex-direction: column;
    align-items: center;
    padding: 16px;
  }
  aside.product-thumbs {
    flex-direction: row;
    width: 100%;
    justify-content: flex-start;
    gap: 10px;
    overflow: auto;
    padding: 6px;
  }
  section.product-details {
    width: 100%;
    padding: 12px 6px;
  }
  figure.product-image {
    order: 1;
    width: 100%;
    max-width: 720px;
  }
}

/* Prevent page stretching on very large displays */
@media (min-width: 1600px) {
  .product-container {
    max-width: 1200px;
  }
}
/* Product detail page styles */
.product-page {
  max-width: 1100px;
  margin: 28px auto;
  padding: 18px;
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.product-image {
  flex: 1;
  min-width: 300px;
}
.product-image img {
  width: 100%;
  height: auto;
  border: 1px solid #eee;
  border-radius: 8px;
}
.product-details {
  flex: 1.1;
}
.product-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.product-price {
  font-size: 1.4rem;
  color: #1976d2;
  margin-bottom: 12px;
}
.product-desc {
  margin-bottom: 16px;
}
.product-meta {
  margin-bottom: 12px;
  color: #555;
}
.qty-add {
  display: flex;
  gap: 12px;
  align-items: center;
}
.back-link {
  display: inline-block;
  margin-bottom: 18px;
}
@media (max-width: 800px) {
  .product-page {
    flex-direction: column;
  }
  .product-image {
    order: 1;
  }

  /* Container and visual polish */
  .product-container {
    max-width: 1200px;
    margin: 36px auto;
    padding: 22px;
    background: #f7f7f7;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(20, 20, 20, 0.04);
  }
  .product-hero {
    display: flex;
    align-items: flex-start;
    gap: 28px;
    padding: 18px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(20, 20, 20, 0.03);
  }

  /* Typography */
  body,
  .product-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
      "Helvetica Neue", Arial, sans-serif;
    color: #222;
  }
  .product-title {
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: 0.2px;
    margin-bottom: 8px;
  }
  .product-price {
    font-size: 1.5rem;
    color: #d84315;
    font-weight: 800;
    margin-bottom: 10px;
  }
  .meta-label {
    font-size: 0.88rem;
    color: #666;
    margin-bottom: 6px;
  }
  .product-desc {
    color: #333;
    line-height: 1.6;
    font-size: 0.98rem;
    margin-bottom: 14px;
  }

  /* Buttons */
  .add-to-cart {
    background: #d84315;
    color: #fff;
    border: none;
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(216, 67, 21, 0.12);
    transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
  }
  .add-to-cart:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 10px 30px rgba(216, 67, 21, 0.18);
  }
  .add-to-cart[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
  }

  /* Inventory badges */
  .inventory {
    font-size: 0.95rem;
    margin-bottom: 12px;
  }
  .inv-in {
    color: #1b5e20;
    font-weight: 700;
  }
  .inv-low {
    color: #8a6d00;
    font-weight: 700;
  }
  .inv-out {
    color: #b71c1c;
    font-weight: 800;
  }

  /* Thumbnail visuals */
  .product-thumbs .thumb {
    border-radius: 8px;
    padding: 4px;
    background: transparent;
  }
  .product-thumbs .thumb img {
    border-radius: 6px;
  }
  .product-thumbs .thumb.active img {
    box-shadow: 0 8px 20px rgba(25, 118, 210, 0.14);
    border: 2px solid #1976d2;
  }
  .product-thumbs .thumb:hover img {
    transform: scale(1.02);
    transition: transform 0.12s ease;
  }

  /* Main image frame */
  #main-product-img {
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
    transition: opacity 0.28s ease, transform 0.18s ease;
  }
  #main-product-img.loading {
    opacity: 0.3;
    transform: scale(0.995);
  }

  /* Read more */
  .desc-short {
    max-height: 8.4em;
    overflow: hidden;
  }
  .read-more {
    background: none;
    border: none;
    color: #1976d2;
    cursor: pointer;
    font-weight: 600;
    padding-left: 6px;
  }

  /* Modal */
  .img-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    z-index: 5000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
  }
  .img-modal.open {
    opacity: 1;
    pointer-events: auto;
  }
  .img-modal img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 14px 50px rgba(0, 0, 0, 0.6);
  }

  /* Keep content centered and not full-width */
  @media (min-width: 1600px) {
    .product-container {
      max-width: 1200px;
    }
  }
}

/* Thumbnails column */

/* three-column layout: thumbs | main image | details */
.product-image-row {
  display: flex;
  gap: 28px;
  align-items: flex-start;
}
.product-thumbs {
  width: 96px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  order: 0;
}
.thumb {
  width: 96px;
  height: 140px;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb.empty {
  background: #efefef;
  border-radius: 8px;
  width: 96px;
  height: 140px;
}

/* main image column */
.product-image {
  flex: 0 0 520px;
  min-width: 420px;
  order: 1;
}
.product-image img {
  width: 100%;
  height: 760px;
  object-fit: cover;
  border-radius: 8px;
}

/* details column */
.product-details {
  flex: 0 0 360px;
  order: 2;
}

.thumb.active {
  outline: 3px solid #1976d2;
  box-shadow: 0 6px 18px rgba(25, 118, 210, 0.12);
}

@media (max-width: 1100px) {
  .product-image-row {
    flex-direction: column;
    align-items: center;
  }
  .product-thumbs {
    width: 100%;
    order: 2;
    flex-direction: row;
    gap: 12px;
  }
  .thumb,
  .thumb.empty {
    width: 74px;
    height: 74px;
  }
  .product-image {
    order: 1;
    flex: 1;
    min-width: 280px;
  }
  .product-details {
    order: 3;
    flex: 1;
  }
}
