/**
 * Related Module CSS
 * Styles for related categories and products display
 */

/* ============================================
   RELATED SECTION
   ============================================ */

.lp-content .lp-related-section {
  background: var(--lp-bg-light);
  padding: var(--lp-spacing-2xl) 0;
}

.lp-content .related-subsection-title {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--lp-text-dark);
  margin: 0 0 var(--lp-spacing-lg) 0;
  padding-bottom: var(--lp-spacing-sm);
  border-bottom: 2px solid var(--lp-border);
}

/* ============================================
   RELATED CATEGORIES
   ============================================ */

.lp-content .related-categories-wrapper {
  margin-bottom: var(--lp-spacing-2xl);
}

.lp-content .related-categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--lp-spacing-lg);
  margin-top: var(--lp-spacing-lg);
}

/* Category Layout Styles */
.lp-content .related-categories-grid.category-layout-style-1 {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.lp-content .related-categories-grid.category-layout-style-2 {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.lp-content .related-categories-grid.category-layout-style-3 {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.lp-content .related-categories-grid.category-layout-style-4 {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.lp-content .related-categories-grid.category-layout-style-5 {
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
}

.lp-content .related-category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--lp-spacing-lg);
  background: var(--lp-card);
  border-radius: var(--lp-radius-xl);
  border: 2px solid var(--lp-border);
  box-shadow: var(--lp-shadow);
  transition: all 0.3s ease;
  text-decoration: none;
  color: var(--lp-text-dark);
  position: relative;
  overflow: hidden;
}

/* Category Layout Style 1: Tetris Collage (Default) */
.lp-content .related-category-card.category-layout-style-1 {
  padding: 0;
  overflow: hidden;
}

.lp-content .related-category-card.category-layout-style-1 .related-category-visual {
  width: 100%;
  height: 250px;
  position: relative;
  overflow: hidden;
}

.lp-content .related-category-card.category-layout-style-1 .category-product-collage {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  height: 100%;
  gap: 6px;
  background: var(--lp-bg-light);
  padding: 6px;
  overflow: hidden;
}

.lp-content .related-category-card.category-layout-style-1 .collage-product-item {
  background: #F3F4F6;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 4px;
  position: relative;
  min-width: 0;
}

.lp-content .related-category-card.category-layout-style-1 .collage-product-item:hover {

  z-index: 1;
}

/* Ensure images fit properly in their containers */
.lp-content .related-category-card.category-layout-style-1 .collage-product-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
  mix-blend-mode: darken;
}

.lp-content .related-category-card.category-layout-style-1 .collage-category-image {
  background: #F3F4F6;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  min-width: 0;
  background: #FFF;
  box-shadow: none;
}

.lp-content .related-category-card.category-layout-style-1 .collage-category-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 12px;
}

/* Products Count Badge - Integrated into waterfall */
.lp-content .collage-products-count {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.lp-content .products-count-badge {
  background: var(--lp-brand);
  color: var(--lp-text-light);
  border-radius: 4px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  height: 100%;
  min-height: 60px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
}


.lp-content .products-count-badge .count-number {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 2px;
}

.lp-content .products-count-badge .count-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.95;
}

.lp-content .related-category-card.category-layout-style-1 .related-category-content {
  padding: var(--lp-spacing-lg);
  width: 100%;
  text-align: center;
}

/* Category Layout Style 2: Larger Tetris */
.lp-content .related-category-card.category-layout-style-2 .related-category-visual {
  height: 300px;
}

.lp-content .related-category-card.category-layout-style-2 .category-product-collage {
  grid-template-areas:
    "item1 item2 item3 category"
    "item4 item5 item6 count";
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 6px;
  padding: 6px;
}

.lp-content .related-category-card.category-layout-style-2 .collage-product-item,
.lp-content .related-category-card.category-layout-style-2 .collage-category-image {
  background: #F3F4F6;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Category Layout Style 3: Compact Tetris */
.lp-content .related-category-card.category-layout-style-3 .related-category-visual {
  height: 200px;
}

.lp-content .related-category-card.category-layout-style-3 .category-product-collage {
  grid-template-areas:
    "item1 category"
    "item2 category"
    "item3 item4"
    "item5 count";
  grid-template-columns: 1fr 1.5fr;
  grid-template-rows: repeat(4, minmax(55px, 1fr));
  gap: 6px;
  padding: 6px;
}

.lp-content .related-category-card.category-layout-style-3 .collage-product-item,
.lp-content .related-category-card.category-layout-style-3 .collage-category-image {
  background: #F3F4F6;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Category Layout Style 4: Vertical Tetris */
.lp-content .related-category-card.category-layout-style-4 .related-category-visual {
  height: 280px;
}

.lp-content .related-category-card.category-layout-style-4 .category-product-collage {
  grid-template-areas:
    "category item1 item2"
    "category item3 item4"
    "category item5 count";
  grid-template-columns: 1.5fr 1fr 1fr;
  grid-template-rows: repeat(3, 1fr);
  gap: 6px;
  padding: 6px;
}

.lp-content .related-category-card.category-layout-style-4 .collage-product-item,
.lp-content .related-category-card.category-layout-style-4 .collage-category-image {
  background: #F3F4F6;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Category Layout Style 5: Horizontal Tetris */
.lp-content .related-category-card.category-layout-style-5 .related-category-visual {
  height: 220px;
}

.lp-content .related-category-card.category-layout-style-5 .category-product-collage {
  grid-template-areas:
    "category category item1 item2"
    "category category item3 item4"
    "item5 item6 count count";
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 6px;
  padding: 6px;
}

.lp-content .related-category-card.category-layout-style-5 .collage-product-item,
.lp-content .related-category-card.category-layout-style-5 .collage-category-image {
  background: #F3F4F6;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.lp-content .related-category-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--lp-brand);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.lp-content .related-category-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--lp-shadow-xl);
  border-color: var(--lp-brand);
}

.lp-content .related-category-card:hover::before {
  transform: scaleX(1);
}

.lp-content .related-category-visual {
  width: 100%;
  margin-bottom: var(--lp-spacing-md);
}

.lp-content .related-category-icon {
  font-size: 3.5rem;
  margin-bottom: var(--lp-spacing-md);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
  max-height: 120px;
  overflow: hidden;
}

.lp-content .related-category-icon img {
  max-width: 100%;
  max-height: 120px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--lp-radius-md);
}

.lp-content .related-category-placeholder {
  font-size: 3.5rem;
  display: block;
}

.lp-content .related-category-content {
  width: 100%;
  text-align: center;
}

.lp-content .related-category-name {
  font-size: 1.125rem;
  font-weight: 600;
  text-align: center;
  color: var(--lp-text-dark);
  margin-bottom: var(--lp-spacing-xs);
  line-height: 1.4;
}

.lp-content .related-category-description {
  font-size: 0.875rem;
  text-align: center;
  color: var(--lp-text-muted);
  margin-bottom: var(--lp-spacing-xs);
  line-height: 1.5;
  padding: 0 var(--lp-spacing-xs);
}

.lp-content .related-category-arrow {
  font-size: 1.5rem;
  color: var(--lp-brand);
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.3s ease;
  margin-top: var(--lp-spacing-xs);
}

.lp-content .related-category-card:hover .related-category-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* ============================================
   RELATED PRODUCTS
   ============================================ */

.lp-content .related-products-wrapper {
  margin-top: var(--lp-spacing-2xl);
}

.lp-content .related-products-grid {
  display: grid;
  grid-template-columns: repeat(var(--products-per-row, 4), 1fr);
  gap: var(--lp-spacing-lg);
  margin-top: var(--lp-spacing-lg);
}

.lp-content .related-product-card {
  background: var(--lp-card);
  border-radius: var(--lp-radius-xl);
  overflow: hidden;
  border: 1px solid var(--lp-border);
  box-shadow: var(--lp-shadow);
  transition: all 0.3s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.lp-content .related-product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--lp-shadow-lg);
  border-color: var(--lp-brand);
}

.lp-content .related-product-image {
  width: 100%;
  height: 200px;
  background: var(--lp-bg-section);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--lp-spacing-md);
  overflow: hidden;
}

.lp-content .related-product-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.lp-content .related-product-card:hover .related-product-image img {
  transform: scale(1.05);
}

.lp-content .related-product-info {
  padding: var(--lp-spacing-md);
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.lp-content .related-product-name {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--lp-text-dark);
  margin: 0 0 var(--lp-spacing-xs) 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lp-content .related-product-model {
  font-size: 0.875rem;
  color: var(--lp-text-muted);
  margin: 0 0 var(--lp-spacing-xs) 0;
}

.lp-content .related-product-rating {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: var(--lp-spacing-xs);
  font-size: 0.875rem;
  color: var(--lp-text-muted);
}

.lp-content .related-product-review-count {
  color: var(--lp-text-muted);
  font-size: 0.875rem;
}

.lp-content .related-product-highlights {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--lp-spacing-sm) 0;
  flex-grow: 1;
}

.lp-content .related-product-highlights li {
  font-size: 0.875rem;
  color: var(--lp-text);
  padding-left: 1.25rem;
  position: relative;
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.lp-content .related-product-highlights li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--lp-success);
  font-weight: bold;
}

.lp-content .related-product-discount {
  background: var(--lp-brand);
  color: var(--lp-text-light);
  padding: 0.5rem 0.75rem;
  border-radius: var(--lp-radius-md);
  margin-bottom: var(--lp-spacing-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 600;
}

.lp-content .related-product-discount .discount-amount {
  font-size: 0.875rem;
}

.lp-content .related-product-discount .discount-percent {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.25rem 0.5rem;
  border-radius: var(--lp-radius-sm);
  font-weight: 700;
}

.lp-content .related-product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: var(--lp-spacing-sm);
  border-top: 1px solid var(--lp-border-light);
}

.lp-content .related-product-pricing {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.lp-content .related-product-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--lp-brand);
  margin: 0;
}

.lp-content .related-product-price-original {
  font-size: 0.875rem;
  color: var(--lp-text-muted);
  text-decoration: line-through;
  font-weight: 400;
}

.lp-content .related-product-price-sale {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--lp-brand);
}

.lp-content .related-product-stock {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: var(--lp-radius-sm);
}

.lp-content .related-product-stock.in {
  background: var(--lp-green-bg);
  color: var(--lp-green-text);
}

.lp-content .related-product-stock.preorder {
  background: var(--lp-highlight-blue-bg);
  color: var(--lp-highlight-blue);
}

.lp-content .related-product-stock.out {
  background: var(--lp-highlight-red-bg);
  color: var(--lp-danger);
}

.lp-content .related-product-stock.backordered {
  background: var(--lp-highlight-gold-bg);
  color: var(--lp-highlight-gold);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1024px) {
  .lp-content .related-products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .lp-content .related-categories-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

@media (max-width: 768px) {
  .lp-content .related-products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--lp-spacing-md);
  }
  
  .lp-content .related-categories-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--lp-spacing-md);
  }
  
  .lp-content .related-category-card {
    padding: var(--lp-spacing-md);
  }
  
  .lp-content .related-category-icon {
    font-size: 2.5rem;
    min-height: 50px;
  }
  
  .lp-content .related-category-icon img {
    max-width: 50px;
    max-height: 50px;
  }
  
  .lp-content .related-category-name {
    font-size: 1rem;
  }
  
  .lp-content .related-product-image {
    height: 160px;
  }
  
  .lp-content .related-subsection-title {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .lp-content .related-products-grid {
    grid-template-columns: 1fr;
  }
  
  .lp-content .related-categories-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .lp-content .related-product-image {
    height: 180px;
  }
}

