/* ═══════════════════════════════════════════
   PREMIUM INDUSTRIAL PRODUCT GALLERY
   product-gallery.css
═══════════════════════════════════════════ */

/* ── Wrapper ── */
.pg-wrap {
  width: 100%;
  max-width: 480px;
  user-select: none;
  font-family: inherit;
  box-sizing: border-box;
  min-width: 0;
}

/* ── Main Viewer Card ── */
.pg-main {
  position: relative;
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  box-shadow: 0 8px 32px rgba(0,0,0,.10), 0 2px 8px rgba(0,0,0,.06);
  aspect-ratio: 4/3;
  transition: box-shadow .3s ease;
}
.pg-main:hover {
  box-shadow: 0 16px 48px rgba(0,0,0,.14), 0 4px 12px rgba(0,0,0,.08);
}

/* ── Zoom wrapper ── */
.pg-zoom-inner {
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 14px;
  position: relative;
  cursor: zoom-in;
}

/* ── Main Image ── */
.pg-main-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  padding: 0;
  display: block;
  will-change: transform;
  transform: scale(1);
  transform-origin: 50% 50%;
  transition: opacity .25s ease, transform .15s ease;
}
.pg-main-img.pg-fade { opacity: 0; }

/* ── Hover Zoom — image zooms where cursor is ── */
.pg-zoom-inner:hover .pg-main-img {
  transform: scale(2);
}

/* ── Badges ── */
.pg-badges {
  position: absolute;
  bottom: 10px; left: 10px;
  display: flex; gap: 5px; flex-wrap: wrap;
  z-index: 4; pointer-events: none;
  opacity: 0;
  transition: opacity .25s ease;
}
.pg-main:hover .pg-badges { opacity: 1; }
.pg-badge {
  background: rgba(15,23,42,.80);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(99,179,237,.30);
  color: #63b3ed;
  font-size: .6rem; font-weight: 700;
  letter-spacing: .6px; text-transform: uppercase;
  padding: 3px 8px; border-radius: 5px;
  display: flex; align-items: center; gap: 3px;
}

/* ── Action Buttons (top-right) ── */
.pg-actions {
  position: absolute;
  top: 12px; right: 12px;
  display: flex; flex-direction: column; gap: 6px;
  z-index: 4;
}
.pg-action-btn {
  width: 36px; height: 36px;
  background: rgba(15,23,42,.78);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(99,179,237,.3);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #e2e8f0; font-size: 1rem;
  transition: background .2s, border-color .2s, transform .15s, color .2s;
}
.pg-action-btn:hover,
.pg-action-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  transform: scale(1.08);
}

/* ── Nav Arrows ── */
.pg-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px;
  background: rgba(15,23,42,.72);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #fff; font-size: .9rem;
  z-index: 4;
  opacity: 0;
  transition: opacity .2s, background .2s, transform .15s;
}
.pg-main:hover .pg-arrow { opacity: 1; }
.pg-arrow:hover { background: #2563eb; transform: translateY(-50%) scale(1.1); }
.pg-arrow-prev { left: 10px; }
.pg-arrow-next { right: 10px; }

/* ── Counter ── */
.pg-counter {
  position: absolute; bottom: 10px; right: 12px;
  background: rgba(15,23,42,.72);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.75);
  font-size: .7rem; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
  z-index: 4; pointer-events: none;
}

/* ── Fullscreen Button ── */
.pg-fullscreen-btn {
  position: absolute; bottom: 10px; left: 12px;
  width: 30px; height: 30px;
  background: rgba(15,23,42,.72);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: rgba(255,255,255,.75); font-size: .85rem;
  z-index: 4; opacity: 0;
  transition: opacity .2s, background .2s;
}
.pg-main:hover .pg-fullscreen-btn { opacity: 1; }
.pg-fullscreen-btn:hover { background: #2563eb; color: #fff; }

/* ── model-viewer inside main card (360 mode) ── */
.pg-model-viewer {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border-radius: 16px;
  display: none;
  z-index: 6;
  background: #0f172a;
}
.pg-model-viewer.active { display: block; }
.pg-model-viewer model-viewer {
  width: 100%; height: 100%;
  border-radius: 16px;
  --poster-color: #0f172a;
}
.pg-model-viewer .mv-progress-bar {
  position: absolute; bottom: 0; left: 0;
  height: 3px; background: #2563eb;
  width: 0%; transition: width .3s ease;
  border-radius: 0 0 16px 16px;
  z-index: 7;
}
.pg-360-close {
  position: absolute; top: 10px; right: 10px;
  width: 34px; height: 34px;
  background: rgba(15,23,42,.85);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #fff; font-size: 1rem;
  z-index: 8;
  transition: background .2s;
}
.pg-360-close:hover { background: #dc2626; }

/* ── Video Player ── */
.pg-video-wrap {
  position: absolute; inset: 0;
  background: #000;
  border-radius: 16px;
  display: none;
  z-index: 6;
  align-items: center; justify-content: center;
}
.pg-video-wrap.active { display: flex; }
.pg-video-wrap video {
  width: 100%; height: 100%;
  object-fit: contain;
  border-radius: 16px;
}
.pg-video-close {
  position: absolute; top: 10px; right: 10px;
  width: 34px; height: 34px;
  background: rgba(15,23,42,.85);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #fff; font-size: 1rem;
  z-index: 7;
  transition: background .2s;
}
.pg-video-close:hover { background: #dc2626; }

/* ── Thumbnail Strip ── */
.pg-thumbs {
  display: flex; gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.pg-thumbs::-webkit-scrollbar { height: 4px; }
.pg-thumbs::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

.pg-thumb {
  flex-shrink: 0;
  width: 72px; height: 60px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid #e2e8f0;
  cursor: pointer;
  background: #f8fafc;
  transition: border-color .2s, transform .2s, box-shadow .2s;
  position: relative;
}
.pg-thumb img {
  width: 100%; height: 100%;
  object-fit: contain; padding: 4px;
  transition: transform .25s;
}
.pg-thumb:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,.12);
  border-color: #93c5fd;
}
.pg-thumb:hover img { transform: scale(1.08); }
.pg-thumb.active {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37,99,235,.3), 0 4px 12px rgba(37,99,235,.15);
}

/* ── 360 Thumbnail ── */
.pg-thumb-360 {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
}
.pg-thumb-360 .t360-icon { font-size: 1.4rem; color: #63b3ed; }
.pg-thumb-360 .t360-label {
  font-size: .55rem; font-weight: 700;
  color: rgba(255,255,255,.7); letter-spacing: .5px;
  text-transform: uppercase;
}

/* ── Video Thumbnail ── */
.pg-thumb-video {
  background: #0f172a;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
}
.pg-thumb-video img { border-radius: 6px; }
.pg-play-icon {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.35);
}
.pg-play-icon i { font-size: 1.6rem; color: #fff; }

/* ══════════════════════════════════════
   LIGHTBOX
══════════════════════════════════════ */
.pg-lightbox {
  position: fixed; inset: 0;
  background: rgba(5,10,20,.94);
  backdrop-filter: blur(14px);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.pg-lightbox.open { opacity: 1; pointer-events: all; }

.pg-lightbox-inner {
  position: relative;
  max-width: min(90vw, 960px);
  max-height: 90vh;
  display: flex; flex-direction: column; align-items: center;
  gap: 14px;
}
.pg-lightbox-img {
  max-width: 100%; max-height: 80vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0,0,0,.5);
  transition: opacity .2s;
}
.pg-lightbox-img.pg-fade { opacity: 0; }
.pg-lb-caption {
  color: rgba(255,255,255,.55);
  font-size: .82rem; text-align: center;
  max-width: 640px; line-height: 1.5;
}

.pg-lb-model-wrap {
  display: none;
  width: min(90vw, 860px);
  height: min(80vh, 560px);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  background: #0f172a;
}
.pg-lb-model-wrap.show { display: block; }
.pg-lb-model-wrap model-viewer { width: 100%; height: 100%; --poster-color: #0f172a; }
.pg-lb-model-wrap .mv-progress-bar {
  position: absolute; bottom: 0; left: 0;
  height: 3px; background: #2563eb;
  width: 0%; transition: width .3s ease; z-index: 2;
}
.pg-lb-360-label {
  display: none;
  color: rgba(255,255,255,.5);
  font-size: .78rem; text-align: center;
  letter-spacing: .5px; margin-top: 4px;
}
.pg-lb-360-label.show { display: block; }

.pg-lb-close {
  position: fixed; top: 20px; right: 24px;
  width: 42px; height: 42px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #fff; font-size: 1.3rem;
  transition: background .2s; z-index: 10000;
}
.pg-lb-close:hover { background: #dc2626; }

.pg-lb-arrow {
  position: fixed; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #fff; font-size: 1.2rem;
  transition: background .2s; z-index: 10000;
}
.pg-lb-arrow:hover { background: #2563eb; }
.pg-lb-prev { left: 20px; }
.pg-lb-next { right: 20px; }

/* ── Responsive ── */
@media (max-width: 992px) {
  .pg-wrap { max-width: 100%; width: 100%; }
  .pg-main { aspect-ratio: 4/3; }
}
@media (max-width: 640px) {
  .pg-wrap { max-width: 100%; width: 100%; }
  .pg-main { aspect-ratio: 4/3; border-radius: 10px; }
  .pg-zoom-inner { border-radius: 8px; }
  .pg-main-img { object-fit: cover; padding: 0; }
  .pg-thumb { width: 56px; height: 46px; }
  .pg-thumbs { gap: 6px; }
  .pg-action-btn { width: 32px; height: 32px; font-size: .9rem; }
  .pg-arrow { width: 30px; height: 30px; font-size: .8rem; }
  .pg-lb-arrow { width: 36px; height: 36px; font-size: 1rem; }
  .pg-lb-prev { left: 8px; }
  .pg-lb-next { right: 8px; }
  .pg-lb-model-wrap { height: min(70vh, 320px); }
}
