/* --- Bố cục chính sản phẩm chi tiết --- */

body {
  margin: 0;
  font-family: 'Roboto', sans-serif;
}

/* --- Ảnh thu nhỏ bên dưới ảnh lớn --- */

.thumbnail-container {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 15px;
  flex-wrap: wrap;
}

.thumbnail {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border: 2px solid #ccc;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.3s ease, transform 0.2s;
  box-sizing: border-box;
}

.thumbnail:hover,
.thumbnail.active {
  border-color: #ff0000;
  transform: scale(1.05);
}

/* Vùng chứa ảnh chính */
.product-image {
  flex: 1;
  min-width: 300px;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Ảnh chính: luôn cùng tỷ lệ với thumbnail */
.product-image #mainImage {
  width: 500px;
  height: 400px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #ccc;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

/* zoom ảnh */
#imageOverlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.image-modal img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(255,255,255,0.3);
}

@keyframes zoom {
    from { transform: scale(0.8); }
    to { transform: scale(1); }
}

.product-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 120px;
  padding: 40px 10%;
  align-items: flex-start;
  justify-content: flex-start; /* đổi từ center -> start */
  margin-top: 80px;
}

.product-info {
  flex: 1.2;
  max-width: 500px;
}

.product-info h1 {
  font-size: 28px;
  color: #222;
  margin-bottom: 10px;
}

.price {
  font-size: 24px;
  color: #d10000;
  font-weight: bold;
  margin-bottom: 20px;
}

.description {
  font-size: 16px;
  line-height: 1.2;
  margin-bottom: 30px;
}

.technical {
  flex: 1;
  min-width: 280px;
}

.technical table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid black;
}

.technical td {
  border: 1px solid black;
  padding: 12px 15px;
  font-size: 16px;
}

.technical td:first-child {
  background-color: #F2F2F2; /* Bên trái */
}

.buy-button {
  background-color: #d10000;
  color: #fff;
  border: none;
  padding: 12px 20px;
  font-size: 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  width: 100%;
}

.buy-button:hover {
  background-color: #a80000;
}

.button-row {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.button-row .buy-button {
  flex: 1;
  width: 100%;
  text-align: center;
  padding: 12px 0;
}

.warranty-button {
  background-color: #ff0000;
  text-decoration: none;
}

.warranty-button:hover {
  background-color: #b50808;
}

/* --- Liên hệ --- */
.contact {
  margin-top: 60px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 10px;
  flex-wrap: wrap;
  background-color: #ff0000;

}

.office {
  flex: 1;
  min-width: 220px;
  border-radius: 8px;
  padding: 15px;
}

.office h3 {
  color: white;
  margin-bottom: 10px;
}

.office p {
  margin: 4px 0;
  font-size: 14px;
  color: white;
}

#backToTopBtn {
  display: none;
  /* Ẩn ban đầu */
  position: fixed;
  bottom: 40px;
  right: 30px;
  z-index: 999;
  font-size: 18px;
  border: none;
  outline: none;
  background-color: #ff0000;
  color: white;
  cursor: pointer;
  padding: 12px 16px;
  border-radius: 50%;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  transition: opacity 0.3s ease;
}

#backToTopBtn:hover {
  background-color: #ff0000;
}

/* form đặt mua */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: none;
  z-index: 999;
  justify-content: center;
  align-items: center;
}

.overlay.show {
  display: flex;
}

.order-form {
  background-color: #fff;
  padding: 30px;
  width: 90%;
  max-width: 500px;
  border-radius: 10px;
  position: relative;
}

.order-form h2 {
  margin-bottom: 20px;
}

.order-form .close-btn {
  position: absolute;
  right: 15px;
  top: 10px;
  font-size: 24px;
  cursor: pointer;
}

.qr-container img {
  max-width: 250px;
  display: block;
  margin: 20px auto;
}

@media screen and (max-width: 1024px) {
  .product-detail {
    flex-direction: column;
    gap: 40px;
    padding: 20px;
    margin-top: 40px;
  }

  .product-image {
    max-width: 100%;
  }

  .product-image #mainImage {
    width: 100%;
    height: auto;
  }

  #mainImage {
        cursor: zoom-in;
    }

    #imageOverlay {
        display: none; /* giữ nguyên vì sẽ bật bằng JS */
    }

  .product-info {
    max-width: 100%;
  }

  .product-info h1 {
    font-size: 22px;
  }

  .price {
    font-size: 20px;
  }

  .description {
    font-size: 15px;
  }

  .technical {
    width: 100%;
  }

  .technical td {
    font-size: 14px;
    padding: 10px;
  }

  .button-row {
    flex-direction: column;
    gap: 10px;
  }

  .contact {
    flex-direction: column;
    gap: 30px;
    padding: 20px;
  }

  .office {
    padding: 10px;
  }

  .order-form {
    width: 95%;
    padding: 20px;
  }

  .order-form h2 {
    font-size: 18px;
  }

  .qr-container img {
    max-width: 100%;
    height: auto;
  }

  #backToTopBtn {
    display: none !important;
  }
}
