/* Gallery: truly fullscreen, 80% transparent overlay, no extra dark panels */

#imagesGalleryModal.modal {
  padding: 0;
}

#imagesGalleryModal .modal-dialog,
.listing-gallery-modal .modal-dialog {
  margin: 0;
  max-width: none;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
}

#imagesGalleryModal .modal-content,
.listing-gallery-modal .modal-content {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
  border: none;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
}

/* Top bar: compact, transparent over the overlay */
.listing-gallery-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px 8px 12px;
  min-height: 48px;
  background: transparent;
  z-index: 10;
}

.listing-gallery-counter-top {
  flex-shrink: 0;
  font-size: 15px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.95);
}

.listing-gallery-title-block {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  justify-content: center;
  padding: 0 8px;
}

.listing-gallery-price {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-primary, #0d8f0d);
  white-space: nowrap;
}

.listing-gallery-title {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.listing-gallery-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.listing-gallery-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  background: var(--color-primary, #0d8f0d);
  white-space: nowrap;
  transition: opacity 0.2s, filter 0.2s;
}

.listing-gallery-btn:hover:not(:disabled) {
  opacity: 0.95;
  filter: brightness(1.05);
}

.listing-gallery-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.listing-gallery-btn-call,
.listing-gallery-btn-chat {
  background: var(--color-primary, #0d8f0d);
}

.listing-gallery-btn-wishlist {
  padding: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
}

.listing-gallery-btn-wishlist:hover {
  color: #fff;
}

.listing-gallery-close {
  padding: 10px;
  opacity: 0.9;
  filter: invert(1);
}

.listing-gallery-close:hover {
  opacity: 1;
}

/* Body: vertical thumbs (start) + main carousel – take all remaining space */
.listing-gallery-body {
  flex: 1 1 0%;
  min-height: 0;
  display: flex;
  flex-direction: row;
  overflow: hidden;
}

[dir="rtl"] .listing-gallery-body {
  flex-direction: row-reverse;
}

/* Vertical thumbnail strip – left in LTR, right in RTL, no darker panel */
.listing-gallery-thumbs-vertical {
  flex-shrink: 0;
  width: 72px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  background: transparent;
  -webkit-overflow-scrolling: touch;
}

.listing-gallery-thumbs-vertical::-webkit-scrollbar {
  width: 4px;
}

.listing-gallery-thumbs-vertical::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
}

.listing-gallery-thumbs-vertical::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
}

.listing-gallery-thumb {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  background: #2a2a2a;
  cursor: pointer;
  transition: border-color 0.2s, opacity 0.2s;
}

.listing-gallery-thumb:hover {
  opacity: 0.95;
}

.listing-gallery-thumb.active {
  border-color: var(--color-primary, #0d8f0d);
  box-shadow: 0 0 0 1px var(--color-primary, #0d8f0d);
}

.listing-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.listing-gallery-thumb .listing-gallery-thumb-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.listing-gallery-thumb .listing-gallery-thumb-inner {
  position: relative;
  width: 100%;
  height: 100%;
}

/* Main carousel area – fills all space between header and bottom */
.listing-gallery-carousel-wrap {
  flex: 1 1 0%;
  min-width: 0;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pan-y pinch-zoom;
}

.listing-gallery-viewport {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
}

.listing-gallery-track {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

.listing-gallery-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 48px;
  box-sizing: border-box;
}

/* Full image visible, no cropping – contain within slide */
.listing-gallery-slide img,
.listing-gallery-slide video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center;
  border-radius: 4px;
}

.listing-gallery-slide video {
  background: #000;
}

.listing-gallery-prev,
.listing-gallery-next {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 48px;
  min-width: 48px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  transition: background 0.2s, color 0.2s;
}

.listing-gallery-prev:hover,
.listing-gallery-next:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.listing-gallery-prev {
  left: 0;
}

.listing-gallery-next {
  right: 0;
}

[dir="rtl"] .listing-gallery-prev {
  left: auto;
  right: 0;
}

[dir="rtl"] .listing-gallery-next {
  right: auto;
  left: 0;
}

.listing-gallery-prev i,
.listing-gallery-next i {
  font-size: 28px;
  width: 28px;
  height: 28px;
}

/* Single item: hide arrows, keep thumbs for consistency */
.listing-gallery-modal-content.gallery-single .listing-gallery-prev,
.listing-gallery-modal-content.gallery-single .listing-gallery-next {
  display: none;
}

/* Legacy modal (if used elsewhere) */
.modal-content:not(.listing-gallery-modal-content) {
  margin: 0;
  border: none;
  border-radius: 0;
  height: 100vh;
}

.modal-body {
  padding: 0;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

#modalImage {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#gestureZone {
  cursor: grab;
}
