/* ============================================================
   Shared project card styles – listing & favorites pages
   Loaded after page-specific SCSS so these values take priority.
   ============================================================ */

/* ══════════════════════════════════════════════════════════
   ALL SCREENS – counter badge + button colour (no size change)
   ══════════════════════════════════════════════════════════ */

/* Dark semi-transparent button colour on all screen sizes */
.property-image-section .img-nav-btn {
  background: rgba(0, 0, 0, 0.48);
  border: 1.5px solid rgba(255, 255, 255, 0.30);
  color: #fff;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.property-image-section .img-nav-btn:hover {
  background: rgba(0, 0, 0, 0.70);
  border-color: rgba(255, 255, 255, 0.60);
}

/* Counter badge */
.card-img-counter {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.52);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  font-family: "Work Sans", sans-serif;
  letter-spacing: 0.3px;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.22);
  z-index: 4;
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════
   DESKTOP ONLY (≥991px) – image size + button style changes
   ══════════════════════════════════════════════════════════ */
@media (min-width: 991px) {

  /* Wider image panel to match Figma */
  .property-image-section {
    width: 320px;
    height: auto;
  }

  /* Clickable cursor on image */
  .property-image.card-img-clickable {
    cursor: pointer;
  }

  /* Larger button size on desktop */
  .property-image-section .img-nav-btn {
    width: 40px;
    height: 40px;
  }

  .property-image-section .img-nav-btn i {
    font-size: 16px;
    line-height: 1;
  }

  /* Location text – higher character limit */
  .property-card .location-text {
    max-width: 60ch;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

}

/* ============================================================
   Full-screen gallery modal  (mirrors project_details.css)
   Uses #listingGalleryModal as root to avoid conflicts with
   the details-page #galleryModal on other pages.
   ============================================================ */

#listingGalleryModal.gallery-modal .modal-dialog {
  margin: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
}

#listingGalleryModal.gallery-modal .modal-content {
  background: #0b0b0b;
  border: 0;
  border-radius: 0;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  color: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#listingGalleryModal.gallery-modal {
  --bs-modal-zindex: 100000;
  --bs-modal-margin: 0;
  inset: 0;
  padding: 0 !important;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
}

#listingGalleryModal.gallery-modal + .modal-backdrop {
  z-index: 99999;
}

/* Topbar */
#listingGalleryModal .gallery-topbar {
  height: calc(54px + env(safe-area-inset-top));
  border-bottom: 1px solid #1f1f1f;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: env(safe-area-inset-top) 16px 0;
  background: #0a0a0a;
}

#listingGalleryModal .gallery-back {
  background: transparent;
  border: 1px solid #2a2a2a;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: grid;
  place-items: center;
}

#listingGalleryModal .gallery-back:hover {
  border-color: #08AF86;
  color: #08AF86;
}

#listingGalleryModal .gallery-top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

#listingGalleryModal .gallery-close {
  background: transparent;
  border: 1px solid #2a2a2a;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

#listingGalleryModal .gallery-close:hover {
  border-color: #08AF86;
  color: #08AF86;
}

/* Viewer */
#listingGalleryModal .gallery-viewer {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px 8px;
  min-height: 0;
}

#listingGalleryModal .gallery-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#listingGalleryModal .gallery-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  background: #000;
  transform-origin: center center;
}

/* Nav arrows inside modal */
#listingGalleryModal .gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid #222;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 10;
}

#listingGalleryModal .gallery-nav:hover {
  border-color: #08AF86;
  color: #08AF86;
}

#listingGalleryModal .gallery-nav.prev { left: 92px; z-index: 999; }
#listingGalleryModal .gallery-nav.next { right: 88px; }

/* Zoom controls */
#listingGalleryModal .gallery-controls {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

#listingGalleryModal .gallery-control {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid #222;
  background: #111;
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}

#listingGalleryModal .gallery-control:hover {
  border-color: #08AF86;
  color: #08AF86;
}

/* Thumbnail bar */
#listingGalleryModal .gallery-thumbs-bar {
  border-top: 1px solid #1f1f1f;
  background: #0f0f0f;
  padding: 8px 16px 36px 8px;
}

#listingGalleryModal .gallery-thumbs-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #cbd5e1;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

#listingGalleryModal .gallery-thumb-toggle {
  position: absolute;
  right: 0;
  border: 1px solid #2b2b2b;
  background: #111;
  color: #e5e7eb;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.85rem;
  cursor: pointer;
}

#listingGalleryModal .gallery-thumbs-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
  justify-content: center;
}

#listingGalleryModal .gallery-thumbs-track::-webkit-scrollbar { height: 6px; }
#listingGalleryModal .gallery-thumbs-track::-webkit-scrollbar-thumb {
  background: #2a2a2a;
  border-radius: 999px;
}

#listingGalleryModal .gallery-thumb {
  border: 2px solid transparent;
  padding: 0;
  background: transparent;
  border-radius: 6px;
  width: 120px;
  height: 72px;
  flex: 0 0 auto;
  opacity: 0.7;
  overflow: hidden;
  cursor: pointer;
}

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

#listingGalleryModal .gallery-thumb.active {
  border-color: #08AF86;
  opacity: 1;
}

#listingGalleryModal .gallery-thumbs-bar.is-hidden .gallery-thumbs-track {
  display: none;
}

/* Mobile adjustments */
@media (max-width: 767.98px) {
  #listingGalleryModal .gallery-thumbs-track { justify-content: flex-start; }

  #listingGalleryModal .gallery-topbar {
    height: calc(48px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 8px 0;
  }

  #listingGalleryModal #listingGalleryZoomIn,
  #listingGalleryModal #listingGalleryZoomOut,
  #listingGalleryModal #listingGalleryFullscreen,
  #listingGalleryModal .gallery-controls {
    display: none;
  }

  #listingGalleryModal .gallery-viewer { padding: 12px 12px 4px; }
  #listingGalleryModal .gallery-nav.prev { left: 7px; }
  #listingGalleryModal .gallery-nav.next { right: 7px; }
  #listingGalleryModal .gallery-thumb { width: 92px; height: 54px; }
}
