/* Copyright 2025 Renofy Ltd. All rights reserved. */
/* Swiper Carousel Component Styles */

/* Container base styles */
.swiper-carousel {
  width: 100%;
  position: relative;
}

.swiper-carousel .swiper {
  width: 100%;
  height: 100%;
}

/* Aspect Ratios */
.swiper-carousel--landscape .swiper {
  aspect-ratio: 4 / 3;
}

.swiper-carousel--square .swiper {
  aspect-ratio: 1 / 1;
}

/* Border Radius */
.swiper-carousel--rounded .swiper {
  border-radius: var(--radius-lg, 12px);
  overflow: hidden;
}

.swiper-carousel--none .swiper {
  border-radius: 0;
  overflow: hidden;
}

/* Image styles */
.swiper-carousel .swiper-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Placeholder styles */
.swiper-carousel__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-border);
  color: var(--color-text-secondary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  text-align: center;
}

/* PhotoSwipe Integration Styles */
.swiper-photoswipe-enabled .swiper-slide img {
  cursor: pointer;
  transition: opacity var(--transition-smooth), transform var(--transition-smooth);
}

.swiper-photoswipe-enabled .swiper-slide img:hover {
  opacity: 0.9;
}

/* Add subtle scale effect on hover for desktop only */
@media (min-width: 821px) {
  .swiper-photoswipe-enabled .swiper-slide img:hover {
    transform: scale(1.02);
  }
}

/* Disabled PhotoSwipe carousels - no hover effects, but keep pointer cursor */
.swiper-carousel[data-photoswipe-disabled] .swiper-slide img {
  cursor: pointer;
  transition: none;
}

.swiper-carousel[data-photoswipe-disabled] .swiper-slide img:hover {
  opacity: 1;
  transform: none;
}

/* Fraction counter - top right */
.swiper-carousel .swiper-pagination-fraction {
  position: absolute;
  top: 10px;
  right: 10px;
  width: auto;
  height: auto;
  left: auto;
  bottom: auto;
  background: rgba(0, 0, 0, 0.5);
  color: #ffffff;
  font-size: var(--font-size-xs);
  padding: 2px 8px;
  border-radius: 12px;
  z-index: 10;
}

/* Bullets sizes and color */
.swiper-carousel .swiper-pagination-bullet {
  width: 7px;
  height: 7px;
  background-color: black;
  opacity: 0.6;
  transition: background-color var(--transition-smooth);
}

.swiper-carousel .swiper-pagination-bullet-active {
  background-color: white;
  opacity: 0.9;
}

/* Hide controls when only one slide */
.swiper-single-slide .swiper-pagination,
.swiper-single-slide .swiper-button-prev,
.swiper-single-slide .swiper-button-next {
  display: none !important;
}

/* Mobile: Show pagination, hide navigation */
@media (max-width: 820px) {
  /* Fraction counter - top right */
  .swiper-carousel .swiper-pagination-fraction {
    font-weight: var(--font-weight-semibold);
  }

  .swiper-carousel .swiper-button-prev,
  .swiper-carousel .swiper-button-next {
    display: none;
  }

  .swiper-carousel .swiper-pagination {
    display: block;
  }
}

/* Desktop: Show navigation, hide pagination */
@media (min-width: 821px) {
  .swiper-carousel .swiper-pagination {
    display: none;
  }

  .swiper-carousel .swiper-button-prev,
  .swiper-carousel .swiper-button-next {
    display: flex;
    color: #ffffff;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    /* Vertical centering: Override Swiper's default margin-top and use transform instead */
    top: 50%;
    margin-top: 0; /* Reset Swiper's default negative margin which interferes with our centering */
    transform: translateY(-50%);
  }

  .swiper-carousel .swiper-button-prev::after,
  .swiper-carousel .swiper-button-next::after {
    font-size: 14px;
    line-height: 0;
    font-weight: var(--font-weight-bold);
  }

  /* Desktop-only border radius variant */
  .swiper-carousel--rounded-desktop .swiper {
    border-radius: 0;
  }

  @media (min-width: 821px) {
    .swiper-carousel--rounded-desktop .swiper {
      border-radius: var(--radius-lg, 12px);
    }
  }
}

/* PhotoSwipe Theme Customization */
.pswp {
  --pswp-bg: rgba(0, 0, 0, 0.9);
  --pswp-placeholder-bg: rgba(0, 0, 0, 0.3);
  --pswp-icon-color: #ffffff;
  --pswp-icon-color-secondary: rgba(255, 255, 255, 0.7);
}

/* Ensure PhotoSwipe buttons are visible and accessible */
.pswp__button {
  cursor: pointer;
  transition: opacity var(--transition-smooth);
}

.pswp__button:hover {
  opacity: 0.8;
}

/* Desktop-only border radius for PhotoSwipe images */
@media (min-width: 821px) {
  .pswp__img {
    border-radius: var(--radius-lg);
  }
}
