/* SCOPED STYLING: Only affects elements inside .latest-scope */

/* Module Heading */
.latest-scope .fancy-heading {
  font-size: 24px; 
  font-weight: 800;
  color: #4caf50; /* Latest Green */
  letter-spacing: 0.02em;
  margin-top: 30px;
  margin-bottom: 25px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}
.latest-scope .fancy-heading .fa-bell {
  color: #8bc34a; 
  font-size: 1.1em; 
  margin-right: 4px;
  vertical-align: middle;
}
.latest-scope .fancy-heading::after {
  content: "";
  display: block;
  height: 4px;
  width: 48px;
  border-radius: 3px;
  background: linear-gradient(90deg, #4caf50 0%, #8bc34a 100%);
  position: absolute;
  left: 0;
  bottom: -10px;
}

/* Carousel Container Styling */
.latest-scope .swiper-viewport {
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  margin-bottom: 30px;
  background: transparent !important;
  padding: 10px 5px; 
  position: relative; 
}

/* Equal Height Logic for Slider */
.latest-scope .swiper-wrapper {
    display: flex;
    height: auto !important; 
}
.latest-scope .swiper-slide {
    height: auto !important;
    display: flex; 
    justify-content: center;
}

/* Product Card Improvements - SCOPED */
.latest-scope .product-thumb {
  margin-bottom: 20px;
  border: 1px solid #e5e5e5;
  border-radius: 6px; 
  background: #fff;
  transition: all 0.3s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 100%; 
  height: 100%; 
  /* FIX: Ensure consistent height context */
  position: relative;
  min-height: 100%;
}
.latest-scope .swiper-slide .product-thumb {
    margin-bottom: 0;
}
.latest-scope .product-thumb:hover {
  box-shadow: 0 12px 24px rgba(0,0,0,0.08);
  border-color: #4caf50;
  transform: translateY(-3px);
}
.latest-scope .product-thumb .image {
  padding: 10px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  /* FIX: Enforce image container height stability */
  min-height: 200px; 
  display: flex;
  align-items: center;
  justify-content: center;
}
.latest-scope .product-thumb .image img {
  border-radius: 4px; 
  max-width: 100%;
  height: auto;
  display: block;
}

.latest-scope .product-thumb .caption {
  padding: 0 15px 15px;
  min-height: 120px; /* FIX: Increased min-height to prevent jumping */
  flex-grow: 1; 
  display: flex;
  flex-direction: column;
}

.latest-scope .product-thumb .caption h4 { 
    margin-top: 10px; 
    min-height: 20px; 
    margin-bottom: 5px; 
    overflow: hidden;
}
.latest-scope .product-thumb .caption h4 a {
  /* color is set inline via twig variable */
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  line-height: 1.4;
}
.latest-scope .product-thumb .caption h4 a:hover {
  color: #4caf50;
}
.latest-scope .product-thumb .price {
  /* color is set inline via twig variable */
  font-weight: 700;
  font-size: 16px;
  margin-top: auto; 
  padding-top: 10px;
  margin-bottom: 5px;
}
.latest-scope .product-thumb .price-new { color: #e53935; }
.latest-scope .product-thumb .price-old { color: #999; font-weight: 400; text-decoration: line-through; }

/* Carousel Navigation Buttons */
.latest-scope .swiper-pager .swiper-button-next,
.latest-scope .swiper-pager .swiper-button-prev {
  background-size: 20px 20px;
  width: 40px !important;
  height: 40px !important;
  background-color: #fff !important;
  border-radius: 50% !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  opacity: 0; 
  transition: all 0.3s ease;
  background-image: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  position: absolute;
}

.latest-scope .swiper-pager .swiper-button-next::after {
  content: "\f105"; 
  font-family: FontAwesome;
  color: #555;
  font-size: 20px;
}
.latest-scope .swiper-pager .swiper-button-prev::after {
  content: "\f104"; 
  font-family: FontAwesome;
  color: #555;
  font-size: 20px;
}

.latest-scope .swiper-viewport:hover .swiper-button-next,
.latest-scope .swiper-viewport:hover .swiper-button-prev {
  opacity: 1;
}

.latest-scope .swiper-pager .swiper-button-next:hover,
.latest-scope .swiper-pager .swiper-button-prev:hover {
  background-color: #4caf50 !important;
}
.latest-scope .swiper-pager .swiper-button-next:hover::after,
.latest-scope .swiper-pager .swiper-button-prev:hover::after {
  color: #fff;
}

.latest-scope .swiper-pager .swiper-button-next { right: -10px; }
.latest-scope .swiper-pager .swiper-button-prev { left: -10px; }

/* BUTTON GROUP STYLING */
.latest-scope .product-thumb .button-group {
  background-color: #f8f9fa;
  border-top: 1px solid #eee;
  display: flex; 
  width: 100%;
  padding: 0;
  margin: 0;
  margin-top: auto; 
}
.latest-scope .product-thumb .button-group button {
  border: none;
  background: transparent;
  color: #666;
  padding: 12px 5px;
  transition: all 0.2s;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  border-right: 1px solid #e5e5e5;
  white-space: nowrap; 
  display: flex;
  align-items: center;
  justify-content: center;
  height: 45px; 
  line-height: 1;
}
.latest-scope .product-thumb .button-group button:last-child {
  border-right: none;
}
.latest-scope .product-thumb .button-group button:hover {
  background: #4caf50;
  color: #fff;
}

/* Specific Widths for Buttons */
.latest-scope .product-thumb .button-group button:nth-of-type(1) {
  flex: 0 0 60%;
  width: 60%;
}
.latest-scope .product-thumb .button-group button:nth-of-type(1) i {
  margin-right: 5px; 
}

.latest-scope .product-thumb .button-group button:nth-of-type(2),
.latest-scope .product-thumb .button-group button:nth-of-type(3) {
  flex: 0 0 20%;
  width: 20%;
  font-size: 14px; 
}

/* RESPONSIVE & MOBILE FIXES */
@media (max-width: 767px) {
  .latest-scope .fancy-heading { font-size: 19px; } 
  .latest-scope .fancy-heading::after { width: 32px; }
  
  .latest-scope .swiper-pager .swiper-button-next, 
  .latest-scope .swiper-pager .swiper-button-prev { 
      opacity: 1 !important;
      width: 32px !important; 
      height: 32px !important; 
      background-color: rgba(255, 255, 255, 0.9) !important;
      border: 1px solid #eee !important;
  }
  
  .latest-scope .swiper-pager .swiper-button-next::after,
  .latest-scope .swiper-pager .swiper-button-prev::after {
      font-size: 16px;
      color: #333;
  }

  .latest-scope .swiper-pager .swiper-button-next { right: 0px; }
  .latest-scope .swiper-pager .swiper-button-prev { left: 0px; }
  
  .latest-scope .product-thumb .caption {
     padding: 0 10px 10px;
  }
  .latest-scope .product-thumb .button-group button {
     padding: 8px 2px;
     font-size: 10px; 
  }
}

/* FLEXBOX ROW FOR EQUAL HEIGHT GRID */
.row-flex {
    display: flex;
    flex-wrap: wrap;
    /* KEY FIX: Ensure items align/stretch */
    align-items: stretch;
}
.row-flex > [class*='col-'] {
    display: flex;
    flex-direction: column;
}

/* TILE TRANSITION STYLES */
.tile-transition-item {
    transition: opacity 0.5s ease-in-out;
    height: 100%; /* FIX: Force item to fill the flex column */
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}
.tile-transition-item.fading-out {
    opacity: 0;
}