/* RideEase Portal Car Image Viewer V1 */

/* Keep every portal vehicle photo fully visible regardless of aspect ratio. */
.cargal.re-portal-fit-gallery,
.re-portal-fit-gallery {
  background:
    radial-gradient(
      circle at center,
      rgba(148, 163, 184, .10),
      transparent 72%
    ),
    var(--bg3) !important;
}

.cargal.re-portal-fit-gallery > img,
.cargal.re-portal-fit-gallery .cargal-track > img {
  object-fit: contain !important;
  object-position: center center !important;
  padding: 6px !important;
  background: transparent !important;
}

/* Keep fleet cards compact while still showing the entire vehicle. */
.car-card .cargal.re-portal-fit-gallery > img,
.car-card .cargal.re-portal-fit-gallery .cargal-track > img {
  padding: 4px !important;
}

/* Give the selected vehicle a larger responsive preview. */
#selectedCarSummary .cargal.re-portal-selected-gallery {
  height: clamp(230px, 38vw, 340px) !important;
  min-height: 230px !important;
  cursor: zoom-in;
  border: 1px solid var(--border);
  border-radius: 10px !important;
}

#selectedCarSummary
  .cargal.re-portal-selected-gallery
  .cargal-track {
  height: 100% !important;
}

#selectedCarSummary
  .cargal.re-portal-selected-gallery
  > img,
#selectedCarSummary
  .cargal.re-portal-selected-gallery
  .cargal-track
  > img {
  height: 100% !important;
  min-height: 100% !important;
  padding: 10px !important;
  cursor: zoom-in;
}

.re-portal-gallery-expand {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  background: rgba(15, 23, 42, .78);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: 0 5px 18px rgba(0, 0, 0, .20);
}

.re-portal-gallery-expand:hover,
.re-portal-gallery-expand:focus-visible {
  background: rgba(37, 99, 235, .92);
  outline: none;
}

/* Large portal viewer. */
body.re-portal-lightbox-open {
  overflow: hidden !important;
}

.re-portal-lightbox[hidden] {
  display: none !important;
}

.re-portal-lightbox {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
}

.re-portal-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, .88);
  backdrop-filter: blur(9px);
}

.re-portal-lightbox-dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(1080px, calc(100vw - 44px));
  max-height: calc(100vh - 44px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg2);
  box-shadow: 0 25px 80px rgba(0, 0, 0, .46);
}

.re-portal-lightbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.re-portal-lightbox-header span {
  display: block;
  margin-bottom: 3px;
  color: var(--blue);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .11em;
}

.re-portal-lightbox-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
}

.re-portal-lightbox-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg3);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.re-portal-lightbox-close:hover,
.re-portal-lightbox-close:focus-visible {
  border-color: var(--red);
  color: var(--red);
  outline: none;
}

.re-portal-lightbox-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  height: min(66vh, 650px);
  padding: 18px 64px;
  overflow: hidden;
  background:
    radial-gradient(
      circle at center,
      rgba(148, 163, 184, .10),
      transparent 70%
    ),
    var(--bg);
}

.re-portal-lightbox-image {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center center;
  user-select: none;
  touch-action: pan-y;
}

.re-portal-lightbox-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 50%;
  background: rgba(15, 23, 42, .72);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(7px);
}

.re-portal-lightbox-nav:hover,
.re-portal-lightbox-nav:focus-visible {
  background: rgba(37, 99, 235, .90);
  outline: none;
}

.re-portal-lightbox-nav.prev {
  left: 14px;
}

.re-portal-lightbox-nav.next {
  right: 14px;
}

.re-portal-lightbox-count {
  position: absolute;
  right: 14px;
  bottom: 12px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .74);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  pointer-events: none;
}

.re-portal-lightbox-thumbs {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 82px;
  padding: 10px 14px;
  overflow-x: auto;
  overflow-y: hidden;
  border-top: 1px solid var(--border);
  scrollbar-width: thin;
}

.re-portal-lightbox-thumb {
  flex: 0 0 82px;
  width: 82px;
  height: 60px;
  padding: 0;
  overflow: hidden;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--bg3);
  cursor: pointer;
  opacity: .72;
}

.re-portal-lightbox-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

.re-portal-lightbox-thumb:hover,
.re-portal-lightbox-thumb:focus-visible,
.re-portal-lightbox-thumb.active {
  border-color: var(--blue);
  opacity: 1;
  outline: none;
}

.re-portal-lightbox-thumb.active {
  box-shadow: 0 0 0 2px rgba(59, 130, 246, .20);
}

.re-portal-lightbox-help {
  margin: 0;
  padding: 0 14px 12px;
  color: var(--text3);
  font-size: 10px;
  text-align: center;
}

@media (max-width: 620px) {
  #selectedCarSummary .cargal.re-portal-selected-gallery {
    height: clamp(210px, 58vw, 280px) !important;
    min-height: 210px !important;
  }

  .re-portal-lightbox {
    align-items: flex-start;
    padding: 10px;
  }

  .re-portal-lightbox-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    border-radius: 13px;
  }

  .re-portal-lightbox-stage {
    min-height: 250px;
    height: min(58vh, 480px);
    padding: 12px 42px;
  }

  .re-portal-lightbox-nav {
    width: 34px;
    height: 34px;
    font-size: 25px;
  }

  .re-portal-lightbox-nav.prev {
    left: 6px;
  }

  .re-portal-lightbox-nav.next {
    right: 6px;
  }

  .re-portal-lightbox-thumb {
    flex-basis: 68px;
    width: 68px;
    height: 52px;
  }

  .re-portal-gallery-expand span:last-child {
    display: none;
  }

  .re-portal-gallery-expand {
    width: 34px;
    height: 34px;
    justify-content: center;
    padding: 0;
  }
}
