/* ========================================
   Product Detail Page - Layout 2x2 với Image Slider (Improved)
   ======================================== */

/* Breadcrumb Section */
.breadcrumb-section {
  background-color: var(--light);
  padding: 20px 0;
  border-bottom: 1px solid var(--border-color);
}

.breadcrumb {
  background: none;
  padding: 0;
  margin: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
  color: var(--secondary);
}

.breadcrumb-item a {
  color: var(--primary);
  text-decoration: none;
}

.breadcrumb-item a:hover {
  text-decoration: underline;
}

.breadcrumb-item.active {
  color: var(--dark);
}

/* Product Detail Container */
.product-detail {
  margin: 40px 0;
  padding: 0;
}

/* Main 2x2 Grid Layout */
.product-detail .row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: 1.2fr 0.8fr;
  gap: 30px;
  min-height: 600px;
}

/* ========================================
   Ô 1: Product Images Slider (Trên trái) - IMPROVED
   ======================================== */
.product-images {
  grid-column: 1;
  grid-row: 1;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  border: 1px solid var(--border-color);
  min-height: 500px;
  position: relative;
  overflow: hidden;
}

/* Image Slider Container - Flexible Height */
.image-slider {
  position: relative;
  width: 100%;
  height: 100%;
  /* min-height: 420px; */
  max-height: 400px;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 20px;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slider-track {
  display: flex;
  height: 100%;
  width: 100%;
  transition: transform 0.3s ease;
  will-change: transform;
}

/* FIXED: Image display to show full image */
.slider-image {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: contain; /* Changed from cover to contain */
  object-position: center;
  user-select: none;
  transition: var(--transition-fast);
  cursor: zoom-in; /* Show zoom cursor */
  background: #fff;
}

/* Auto-adjust slider height based on image aspect ratio */
.image-slider.auto-height {
  height: auto;
  min-height: 300px;
  max-height: 80vh;
}

.image-slider.auto-height .slider-image {
  height: auto;
  max-height: 80vh;
}

/* Navigation Arrows */
.slider-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 18px;
  z-index: 10;
  backdrop-filter: blur(4px);
}

.slider-nav:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: translateY(-50%) scale(1.1);
}

.slider-nav:active {
  transform: translateY(-50%) scale(0.95);
}

.slider-prev {
  left: 15px;
}

.slider-next {
  right: 15px;
}

/* Hide arrows when only one image */
.single-image .slider-nav {
  display: none;
}

/* Slider Dots */
.slider-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 15px;
}

.slider-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.slider-dot:hover {
  background: rgba(0, 0, 0, 0.5);
  transform: scale(1.2);
}

.slider-dot.active {
  background: var(--primary);
  border-color: var(--primary-light);
  transform: scale(1.3);
  box-shadow: 0 2px 8px rgba(244, 59, 71, 0.4);
}

/* Hide dots when only one image */
.single-image .slider-dots {
  display: none;
}

/* Image Counter */
.image-counter {
  position: absolute;
  bottom: 15px;
  right: 15px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 5px 12px;
  border-radius: 15px;
  font-size: 12px;
  font-weight: 500;
  backdrop-filter: blur(4px);
  z-index: 10;
}

/* Hide counter when only one image */
.single-image .image-counter {
  display: none;
}

/* Zoom hint */
.zoom-hint {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 11px;
  font-weight: 500;
  backdrop-filter: blur(4px);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Thumbnails (Optional - có thể giữ lại hoặc bỏ) */
.image-thumbnails {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 100%;
  margin-top: 10px;
}

.thumbnail {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition-fast);
  opacity: 0.6;
}

.thumbnail:hover,
.thumbnail.active {
  border-color: var(--primary);
  opacity: 1;
  transform: scale(1.05);
}

/* ========================================
   LIGHTBOX MODAL - NEW
   ======================================== */
.lightbox-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  backdrop-filter: blur(5px);
}

.lightbox-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-content {
  position: relative;
  max-width: 95vw;
  max-height: 95vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-image {
  max-width: 100%;
  max-height: 95vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* Lightbox Navigation */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 20px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
  left: 20px;
}

.lightbox-next {
  right: 20px;
}

/* Close Button */
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 20px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* Lightbox Info */
.lightbox-info {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px 20px;
  border-radius: 25px;
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 14px;
}

.lightbox-counter {
  font-weight: 600;
}

.lightbox-title {
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========================================
   Other Sections (unchanged)
   ======================================== */
.product-description-section {
  grid-column: 1;
  grid-row: 2;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 30px;
  border: 1px solid var(--border-color);
}

.product-description-section h3 {
  color: var(--dark);
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.product-description-section p {
  color: var(--secondary);
  line-height: 1.8;
  font-size: 15px;
  margin: 0;
}

.product-info {
  grid-column: 2;
  grid-row: 1;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 25px;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.category-breadcrumb {
  margin-bottom: 5px;
}

.category-breadcrumb-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: white;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  transition: var(--transition-fast);
}

.category-breadcrumb-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  color: white;
}

.product-info h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--dark);
  margin: 0;
  line-height: 1.3;
}

.product-price {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--danger), #ff6b6b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 8px 0;
}

.product-price.contact-price {
  background: linear-gradient(135deg, var(--info), #4ecdc4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 20px;
}

.product-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.25rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
}

.product-stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--light);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  flex: 1;
  transition: var(--transition-fast);
  font-size: 12px;
}

.product-stat-item i {
  color: var(--primary);
  font-size: 14px;
}

.product-stat-value {
  font-weight: 600;
  font-size: 13px;
}

.action-buttons {
  margin-top: auto;
  padding-top: 10px;
}

.btn-chat {
  width: 100%;
  background: linear-gradient(135deg, var(--success), #20b2aa);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition-fast);
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(16, 185, 129, 0.3);
}

.btn-chat:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  background: linear-gradient(135deg, #059669, #0d9488);
}

.btn-chat i {
  font-size: 18px;
}

.product-meta-section {
  grid-column: 2;
  grid-row: 2;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 25px;
  border: 1px solid var(--border-color);
}

.product-meta-section h3 {
  color: var(--dark);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.team-thanks {
  margin-bottom: 20px;
  padding: 15px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--warning);
}

.thanks-message {
  color: #92400e;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  margin: 0;
  line-height: 1.4;
}

.product-meta {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.meta-item {
  display: flex;
  gap: 12px;
  background: var(--light);
  padding: 16px;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--primary);
  transition: var(--transition-fast);
}

.meta-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 2px;
}

.meta-content {
  flex: 1;
  font-size: 13px;
  line-height: 1.5;
  color: var(--dark);
}

.meta-content strong {
  color: var(--primary);
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

/* ========================================
   Related Products Section
   ======================================== */
.related-products {
  margin-top: 60px;
  padding-top: 40px;
  border-top: 2px solid var(--border-color);
  position: relative;
}

.related-products h2 {
  font-size: 28px;
  font-weight: 700;
  color: var(--light);
  margin-bottom: 8px;
  text-align: center;
}

.related-products-subtitle {
  text-align: center;
  color: var(--gray-300);
  margin-bottom: 40px;
  font-size: 16px;
}

.related-product-grid {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 10px 0 20px 0;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) var(--light);
}

.related-product-grid::-webkit-scrollbar {
  height: 8px;
}

.related-product-grid::-webkit-scrollbar-track {
  background: var(--light);
  border-radius: 4px;
}

.related-product-grid::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
  transition: var(--transition-fast);
}

.related-product-grid::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}

.related-product-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  transition: var(--transition-fast);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  flex-shrink: 0;
  width: calc(25% - 15px);
  min-width: 280px;
}

.related-product-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
  text-decoration: none;
  color: inherit;
}

.related-product-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: var(--transition-fast);
}

.related-product-card:hover .related-product-image {
  transform: scale(1.05);
}

.related-product-info {
  padding: 20px;
}

.related-product-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 12px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-product-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 12px;
}

.related-product-stats {
  display: flex;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.related-product-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--secondary);
  font-size: 14px;
}

.related-product-stat i {
  color: var(--primary);
}

/* ========================================
   Responsive Design - IMPROVED
   ======================================== */

/* Large Desktop (1200px+) */
@media (min-width: 1200px) {
  .product-detail .row {
    gap: 40px;
    grid-template-columns: 2fr 1fr;
  }
  
  .product-images,
  .product-description-section,
  .product-info,
  .product-meta-section {
    padding: 30px;
  }
  
  .product-images {
    min-height: 600px;
  }
  
  .image-slider {
    min-height: 500px;
  }
}

/* Medium Desktop (992px - 1199px) */
@media (max-width: 1199px) {
  .product-detail .row {
    gap: 25px;
  }
  
  .image-slider {
    min-height: 350px;
  }
  
  .product-info h1 {
    font-size: 22px;
  }
  
  .product-price {
    font-size: 26px;
  }
}

/* Tablet (768px - 991px) */
@media (max-width: 991px) {
  .product-detail .row {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
    gap: 20px;
  }
  
  .product-images {
    grid-column: 1;
    grid-row: 1;
  }
  
  .product-info {
    grid-column: 1;
    grid-row: 2;
  }
  
  .product-description-section {
    grid-column: 1;
    grid-row: 3;
  }
  
  .product-meta-section {
    grid-column: 1;
    grid-row: 4;
  }
  
  .image-slider {
    min-height: 350px;
    max-height: 500px;
  }
  
  .product-stats {
    flex-direction: row;
    gap: 12px;
  }
  
  .product-stat-item {
    justify-content: center;
  }
  
  /* Lightbox adjustments for tablet */
  .lightbox-nav {
    width: 45px;
    height: 45px;
    font-size: 18px;
  }
  
  .lightbox-prev {
    left: 15px;
  }
  
  .lightbox-next {
    right: 15px;
  }
}

/* Mobile (768px và nhỏ hơn) */
@media (max-width: 768px) {
  .product-detail {
    margin: 20px 0;
  }
  
  .product-detail .row {
    gap: 16px;
  }
  
  .product-images,
  .product-description-section,
  .product-info,
  .product-meta-section {
    padding: 20px;
  }
  
  .image-slider {
    min-height: 280px;
    max-height: 400px;
  }
  
  .slider-nav {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
  
  .slider-prev {
    left: 10px;
  }
  
  .slider-next {
    right: 10px;
  }
  
  .slider-dot {
    width: 10px;
    height: 10px;
  }
  
  .thumbnail {
    width: 50px;
    height: 50px;
  }
  
  .product-info h1 {
    font-size: 18px;
  }
  
  .product-price {
    font-size: 22px;
  }
  
  .btn-chat {
    padding: 12px 18px;
    font-size: 14px;
  }
  
  .product-stats {
    gap: 8px;
  }
  
  .product-stat-item {
    padding: 6px 8px;
    font-size: 10px;
  }
  
  .product-stat-value {
    font-size: 11px;
  }
  
  /* Mobile lightbox */
  .lightbox-nav {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
  
  .lightbox-prev {
    left: 10px;
  }
  
  .lightbox-next {
    right: 10px;
  }
  
  .lightbox-close {
    width: 40px;
    height: 40px;
    font-size: 18px;
    top: 15px;
    right: 15px;
  }
  
  .lightbox-info {
    bottom: 15px;
    padding: 8px 15px;
    font-size: 12px;
  }
  
  .lightbox-title {
    max-width: 200px;
  }
  
  .zoom-hint {
    font-size: 10px;
    padding: 4px 8px;
  }
}

/* Small Mobile (576px và nhỏ hơn) */
@media (max-width: 576px) {
  .breadcrumb-section {
    padding: 15px 0;
  }
  
  .product-images,
  .product-description-section,
  .product-info,
  .product-meta-section {
    padding: 16px;
  }
  
  .image-slider {
    min-height: 250px;
    max-height: 350px;
  }
  
  .slider-nav {
    width: 35px;
    height: 35px;
    font-size: 14px;
  }
  
  .slider-prev {
    left: 8px;
  }
  
  .slider-next {
    right: 8px;
  }
  
  .image-thumbnails {
    gap: 8px;
  }
  
  .thumbnail {
    width: 45px;
    height: 45px;
  }
  
  .product-info h1 {
    font-size: 16px;
  }
  
  .product-price {
    font-size: 20px;
  }
  
  .product-description-section h3,
  .product-meta-section h3 {
    font-size: 16px;
  }
  
  .thanks-message {
    font-size: 12px;
  }
  
  .meta-content {
    font-size: 12px;
  }
  
  .meta-content strong {
    font-size: 13px;
  }
  
  .meta-number {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
  
  .category-breadcrumb-item {
    font-size: 11px;
    padding: 5px 10px;
  }
  
  /* Small mobile lightbox */
  .lightbox-nav {
    width: 35px;
    height: 35px;
    font-size: 14px;
  }
  
  .lightbox-close {
    width: 35px;
    height: 35px;
    font-size: 16px;
  }
  
  .lightbox-info {
    bottom: 10px;
    padding: 6px 12px;
    font-size: 11px;
  }
  
  .lightbox-title {
    max-width: 150px;
  }
}

/* Extra Small Mobile (480px và nhỏ hơn) */
@media (max-width: 480px) {
  .container {
    padding: 0 10px;
  }
  
  .product-images,
  .product-description-section,
  .product-info,
  .product-meta-section {
    padding: 12px;
  }
  
  .image-slider {
    min-height: 220px;
    max-height: 300px;
    margin-bottom: 15px;
  }
  
  .slider-dots {
    gap: 8px;
    margin-top: 10px;
  }
  
  .slider-dot {
    width: 8px;
    height: 8px;
  }
  
  .product-info h1 {
    font-size: 14px;
  }
  
  .product-price {
    font-size: 18px;
  }
  
  .btn-chat {
    padding: 10px 16px;
    font-size: 13px;
  }
  
  .product-stat-item {
    padding: 4px 6px;
    font-size: 9px;
  }
  
  .product-stat-value {
    font-size: 10px;
  }
}

/* Touch support */
@media (hover: none) and (pointer: coarse) {
  .slider-nav:hover {
    background: rgba(0, 0, 0, 0.5);
    transform: translateY(-50%);
  }
  
  .thumbnail:hover {
    transform: none;
  }
  
  .slider-image {
    cursor: pointer;
  }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .slider-image {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
  
  .lightbox-image {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Print Styles */
@media print {
  .breadcrumb-section,
  .btn-chat,
  .related-products,
  .slider-nav,
  .slider-dots,
  .image-counter,
  .zoom-hint,
  .lightbox-modal {
    display: none !important;
  }
  
  .product-detail .row {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto auto auto !important;
    gap: 20px !important;
  }
  
  .product-images,
  .product-description-section,
  .product-info,
  .product-meta-section {
    background: white !important;
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }
  
  .image-slider {
    height: 300px !important;
  }
}