/*
 * Horizontal Slider Styles (Cleaned for Splide)
 */

/* Ensure the slider stays within the container and does not overflow the viewport */
.horizontal-slider,
.splide {
  max-width: 100%;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.splide__track {
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

.splide__list {
  display: flex;
  padding: 0;
  margin: 0;
  list-style: none;
  max-width: 100%;
  box-sizing: border-box;
}

.splide__slide {
  flex: 0 0 auto;
  min-width: 0;
  height: auto;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  max-width: 100%;
}

/* Slide content styling */
.horizontal-slider .splide__slide > * {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* .horizontal-slider .splide__slide .wp-block-group {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
} */

.horizontal-slider .splide__slide .wp-block-image img {
  height: 100%;
  width: 100%;
  object-fit: cover;
}

.horizontal-slider .splide__slide h3 {
  margin-top: 0 !important;
  margin-bottom: 1rem !important;
}

.horizontal-slider .splide__slide p {
  margin-bottom: 1.5rem !important;
}

/* Card layout */
.slide-item.is-style-card {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}
.slide-item.is-style-card:hover {
  transform: translateY(-5px);
}

/* Custom arrows */
/* .splide__arrows {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2rem;
} */
.splide__arrow {
  background: transparent;
  backdrop-filter: blur(1px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  width: calc(2rem + 1vw);
  height: calc(2rem + 1vw);
}
.splide__arrow:hover {
  backdrop-filter: blur(5px);
  color: #fff;
}
.splide__arrow svg {
  width: calc(0.5rem + 1vw);
  height: calc(0.5rem + 1vw);
  fill: white;
}
.splide__arrow--prev {
  left: 0.25em;
}
.splide__arrow--next {
  right: 0.25em;
}
/* Pagination */
.splide__pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 1.5rem;
  padding: 8px 0;
  position: relative;
  z-index: 10;
}
.splide__pagination__page {
  width: 8px;
  height: 8px;
  background: var(--wp--preset--color--off-black);
  border-radius: 50%;
  border: none;
  opacity: 0.5;
  transition: opacity 0.2s ease;
  cursor: pointer;
  padding: 0;
  margin: 0 5px;
}
.splide__pagination__page.is-active {
  opacity: 1;
  background: var(--wp--preset--color--off-black);
  transform: scale(1.2);
}

/* Editor-only styles (keep these!) */
body.is-editor .horizontal-slider,
.editor-styles-wrapper .horizontal-slider,
.editor-styles-wrapper .wp-block-group.horizontal-slider {
  position: relative;
  border: 1px dashed rgba(0, 0, 0, 0.2);
  padding: 20px !important;
  margin-bottom: 40px !important;
  background: rgba(0, 0, 0, 0.02);
}
body.is-editor .horizontal-slider::before,
.editor-styles-wrapper .horizontal-slider::before {
  content: "Horizontal Slider";
  position: absolute;
  top: -12px;
  left: 20px;
  background: #fff;
  padding: 0 8px;
  font-size: 12px;
  color: #757575;
  z-index: 1;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}
body.is-editor .splide__slide,
.editor-styles-wrapper .splide__slide {
  flex: 0 0 33.333% !important;
  max-width: 33.333% !important;
  min-width: 250px !important;
  border: 1px solid rgba(0, 0, 0, 0.1);
  margin-block-start: 0 !important;
  margin-top: 0 !important;
  position: relative;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  padding: 0 !important;
  min-height: 200px !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
}
body.is-editor .splide__slide > *,
.editor-styles-wrapper .splide__slide > * {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
}
body.is-editor .splide__slide .slide-item,
.editor-styles-wrapper .splide__slide .slide-item,
body.is-editor .splide__slide .wp-block-group,
.editor-styles-wrapper .splide__slide .wp-block-group {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
}
body.is-editor .splide__slide::before,
.editor-styles-wrapper .splide__slide::before {
  content: "Slide";
  position: absolute;
  top: -8px;
  left: 10px;
  background: #fff;
  padding: 0 6px;
  font-size: 10px;
  color: #757575;
  z-index: 1;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}
body.is-editor .splide__slide.is-selected,
.editor-styles-wrapper .splide__slide.is-selected {
  box-shadow: 0 0 0 2px #4a5568;
  z-index: 10;
}
body.is-editor .splide__slide:focus-within,
.editor-styles-wrapper .splide__slide:focus-within {
  outline: 2px solid #4a5568;
  z-index: 1;
}
body.is-editor .splide.is-active .splide__slide:hover,
.editor-styles-wrapper .splide.is-active .splide__slide:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Editor-only: Make slider appear as a row in the block editor, matching frontend */
body.is-editor .splide__list,
.editor-styles-wrapper .splide__list {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 2rem !important;
  padding: 0 !important;
  margin: 0 !important;
  max-width: 100% !important;
  overflow-x: visible !important;
}

body.is-editor .splide__slide,
.editor-styles-wrapper .splide__slide {
  flex: 0 0 33.333% !important;
  max-width: 33.333% !important;
  min-width: 250px !important;
  box-sizing: border-box;
  margin: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Responsive adjustments for editor preview */
@media (max-width: 900px) {
  body.is-editor .splide__slide,
  .editor-styles-wrapper .splide__slide {
    max-width: 240px !important;
    flex: 0 0 240px !important;
  }
}
@media (max-width: 600px) {
  body.is-editor .splide__slide,
  .editor-styles-wrapper .splide__slide {
    max-width: 80vw !important;
    flex: 0 0 80vw !important;
    min-width: 220px !important;
  }
}
