/* ============================================
   Lemon Content Carousel - Updated with Peek Support
   ============================================ */

.lemon-content-carousel {
  position: relative;
  width: 100%;
  overflow: hidden; /* Main container clips overflow */
}

/* ============================================
   SWIPER CONTAINER - CRITICAL FOR PEEK
   ============================================ */

.lemon-carousel-swiper {
  width: 100%;
  overflow: visible !important; /* CRITICAL: Allow peek slides to show */
  position: relative;
}

.lemon-carousel-swiper .swiper-wrapper {
  /* Wrapper handles alignment */
  transition-timing-function: ease-out;
}

/* ============================================
   SLIDES
   ============================================ */

.swiper-slide {
  height: auto;
  display: flex;
  transition: opacity 0.3s ease;
}

/* Slide inner */
.lemon-slide-inner {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: box-shadow 0.3s ease, opacity 0.3s ease;
  will-change: opacity;
}

/* Hover effect - only shadow, no transform */
.lemon-slide-inner:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Active slide (fully visible) */
.swiper-slide-active .lemon-slide-inner {
  opacity: 1;
}

/* Previous and next slides (peek states) - controlled by Elementor */
.swiper-slide-prev .lemon-slide-inner,
.swiper-slide-next .lemon-slide-inner {
  /* Opacity controlled via PHP selector */
  /* Default if not set by user */
  opacity: 0.6;
}

/* ============================================
   SLIDE CONTENT
   ============================================ */

.lemon-slide-image {
  width: 100%;
  overflow: hidden;
  position: relative;
}

.lemon-slide-image img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.lemon-slide-content {
  padding: 1rem;
  flex: 1;
}

.lemon-slide-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  line-height: 1.3;
}

.lemon-slide-subtitle {
  font-size: 0.875rem;
  opacity: 0.8;
  margin: 0;
  line-height: 1.4;
}

/* ============================================
   NAVIGATION ARROWS
   ============================================ */

.lemon-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
  user-select: none;
  flex-shrink: 0;
}

.lemon-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.lemon-arrow:not(:disabled):hover {
  transform: scale(1.1);
}

.lemon-arrow svg,
.lemon-arrow i {
  pointer-events: none;
}

/* ============================================
   ARROWS POSITIONING - GROUPED
   ============================================ */

.lemon-arrows-group {
  display: flex;
  align-items: center;
  position: absolute;
  z-index: 10;
}

.lemon-arrows-top-left {
  top: 0;
  left: 0;
}

.lemon-arrows-top-right {
  top: 0;
  right: 0;
}

.lemon-arrows-bottom-left {
  bottom: 0;
  left: 0;
}

.lemon-arrows-bottom-right {
  bottom: 0;
  right: 0;
}

/* Margin adjustments for grouped arrows */
.lemon-content-carousel[data-arrows-position="top-left"] .lemon-carousel-swiper,
.lemon-content-carousel[data-arrows-position="top-right"] .lemon-carousel-swiper {
  margin-top: 60px;
}

.lemon-content-carousel[data-arrows-position="bottom-left"] .lemon-carousel-swiper,
.lemon-content-carousel[data-arrows-position="bottom-right"] .lemon-carousel-swiper {
  margin-bottom: 60px;
}

/* ============================================
   ARROWS POSITIONING - SIDES
   ============================================ */

.lemon-arrows-sides {
  position: relative;
  pointer-events: none; /* Allow clicks through */
}

.lemon-arrows-sides .lemon-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: auto; /* Re-enable clicks on arrows */
}

/* Default positions (overridden by Elementor controls) */
.lemon-arrows-sides .lemon-arrow-prev {
  left: 20px;
}

.lemon-arrows-sides .lemon-arrow-next {
  right: 20px;
}

/* Hover maintains vertical centering */
.lemon-arrows-sides .lemon-arrow:not(:disabled):hover {
  transform: translateY(-50%) scale(1.1);
}

/* ============================================
   CAROUSEL STATE CLASSES
   ============================================ */

/* When carousel is at the start */
.lemon-content-carousel.at-start {
  /* Optional: Add specific styling when at start */
}

/* When carousel is at the end */
.lemon-content-carousel.at-end {
  /* Optional: Add specific styling when at end */
}

/* ============================================
   RESPONSIVE BEHAVIOR
   ============================================ */

@media (max-width: 768px) {
  /* Force arrows inside on mobile for sides layout */
  .lemon-arrows-sides .lemon-arrow-prev {
    left: 10px !important;
  }
  
  .lemon-arrows-sides .lemon-arrow-next {
    right: 10px !important;
  }
  
  /* Reduce margins on mobile */
  .lemon-content-carousel[data-arrows-position="top-left"] .lemon-carousel-swiper,
  .lemon-content-carousel[data-arrows-position="top-right"] .lemon-carousel-swiper {
    margin-top: 50px;
  }
  
  .lemon-content-carousel[data-arrows-position="bottom-left"] .lemon-carousel-swiper,
  .lemon-content-carousel[data-arrows-position="bottom-right"] .lemon-carousel-swiper {
    margin-bottom: 50px;
  }
}

@media (max-width: 480px) {
  /* Further adjustments for very small screens */
  .lemon-slide-title {
    font-size: 1rem;
  }
  
  .lemon-slide-subtitle {
    font-size: 0.75rem;
  }
  
  .lemon-slide-content {
    padding: 0.75rem;
  }
}

/* ============================================
   SWIPER INTEGRATION
   ============================================ */

.lemon-arrow.swiper-button-disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* ============================================
   INITIALIZATION STATES
   ============================================ */

.lemon-carousel-swiper:not(.swiper-initialized) {
  opacity: 0.7;
}

.lemon-carousel-swiper.swiper-initialized {
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* ============================================
   DRAG STATE
   ============================================ */

.lemon-carousel-swiper.swiper-container-dragging .lemon-slide-inner {
  user-select: none;
  cursor: grabbing;
}

.lemon-carousel-swiper .lemon-slide-inner {
  cursor: grab;
}

.lemon-carousel-swiper .lemon-slide-inner:active {
  cursor: grabbing;
}

/* Remove cursor styles if slides have links */
.lemon-carousel-swiper .lemon-slide-inner[href] {
  cursor: pointer;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.lemon-arrow:focus {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.lemon-arrow:focus:not(:focus-visible) {
  outline: none;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .lemon-carousel-swiper .swiper-wrapper,
  .lemon-slide-inner,
  .lemon-arrow {
    transition-duration: 0.01ms !important;
  }
}

/* ============================================
   UTILITIES
   ============================================ */

/* Prevent layout shift during load */
.lemon-carousel-swiper {
  min-height: 200px; /* Adjust based on content */
}

/* Clear floats if needed */
.lemon-content-carousel::after {
  content: "";
  display: table;
  clear: both;
}

/* ============================================
   RTL SUPPORT
   ============================================ */

.rtl .lemon-arrows-sides .lemon-arrow-prev {
  left: auto;
  right: 20px;
}

.rtl .lemon-arrows-sides .lemon-arrow-next {
  right: auto;
  left: 20px;
}

@media (max-width: 768px) {
  .rtl .lemon-arrows-sides .lemon-arrow-prev {
    left: auto !important;
    right: 10px !important;
  }
  
  .rtl .lemon-arrows-sides .lemon-arrow-next {
    right: auto !important;
    left: 10px !important;
  }
}