/* ============================================================
   ProductLightbox — overlay styles
   All styles live here so Tailwind JIT doesn't need to scan
   dynamically injected DOM nodes.
   ============================================================ */

/* --- Overlay backdrop ---------------------------------------- */
#lb-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
#lb-overlay.lb-open {
  opacity: 1;
  visibility: visible;
}
#lb-overlay:focus {
  outline: none;
}

/* --- Container (toolbar + stage) ----------------------------- */
#lb-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0; /* required for flex children to shrink correctly */
}

/* --- Toolbar ------------------------------------------------- */
#lb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 1rem;
  color: #fff;
  font-size: 0.875rem;
  flex-shrink: 0;
  gap: 0.5rem;
}
#lb-counter {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.8125rem;
  white-space: nowrap;
  min-width: 3.5rem;
}
#lb-caption {
  flex: 1;
  text-align: center;
  padding: 0 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.85);
}
#lb-toolbar-actions {
  display: flex;
  gap: 0.375rem;
  flex-shrink: 0;
}
#lb-toolbar-actions button {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  padding: 0;
}
#lb-toolbar-actions button:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* --- Stage --------------------------------------------------- */
#lb-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

#lb-stage-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

#lb-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
  transition: transform 0.15s ease;
  transform-origin: center center;
}
#lb-stage img.lb-zoomed {
  cursor: grab;
  transition: none; /* disable transition while dragging/panning */
}
#lb-stage img.lb-dragging {
  cursor: grabbing;
}

#lb-stage iframe {
  width: min(90vw, 1280px);
  height: min(75vh, 720px);
  border: none;
  display: block;
}

/* --- Prev / Next buttons ------------------------------------- */
#lb-prev,
#lb-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  padding: 0;
  flex-shrink: 0;
}
#lb-prev {
  left: 0.75rem;
}
#lb-next {
  right: 0.75rem;
}
#lb-prev:hover,
#lb-next:hover {
  background: rgba(255, 255, 255, 0.3);
}
#lb-prev.lb-hidden,
#lb-next.lb-hidden {
  display: none;
}

/* --- Thumbnail strip ----------------------------------------- */
#lb-thumbs-wrap {
  flex-shrink: 0;
  padding: 0.625rem 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}
#lb-thumbs-wrap::-webkit-scrollbar {
  height: 4px;
}
#lb-thumbs-wrap::-webkit-scrollbar-track {
  background: transparent;
}
#lb-thumbs-wrap::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
}

#lb-thumbs {
  display: flex;
  gap: 0.5rem;
  width: max-content;
}

.lb-thumb {
  width: 4rem;
  height: 4rem;
  border-radius: 0.5rem;
  border: 2px solid rgba(255, 255, 255, 0.2);
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s ease;
  background: rgba(255, 255, 255, 0.05);
}
.lb-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.25rem;
  display: block;
}
.lb-thumb:hover {
  border-color: rgba(255, 255, 255, 0.55);
}
.lb-thumb.active {
  border-color: #ff0000; /* --color-brand */
}

/* Video thumb overlay — play icon badge */
.lb-thumb.lb-thumb-video {
  position: relative;
}
.lb-thumb.lb-thumb-video::after {
  content: '▶';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
}

/* --- Mobile adjustments -------------------------------------- */
@media (max-width: 640px) {
  #lb-prev { left: 0.375rem; }
  #lb-next { right: 0.375rem; }
  #lb-prev, #lb-next {
    width: 2.25rem;
    height: 2.25rem;
  }
  #lb-stage iframe {
    width: 95vw;
    height: 53vw; /* 16:9 ratio */
  }
}
