/* ========================================================
   PRODUCT DETAIL PAGE CSS (product.html)
   ======================================================== */

.product-detail-layout {
  margin-top: 15px;
  margin-bottom: 40px;
}

/* --- Hero Top: Gallery & Buy Box --- */
.product-hero-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 30px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 40px;
  margin-bottom: 30px;
}

/* Gallery Left */
.product-gallery {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gallery-main-view {
  position: relative;
  background: #fff;
  border: 1px solid #f0f0f0;
  border-radius: var(--radius-md);
  height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 20px;
  cursor: zoom-in;
  user-select: none;
}

.gallery-main-view img {
  max-height: 380px;
  max-width: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.gallery-main-view:hover img {
  transform: scale(1.06);
}

.gallery-zoom-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, 0.92);
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  z-index: 3;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
}

.gallery-zoom-btn:hover {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

.gallery-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(226, 232, 240, 0.9);
  background: rgba(255, 255, 255, 0.9);
  color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  z-index: 3;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.gallery-main-view:hover .gallery-nav-btn {
  opacity: 1;
}

.gallery-nav-btn:hover {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

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

.gallery-counter {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(15, 23, 42, 0.7);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  z-index: 3;
  pointer-events: none;
}

.gallery-sub-note {
  font-size: 11.5px;
  color: #888;
  text-align: center;
  font-style: italic;
}

.gallery-thumbs-row {
  display: flex;
  gap: 10px;
  justify-content: safe center;
  overflow-x: auto;
  padding: 4px 2px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.gallery-thumbs-row::-webkit-scrollbar {
  height: 5px;
}

.gallery-thumbs-row::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.thumb-item {
  width: 68px;
  height: 68px;
  flex: 0 0 auto;
  border-radius: var(--radius-sm);
  border: 1.5px solid #eaeaea;
  padding: 4px;
  cursor: pointer;
  background: #fff;
  transition: var(--transition);
}

.thumb-item:hover,
.thumb-item.active {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(243, 84, 120, 0.2);
}

.thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Lightbox Zoom Modal */
.product-lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.92);
  z-index: 100000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.product-lightbox-overlay.active {
  display: flex;
}

.product-lightbox-img {
  max-width: 92vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.lightbox-close-btn {
  position: fixed;
  top: 18px;
  right: 22px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-close-btn:hover {
  background: var(--primary-color);
}

.lightbox-nav-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-nav-btn:hover {
  background: var(--primary-color);
}

.lightbox-prev { left: 18px; }
.lightbox-next { right: 18px; }

.lightbox-counter {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 768px) {
  .gallery-nav-btn {
    opacity: 0.85;
    width: 32px;
    height: 32px;
    font-size: 12px;
  }
}

/* Commit Badges under Gallery */
.store-commits-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: #fafbfc;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px dashed #e1e4e8;
  margin-top: 10px;
}

.commit-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: #444;
}

.commit-item i {
  color: #ff9f43;
  font-size: 16px;
}

.social-share-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #666;
  margin-top: 8px;
}

.social-share-row a,
.social-share-row button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 13px;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.social-share-row a:hover,
.social-share-row button:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

.share-fb { background: #3b5998; }
.share-pin { background: #cb2027; }
.share-tw { background: #0f172a; }
.share-copy { background: #64748b; }

/* Buy Box Right */
.product-buy-box {
  display: flex;
  flex-direction: column;
}

.product-detail-brand {
  font-size: 13px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 6px;
}

.product-detail-title {
  font-size: 24px;
  font-weight: 800;
  color: #222;
  line-height: 1.35;
  margin-bottom: 12px;
}

.product-meta-row {
  display: flex;
  gap: 15px;
  font-size: 12.5px;
  color: #666;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.meta-status-instock {
  color: #27ae60;
  font-weight: 600;
}

/* Pricing box */
.product-detail-price-box {
  background: #fff8f9;
  border: 1px solid #ffd8e2;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.detail-price-current {
  font-size: 28px;
  font-weight: 800;
  color: var(--price-color);
}

.detail-price-old {
  font-size: 16px;
  color: var(--old-price-color);
  text-decoration: line-through;
}

.detail-badge-discount {
  background: var(--sale-badge-bg);
  color: #fff;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
}

.detail-price-saving {
  font-size: 12.5px;
  color: var(--primary-color);
  font-weight: 600;
}

/* Variants Selection */
.variant-selection-group {
  margin-bottom: 22px;
}

.variant-group-label {
  font-size: 13.5px;
  font-weight: 700;
  color: #333;
  margin-bottom: 10px;
  display: block;
}

.variant-options-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.variant-chip {
  padding: 8px 16px;
  border: 1.5px solid #e0e0e0;
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: #444;
  cursor: pointer;
  transition: var(--transition);
}

.variant-chip:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.variant-chip.active {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: #fff5f7;
  position: relative;
}

/* Quantity Box */
.quantity-selection-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 25px;
}

.quantity-controller {
  display: inline-flex;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
}

.btn-qty {
  width: 36px;
  height: 36px;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-qty:hover {
  background: #e9ecef;
  color: var(--primary-color);
}

.input-qty {
  width: 48px;
  height: 36px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  color: #333;
  border-left: 1px solid #ddd;
  border-right: 1px solid #ddd;
}

/* Call to Action Buttons */
.cta-buttons-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 10px;
}

.btn-cta-buynow {
  padding: 13px 20px;
  border-radius: var(--radius-full);
  border: 2px solid var(--primary-color);
  background: #fff;
  color: var(--primary-color);
  font-weight: 700;
  font-size: 15px;
  text-align: center;
  text-transform: uppercase;
  transition: var(--transition);
}

.btn-cta-buynow:hover {
  background: #fff0f4;
}

.btn-cta-addcart {
  padding: 13px 20px;
  border-radius: var(--radius-full);
  background: var(--primary-gradient);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  text-align: center;
  text-transform: uppercase;
  box-shadow: 0 4px 14px rgba(243, 84, 120, 0.35);
  transition: var(--transition);
}

.btn-cta-addcart:hover {
  opacity: 0.95;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(243, 84, 120, 0.45);
}

/* --- Content 2 Columns: Description & Sale Sidebar --- */
.product-content-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 25px;
  margin-bottom: 40px;
}

.product-description-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 30px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.desc-tab-header {
  border-bottom: 2px solid var(--primary-color);
  margin-bottom: 22px;
}

.desc-tab-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-color);
  padding-bottom: 10px;
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.article-body {
  font-size: 14.5px;
  line-height: 1.8;
  color: #444;
}

.article-body h2 {
  font-size: 20px;
  font-weight: 800;
  color: #222;
  margin: 16px 0 10px;
}

.article-body h3 {
  font-size: 16px;
  font-weight: 700;
  color: #333;
  margin: 14px 0 8px;
}

.article-body p {
  margin-bottom: 14px;
}

.article-body ul {
  list-style: disc;
  padding-left: 20px;
  margin-bottom: 16px;
}

.article-body ul li {
  margin-bottom: 6px;
}

#desc-collapsible {
  position: relative;
  transition: max-height 0.35s ease;
}

#desc-collapsible.is-collapsed {
  max-height: 400px;
  overflow: hidden;
}

#desc-collapsible.expanded {
  max-height: none !important;
  overflow: visible !important;
}

.desc-fade-overlay {
  display: none;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 90px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.95) 70%, #ffffff 100%);
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#desc-collapsible.is-collapsed .desc-fade-overlay {
  display: block;
}

#desc-collapsible.expanded .desc-fade-overlay {
  display: none;
}

.btn-expand-desc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 18px auto 0;
  padding: 9px 28px;
  border: 1px solid var(--primary-color);
  background: #fff;
  color: var(--primary-color);
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.btn-expand-desc:hover {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.2);
  transform: translateY(-1px);
}

/* Sidebar "Đang SALE mạnh" */
.sale-sidebar-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  height: fit-content;
}

.sale-sidebar-title {
  background: var(--primary-gradient);
  color: white;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.sale-sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mini-product-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid #f2f2f2;
}

.mini-thumb {
  width: 65px;
  height: 65px;
  border-radius: var(--radius-sm);
  border: 1px solid #eee;
  padding: 4px;
  flex-shrink: 0;
}

.mini-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mini-info {
  flex: 1;
}

.mini-brand {
  font-size: 10.5px;
  color: #888;
  text-transform: uppercase;
  font-weight: 600;
}

.mini-title {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  color: #333;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 2px 0 4px;
}

.mini-title a:hover {
  color: var(--primary-color);
}

.mini-prices {
  display: flex;
  gap: 6px;
  align-items: baseline;
}

.mini-price-cur {
  color: var(--price-color);
  font-weight: 700;
  font-size: 13.5px;
}

.mini-price-old {
  color: #999;
  font-size: 11px;
  text-decoration: line-through;
}

/* --- Sticky Bottom Bar --- */
.sticky-buy-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 -4px 16px rgba(0,0,0,0.1);
  padding: 10px 0;
  z-index: 999;
  border-top: 1px solid #eee;
  backdrop-filter: blur(8px);
  transform: translateY(100%);
  transition: transform 0.3s ease-in-out;
}

.sticky-buy-bar.is-visible {
  transform: translateY(0);
}

.sticky-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sticky-product-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.sticky-thumb {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  border: 1px solid #eee;
  padding: 2px;
}

.sticky-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #222;
}

.sticky-price {
  color: var(--price-color);
  font-weight: 800;
  font-size: 15px;
  margin-left: 10px;
}

.sticky-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Reviews Box */
.product-reviews-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 30px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  margin-top: 30px;
  margin-bottom: 30px;
}

/* Related & Viewed Products Cards */
.related-products-section,
.viewed-products-section {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 24px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  margin-bottom: 30px;
}

/* Responsive */
@media (max-width: 992px) {
  .product-hero-card {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 20px;
  }
  .gallery-main-view {
    height: auto;
    min-height: auto;
    max-height: 400px;
    padding: 12px;
  }
  .gallery-main-view img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 370px;
    object-fit: contain;
  }
  .product-content-grid {
    grid-template-columns: 1fr;
  }
  .sticky-product-info {
    display: none;
  }
  .sticky-bar-inner {
    justify-content: center;
  }
}

@media (max-width: 576px) {
  .product-hero-card {
    padding: 14px 12px;
    gap: 16px;
    border-radius: var(--radius-sm);
  }
  .gallery-main-view {
    height: auto;
    min-height: auto;
    max-height: 320px;
    padding: 8px;
    border-radius: var(--radius-sm);
  }
  .gallery-main-view img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 290px;
    object-fit: contain;
  }
  .thumb-item {
    width: 56px;
    height: 56px;
  }
  .cta-buttons-row {
    grid-template-columns: 1fr;
  }
  .store-commits-grid {
    grid-template-columns: 1fr;
  }
}
