/* === Embla Carousel Layout for Child Categories === */
.embla {
  overflow: hidden;
  position: relative;
}

.embla__viewport {
  overflow: hidden;
  width: 100%;
}

.embla__container {
  display: flex;
  gap: 1rem; /* space between slides */
}

.embla__slide {
  flex: 0 0 25%;
  max-width: 230px;
  user-select: none;
  scroll-snap-align: start;
}

/* === Category Card Styling === */
.category-card.compact {
  display: flex;
  flex-direction: column;
  width: 100%;
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  padding: 0.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.category-card.compact:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.category-card.compact img {
  width: calc(100% - 8px);
  height: 210px;
  margin: 4px;
  object-fit: contain;
  display: block;
  background: #fafafa;
  border-radius: 6px;
}

.category-card.compact .category-name {
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  margin: 0.75rem 0;
  color: #333;
}

/* === Navigation Buttons === */
.embla__prev,
.embla__next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #ddd;
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  font-size: 1.5rem;
  font-weight: bold;
  color: #333; /* visible arrows */
  transition: background 0.2s ease, color 0.2s ease;
}

.embla__prev:hover,
.embla__next:hover {
  background: #f5f5f5;
  color: #000; /* darker on hover */
}

.embla__prev {
  left: 0.5rem; /* inset to avoid clipping */
}

.embla__next {
  right: 0.5rem;
}

/* === Spacing and Bottom Margin === */
.embla__slide:last-child {
  margin-inline-end: 1.5rem;
}

.parent-carousel.list-view {
  margin-bottom: 2.5rem; /* space before product grid */
}

/* === Responsive Behavior === */
@media (max-width: 992px) {
  .embla__slide {
    flex: 0 0 45%; /* ~2 slides on tablets */
  }
}

@media (max-width: 576px) {
  .embla__slide {
    flex: 0 0 80%; /* ~1.2 slides on phones */
  }

  .category-card.compact img {
    height: 180px;
  }

  .embla__prev,
  .embla__next {
    width: 2rem;
    height: 2rem;
    font-size: 1.25rem;
  }
}
