/* Fixed Buttons */
#lylrv-open-reviews-button,
#lylrv-open-button {
  position: fixed !important;
  z-index: 100 !important;
  box-sizing: border-box !important;
  padding: 0.5rem !important;
  border-radius: 16px !important;
  cursor: pointer !important;
  height: 2.5rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  column-gap: 0.5rem !important;
  direction: initial !important;
}

#lylrv-open-reviews-button {
  bottom: 50% !important;
  flex-direction: column !important;
  /* right: 0.75rem !important; */
  /* padding: 0.5rem 1.1rem !important; */
  height: auto !important;
  left: 0rem !important;
  /* transform: rotate(90deg) !important; */
  border-radius: 0 16px 16px 0px !important;
  border-color: transparent !important;
}

#lylrv-open-reviews-button-avg-rating {
  font-size: 1rem !important;
  font-weight: bold !important;
}
#lylrv-open-reviews-button-total-reviews {
  font-size: 0.8rem !important;
  font-weight: bold !important;
}

#lylrv-open-button {
  bottom: 4.5rem !important;
  left: 0.75rem !important;
  padding: 0.5rem 1.1rem !important;
  border-radius: 50px !important;
  column-gap: 0.1rem !important;
}

#lylrv-open-reviews-button-icon,
#lylrv-open-button-icon {
  font-size: 0.8rem !important;
}

/* Dialog Styles */
.lylrv-dialog {
  z-index: 100002;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  padding: 0;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  width: 100%;
  height: 100vh;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
}

.lylrv-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

#lylrv-dialog-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

/* Image Grid */
.lylrv-dialog-images {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  width: 100%;
  margin: auto;
  max-width: 60%;
}

.lylrv-dialog-images:has(> :nth-child(1):last-child) {
  grid-template-columns: repeat(1, 1fr);
}

.lylrv-dialog-images:has(> :nth-child(2):last-child) {
  grid-template-columns: repeat(2, 1fr);
}

.lylrv-dialog-images img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 0.5rem;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.lylrv-dialog-images img:hover {
  transform: scale(1.02);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
}

/* Single Image View */
#lylrv-single-image-view {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  max-height: 70vh;
}

#lylrv-current-image {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Controls */
.lylrv-controls {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 0.75rem;
}

.lylrv-dialog-close,
.lylrv-back-button {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: #111827;
  font-size: 1.25rem;
  cursor: pointer;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
}

.lylrv-dialog-close:hover,
.lylrv-back-button:hover {
  background-color: #f3f4f6;
}

/* Pagination */
.lylrv-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.lylrv-nav-button {
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  color: #374151;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.lylrv-nav-button:hover {
  background-color: #f3f4f6;
}

.lylrv-nav-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#lylrv-page-indicator {
  font-size: 0.875rem;
  color: #4b5563;
}

/* Thumbnails */
.lylrv-thumbnails {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.5rem 0;
  scrollbar-width: thin;
}

.lylrv-thumbnails img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 0.25rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s ease;
}

.lylrv-thumbnails img.active {
  border-color: #3b82f6;
}

/* Button Text */
#lylrv-open-button-text {
  font-size: 1rem !important;
  font-weight: bold !important;
}

/* Mobile Responsive */
@media only screen and (max-width: 768px) {
  #lylrv-open-button-text,
  #lylrv-open-reviews-button-text {
    display: none;
  }

  #lylrv-open-button {
    column-gap: 0 !important;
    padding: 0.5rem !important;
    height: 50px !important;
    width: 50px !important;
  }
  #lylrv-open-reviews-button {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    grid-template-rows: auto auto !important;
    column-gap: 0rem !important;
    row-gap: 0rem !important;
    padding: 0.25rem !important;
    height: auto !important;
    width: auto !important;
  }

  #lylrv-open-reviews-button > :nth-child(1) {
    grid-row: 1 !important;
    grid-column: 2 !important;
  }

  #lylrv-open-reviews-button > :nth-child(2) {
    grid-row: 1 !important;
    grid-column: 1 !important;
  }

  #lylrv-open-reviews-button > :nth-child(3) {
    grid-row: 2 !important;
    grid-column: 1 / span 2 !important;
    width: 100% !important;
    text-align: center !important;
    font-size: clamp(0.6rem, 4vw, 0.8rem) !important;
  }

  #lylrv-open-button {
    border-radius: 50% !important;
  }

  #lylrv-open-button-icon,
  #lylrv-open-reviews-button-icon {
    margin: 0 auto !important;
  }
  #lylrv-open-button-icon {
    font-size: 1.75rem !important;
  }
  #lylrv-open-reviews-button-icon {
    font-size: 1rem !important;
    /* width: 1.25rem !important; */

    height: 1rem !important;
  }

  .lylrv-dialog-content {
    max-width: 95%;
    padding: 1rem;
  }

  .lylrv-dialog-images {
    grid-template-columns: repeat(3, 1fr);
    max-width: 80%;
  }

  .lylrv-nav-button {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
  }

  .lylrv-thumbnails img {
    width: 50px;
    height: 50px;
  }

  .lylrv-dialog-close,
  .lylrv-back-button {
    width: 2rem;
    height: 2rem;
    font-size: 1rem;
  }
}
