/* Product Detail Page - Optimized Critical CSS */

/* Related Products Optimization */
.product-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  will-change: transform;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 0.5rem 1.5rem rgba(0,0,0,0.15) !important;
}

.product-card:hover img {
  transform: scale(1.05);
}

/* Fast image loading */
.product-card img {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  content-visibility: auto;
}

/* Buy Now button styling - matching home page */
.btn-success {
  background: #28a745;
  border: none;
  transition: all 0.3s ease;
}

.btn-success:hover {
  background: #218838 !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4) !important;
}

.btn-success:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(40, 167, 69, 0.3) !important;
}

/* Description text styling - centered */
.product-card .card-body {
  text-align: center;
}

.product-card .card-body p {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

/* Product detail main image - PRIORITY LOADING */
.product-detail-main-image {
  max-width: 100%;
  height: auto;
  display: block;
  background: #f8f9fa;
  content-visibility: auto;
}

#mainImage {
  animation: none !important;
  background: none !important;
}

/* Product thumbnails */
.product-thumbnail {
  transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

@media (max-width: 576px) {
  .product-card .card-body h6 {
    font-size: 0.85rem !important;
  }
  
  .product-card .card-body .text-success {
    font-size: 1rem !important;
  }
  
  .product-card .card-body p {
    font-size: 0.7rem !important;
    height: 2.4em;
  }
  
  .product-card:hover {
    transform: none;
  }
  
  .btn-success:hover {
    transform: none;
  }
}

/* Prevent layout shift */
.card-img-top {
  aspect-ratio: 3/2;
  object-fit: cover;
}

/* Image loading optimization */
img[loading] {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

img[loading].loaded {
  animation: none;
  background: none;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Faster image decode */
img {
  image-rendering: -webkit-optimize-contrast;
}

/* Product Description Formatting */
.product-description {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.product-description::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #1baaae 0%, #17a2b8 100%);
  border-radius: 2px;
}

/* Better text readability for Bengali and English */
.product-description {
  letter-spacing: 0.3px;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Paragraph spacing within description */
.product-description p {
  margin-bottom: 1rem;
  line-height: 1.9;
}

/* List styling if description contains lists */
.product-description ul,
.product-description ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.product-description li {
  margin-bottom: 0.5rem;
  line-height: 1.8;
}

/* Highlight important text */
.product-description strong,
.product-description b {
  color: #1baaae;
  font-weight: 700;
}

/* Mobile responsive description */
@media (max-width: 768px) {
  .product-description {
    font-size: 0.95rem;
    padding: 1.25rem;
    line-height: 1.7;
  }
}

@media (max-width: 576px) {
  .product-description {
    font-size: 0.9rem;
    padding: 1rem;
    line-height: 1.6;
  }
}

/* Print-friendly description */
@media print {
  .product-description {
    background: white !important;
    box-shadow: none !important;
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }
}
