/**
 * Banner Mosaico y Carrusel de Ofertas (Cubimat) - Front Office Styles
 */

.cubimat-banner-wrapper {
  width: 100%;
  margin: 0 0 1.5rem 0;
  box-sizing: border-box;
}

.cubimat-banner-wrapper *,
.cubimat-banner-wrapper *::before,
.cubimat-banner-wrapper *::after {
  box-sizing: border-box;
}

/* Carousel Container */
.cubimat-carousel {
  position: relative;
  width: 100%;
  outline: none;
}

.cubimat-carousel-viewport {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 0;
  border-radius: var(--cubimat-radius, 0px);
}

/* Slide transition (desktop) */
.cubimat-transition-slide .cubimat-carousel-track {
  display: flex;
  flex-direction: row;
  width: 100%;
  transition: transform 0.55s cubic-bezier(0.25, 0.8, 0.25, 1);
  will-change: transform;
}

.cubimat-transition-slide .cubimat-carousel-slide {
  flex: 0 0 100%;
  width: 100%;
  min-width: 100%;
}

/* Fade transition (desktop) */
.cubimat-transition-fade .cubimat-carousel-track {
  display: grid;
  width: 100%;
}

.cubimat-transition-fade .cubimat-carousel-slide {
  grid-area: 1 / 1;
  width: 100%;
  opacity: 0;
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.5s ease;
}

.cubimat-transition-fade .cubimat-carousel-slide.is-active {
  opacity: 1;
  pointer-events: auto;
  z-index: 2;
}

/* Full-width Single Banner Slide (exact same 4:1 aspect ratio as mosaic) */
.cubimat-banner-single {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 1;
}

.cubimat-has-fixed-height .cubimat-banner-single {
  aspect-ratio: auto;
  height: var(--cubimat-height);
}

.cubimat-slot-single {
  width: 100%;
  height: 100%;
}

/* Desktop Mosaic Grid (37% left full-height, 63% right split 2 top + 1 wide bottom) */
.cubimat-banner-grid {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1.19fr) minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1.44fr) minmax(0, 1fr);
  gap: 6px;
  gap: var(--cubimat-gap, 6px);
  aspect-ratio: 4 / 1;
}

.cubimat-has-fixed-height .cubimat-banner-grid {
  aspect-ratio: auto;
  height: var(--cubimat-height);
}

.cubimat-slot {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 0;
  border-radius: var(--cubimat-radius, 0px);
  background-color: #f4f4f4;
}

/* Mosaic Slot Positions on Desktop */
.cubimat-slot-1 {
  grid-column: 1 / 2;
  grid-row: 1 / 3;
}

.cubimat-slot-2 {
  grid-column: 2 / 3;
  grid-row: 1 / 2;
}

.cubimat-slot-3 {
  grid-column: 3 / 4;
  grid-row: 1 / 2;
}

.cubimat-slot-4 {
  grid-column: 2 / 4;
  grid-row: 2 / 3;
}

.cubimat-banner-link {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 100%;
  text-decoration: none;
}

.cubimat-banner-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.35s ease, opacity 0.25s ease;
}

/* Hover Effects */
.cubimat-hover-zoom a.cubimat-banner-link:hover .cubimat-banner-img,
.cubimat-hover-zoom a.cubimat-banner-link:focus .cubimat-banner-img {
  transform: scale(1.025);
}

.cubimat-hover-fade a.cubimat-banner-link:hover .cubimat-banner-img,
.cubimat-hover-fade a.cubimat-banner-link:focus .cubimat-banner-img {
  opacity: 0.88;
}

/* Prev / Next Navigation Arrows */
.cubimat-carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
  color: #2b2b2b;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
  opacity: 0.72;
  transition: opacity 0.2s ease, background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
  padding: 0;
}

.cubimat-carousel-prev {
  left: 12px;
}

.cubimat-carousel-next {
  right: 12px;
}

.cubimat-carousel:hover .cubimat-carousel-arrow,
.cubimat-carousel-arrow:focus {
  opacity: 1;
}

.cubimat-carousel-arrow:hover {
  background: var(--cubimat-accent, #6ca42e);
  color: #ffffff;
  transform: translateY(-50%) scale(1.06);
}

/* Numbered Pagination (1, 2, 3 bottom-right style) */
.cubimat-pagination-numbers {
  position: absolute;
  bottom: 12px;
  right: 16px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
}

.cubimat-page-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: transparent;
  color: #333333;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.cubimat-page-btn:hover {
  color: var(--cubimat-accent, #6ca42e);
}

.cubimat-page-btn.is-active {
  border-color: var(--cubimat-accent, #6ca42e);
  color: #222222;
  background: #ffffff;
}

/* Dots Pagination (centered bottom) */
.cubimat-pagination-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.32);
}

.cubimat-dot-btn {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  padding: 0;
  transition: background-color 0.2s ease, width 0.2s ease;
}

.cubimat-dot-btn.is-active {
  width: 24px;
  border-radius: 999px;
  background: var(--cubimat-accent, #6ca42e);
}

@keyframes cubimatFadeIn {
  from {
    opacity: 0.2;
  }
  to {
    opacity: 1;
  }
}

/* Tablet layout (576px - 767px) */
@media (max-width: 767px) {
  /* Collapse inactive slides on mobile so single banners and 4-block mosaics never leave blank space */
  .cubimat-transition-slide .cubimat-carousel-track,
  .cubimat-transition-fade .cubimat-carousel-track {
    display: block;
    transform: none !important;
    transition: none;
  }

  .cubimat-transition-slide .cubimat-carousel-slide,
  .cubimat-transition-fade .cubimat-carousel-slide {
    display: none;
    opacity: 1;
    pointer-events: auto;
  }

  .cubimat-transition-slide .cubimat-carousel-slide.is-active,
  .cubimat-transition-fade .cubimat-carousel-slide.is-active {
    display: block;
    animation: cubimatFadeIn 0.35s ease;
  }

  .cubimat-banner-single,
  .cubimat-has-fixed-height .cubimat-banner-single {
    aspect-ratio: auto;
    height: auto;
  }

  .cubimat-banner-grid,
  .cubimat-has-fixed-height .cubimat-banner-grid {
    aspect-ratio: auto;
    height: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto;
  }

  .cubimat-slot-1 {
    grid-column: 1 / 3;
    grid-row: auto;
  }

  .cubimat-slot-2 {
    grid-column: 1 / 2;
    grid-row: auto;
  }

  .cubimat-slot-3 {
    grid-column: 2 / 3;
    grid-row: auto;
  }

  .cubimat-slot-4 {
    grid-column: 1 / 3;
    grid-row: auto;
  }

  .cubimat-banner-link {
    position: static;
    height: auto;
  }

  .cubimat-banner-img {
    height: auto;
  }

  .cubimat-slot-2 .cubimat-banner-link,
  .cubimat-slot-3 .cubimat-banner-link,
  .cubimat-slot-2 .cubimat-banner-img,
  .cubimat-slot-3 .cubimat-banner-img {
    height: 100%;
  }

  .cubimat-carousel-arrow {
    width: 32px;
    height: 32px;
    font-size: 14px;
    opacity: 0.85;
  }

  .cubimat-pagination-numbers {
    position: static;
    justify-content: center;
    margin-top: 8px;
    background: transparent;
    box-shadow: none;
  }

  .cubimat-pagination-dots {
    position: static;
    transform: none;
    justify-content: center;
    margin-top: 8px;
    background: transparent;
  }

  .cubimat-dot-btn {
    background: #cccccc;
  }
}

/* Mobile layout (< 576px): single column for full text legibility */
@media (max-width: 575px) {
  .cubimat-banner-grid,
  .cubimat-has-fixed-height .cubimat-banner-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .cubimat-slot-1,
  .cubimat-slot-2,
  .cubimat-slot-3,
  .cubimat-slot-4 {
    grid-column: 1 / 2;
    grid-row: auto;
  }

  .cubimat-slot-2 .cubimat-banner-link,
  .cubimat-slot-3 .cubimat-banner-link,
  .cubimat-slot-2 .cubimat-banner-img,
  .cubimat-slot-3 .cubimat-banner-img {
    height: auto;
  }
}
