/**
 * Stefan DS Reviews Plugin - Stylesheet v1.0.0
 */

/* =================================================================== */
/* --- Styles for Review Summary Link --- */
/* =================================================================== */

.sds-reviews-summary-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.sds-reviews-summary-link:hover {
  opacity: 0.8;
}
.sds-summary-stars {
  color: var(--divi-color-4);
  font-size: 28px;
}
.sds-summary-count {
  padding-top: 3px;
  font-size: 18px;
  color: var(--divi-color-8);
}

/* =================================================================== */
/* --- Styles for Review Display --- */
/* =================================================================== */
#reviews h3 {
  margin-bottom: 10px;
}
.stefan-ds-reviews-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .stefan-ds-reviews-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1024px) {
  .stefan-ds-reviews-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stefan-ds-review-item {
  border: 1px solid var(--divi-color-7);
  padding: 15px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  background-color: white;
  box-shadow: 0 0 12px 0 #0000000d;
}

.stefan-ds-review-header {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 15px;
  margin-bottom: 10px;
}

.sds-reviewer-avatar {
  flex-shrink: 0;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  overflow: hidden;
  background-color: #f0f0f1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sds-reviewer-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sds-reviewer-avatar-placeholder {
  width: 70%;
  height: 70%;
  color: #ccc;
}

.sds-reviewer-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stefan-ds-review-header h4 {
  padding: 0;
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.stefan-ds-star-rating-display {
  color: var(--divi-color-4);
  font-size: 18px;
  line-height: 1;
}

.stefan-ds-review-text {
  flex-grow: 1;
}

/* Remove default bottom margin from the last element (e.g., <p>) inside the text block */
.stefan-ds-review-text > :last-child {
  margin-bottom: 0;
}

/* Add space between the text and media ONLY if the media container follows the text */
.stefan-ds-review-text + .rg-container {
  margin-top: 15px;
}

.rg-container {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background-color: #000;
  touch-action: pan-y; /* Allow vertical scroll while capturing horizontal swipe */
}
@media (min-width: 768px) {
  .rg-container {
    cursor: pointer;
  }
}

.rg-media-list {
  display: flex;
  transition: transform 0.4s ease-in-out;
}

.rg-slide {
  flex: 0 0 100%;
  width: 100%;
}

.rg-slide img,
.rg-slide video {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  aspect-ratio: 16 / 9;
  pointer-events: none; /* Crucial: Allows click event to register on parent .rg-slide */
}

.rg-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background-color: rgba(0, 0, 0, 0.4);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  width: 44px;
  height: 44px;
  font-size: 24px;
  display: none;
  align-items: center;
  justify-content: center;
  transition:
    background-color 0.2s,
    opacity 0.2s;
  opacity: 0.7;
}
.rg-container:hover .rg-arrow {
  display: flex;
}
.rg-arrow:hover {
  background-color: rgba(0, 0, 0, 0.7);
  opacity: 1;
}
.rg-prev {
  left: 10px;
}
.rg-next {
  right: 10px;
}

.rg-dots-wrapper {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
  background: rgba(0, 0, 0, 0.3);
  padding: 5px 10px;
  border-radius: 10px;
}

.rg-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 1px solid #fff;
  background-color: transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.3s;
}
.rg-dot.active {
  background-color: #fff;
}

/* --- LIGHTBOX STYLES --- */
#sds-lightbox {
  display: none;
  place-content: center;
  position: fixed;
  z-index: 99999;
  inset: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  animation: sds-lightbox-fadein 0.3s ease;
}
#sds-lightbox.active {
  display: flex;
  justify-content: center;
  align-items: center;
}
@keyframes sds-lightbox-fadein {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

#sds-lightbox .sds-lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  justify-content: center;
  align-items: center;
}
#sds-lightbox img,
#sds-lightbox video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
}
#sds-lightbox video {
  width: 100%;
}

.sds-lightbox-close,
.sds-lightbox-nav {
  position: absolute;
  background-color: rgba(0, 0, 0, 0.3);
  color: white;
  border: none;
  cursor: pointer;
  z-index: 10000;
  transition: background-color 0.2s;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sds-lightbox-close:hover,
.sds-lightbox-nav:hover {
  background-color: rgba(0, 0, 0, 0.7);
}

.sds-lightbox-close {
  top: 15px;
  right: 15px;
  font-size: 30px;
  width: 44px;
  height: 44px;
  line-height: 44px;
}
.sds-lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  font-size: 30px;
  width: 50px;
  height: 50px;
}
.sds-lightbox-prev {
  left: 15px;
}
.sds-lightbox-next {
  right: 15px;
}

@media (max-width: 767px) {
  .sds-lightbox-nav {
    display: none;
  }
}

/* Mobile */
@media all and (max-width: 767px) {
  .sds-summary-stars {
    font-size: 22px;
  }
  .sds-summary-count {
    font-size: 14px;
  }
}
