/* ═══════════════════════════════════════════════════════════
   GS Image Gallery Slider v1.0 — Frontend CSS
   ═══════════════════════════════════════════════════════════ */

.gsgal-gallery-wrap {
  --gsgal-radius:     12px;
  --gsgal-accent:     #7C3AED;
  --gsgal-dot-color:  #7C3AED;
  --gsgal-ratio:      16/9;
  --gsgal-thumb-cols: 5;
  --gsgal-thumb-gap:  6px;
  --gsgal-arrow-bg:   rgba(255,255,255,0.92);
  --gsgal-shadow:     0 4px 24px rgba(0,0,0,.12);
  --gsgal-overlay:    rgba(0,0,0,.32);
  --gsgal-trans:      all .28s ease;

  display: flex;
  flex-direction: column;
  gap: var(--gsgal-thumb-gap);
  width: 100%;
  font-family: -apple-system,'Segoe UI',Arial,sans-serif;
  user-select: none;
}

.gsgal-gallery-wrap, .gsgal-gallery-wrap * { box-sizing: border-box; }

/* ── Main Slider ─────────────────────────────────────────── */
.gsgal-slider {
  position: relative;
  width: 100%;
  aspect-ratio: var(--gsgal-ratio);
  border-radius: var(--gsgal-radius);
  overflow: hidden;
  background: #1a1a1a;
  box-shadow: var(--gsgal-shadow);
  cursor: pointer;
}

/* Slides Track */
.gsgal-slides-track {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.gsgal-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .38s ease;
  pointer-events: none;
}
.gsgal-slide.gsgal-active {
  opacity: 1;
  pointer-events: auto;
}
.gsgal-slide.gsgal-prev   { opacity: 0; }

.gsgal-slide-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gsgal-slide-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: #2a2a2a;
  font-size: 48px; color: #555;
}

/* ── Arrows ─────────────────────────────────────────────── */
.gsgal-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--gsgal-arrow-bg);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #1a1a1a;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  transition: var(--gsgal-trans);
  padding: 0;
}
.gsgal-arrow:hover {
  background: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,.28);
  transform: translateY(-50%) scale(1.08);
}
.gsgal-arrow-prev { left: 12px; }
.gsgal-arrow-next { right: 12px; }

/* ── Counter ─────────────────────────────────────────────── */
.gsgal-counter {
  position: absolute;
  top: 12px; left: 12px;
  z-index: 10;
  background: rgba(0,0,0,.48);
  color: #fff;
  font-size: 12px; font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  letter-spacing: .04em;
  line-height: 1.4;
}
.gsgal-counter-current { font-weight: 700; }

/* ── Fullscreen button ───────────────────────────────────── */
.gsgal-fullscreen-btn {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 10;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,.88);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #1a1a1a;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
  transition: var(--gsgal-trans);
  padding: 0;
}
.gsgal-fullscreen-btn:hover { background: #fff; transform: scale(1.08); }

/* ── Dots ────────────────────────────────────────────────── */
.gsgal-dots {
  position: absolute;
  bottom: 12px; left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex; gap: 6px; align-items: center;
}
.gsgal-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,.5);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: var(--gsgal-trans);
  flex-shrink: 0;
}
.gsgal-dot.gsgal-active {
  background: var(--gsgal-dot-color);
  width: 20px;
  border-radius: 3px;
}
.gsgal-dot:hover:not(.gsgal-active) { background: rgba(255,255,255,.75); }

/* ── Thumbnail Strip ────────────────────────────────────── */
.gsgal-thumbs {
  overflow: hidden;          /* clips extra thumbs horizontally */
  position: relative;
  width: 100%;
  /* Prevent theme/Greenshift from setting min-height that causes 2nd row */
  height: auto !important;
  max-height: none !important;
}

.gsgal-thumbs-track {
  display: flex;
  flex-wrap: nowrap !important;  /* NEVER wrap to 2nd row */
  gap: var(--gsgal-thumb-gap);
  transition: transform .32s cubic-bezier(.4,0,.2,1);
  will-change: transform;
  /* Height locked to 1 row — prevents any wrapping */
  height: auto;
  min-height: 0;
}

.gsgal-thumb {
  /* CSS calc width — works even before JS loads */
  flex: 0 0 calc(
    (100% - (var(--gsgal-thumb-cols) - 1) * var(--gsgal-thumb-gap))
    / var(--gsgal-thumb-cols)
  );
  width: calc(
    (100% - (var(--gsgal-thumb-cols) - 1) * var(--gsgal-thumb-gap))
    / var(--gsgal-thumb-cols)
  );
  min-width: 0;
  flex-shrink: 0 !important;
  flex-grow: 0 !important;
  aspect-ratio: 4/3;
  border-radius: calc(var(--gsgal-radius) * .55);
  overflow: hidden;
  border: 2.5px solid transparent;
  cursor: pointer;
  padding: 0;
  background: #E5E7EB;
  transition: border-color .22s, box-shadow .22s;
}
.gsgal-thumb img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  transition: transform .3s ease;
}
.gsgal-thumb:hover img { transform: scale(1.06); }
.gsgal-thumb:not(.gsgal-active) { opacity: .75; }
.gsgal-thumb:hover:not(.gsgal-active) { opacity: 1; border-color: rgba(255,255,255,.4); }
.gsgal-thumb.gsgal-active {
  border-color: var(--gsgal-accent, #7C3AED);
  box-shadow: 0 0 0 2px var(--gsgal-accent, #7C3AED), 0 2px 8px rgba(0,0,0,.15);
}
.gsgal-thumb-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #9CA3AF;
}

/* Active thumb overlay */
.gsgal-thumb.gsgal-active::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.15);
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════
   LIGHTBOX
   ══════════════════════════════════════════════════════════ */
.gsgal-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0,0,0,.92);
  backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0;
}
.gsgal-lightbox.gsgal-lb-open {
  display: flex;
  animation: gsgal-lb-in .2s ease;
}
@keyframes gsgal-lb-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.gsgal-lightbox-img-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 80px;
  width: 100%;
  min-height: 0;
}
.gsgal-lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
  display: block;
}

.gsgal-lightbox-close {
  position: fixed;
  top: 16px; right: 16px;
  z-index: 10;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--gsgal-trans);
  padding: 0;
}
.gsgal-lightbox-close:hover { background: rgba(255,255,255,.25); }

.gsgal-lb-arrow {
  position: fixed;
  top: 50%; transform: translateY(-50%);
  z-index: 10;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--gsgal-trans);
  padding: 0;
}
.gsgal-lb-arrow:hover { background: rgba(255,255,255,.25); }
.gsgal-lb-prev { left: 16px; }
.gsgal-lb-next { right: 16px; }

.gsgal-lb-counter {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,.7);
  font-size: 13px; font-weight: 500;
  font-family: -apple-system,'Segoe UI',Arial,sans-serif;
}

/* ── Empty state ─────────────────────────────────────────── */
.gsgal-gallery-empty {
  padding: 40px;
  text-align: center;
  background: #F3F4F6;
  border-radius: 12px;
  color: #9CA3AF;
  font-family: sans-serif;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .gsgal-arrow { width: 30px; height: 30px; }
  .gsgal-arrow svg { width: 16px; height: 16px; }
  .gsgal-arrow-prev { left: 8px; }
  .gsgal-arrow-next { right: 8px; }

  .gsgal-lightbox-img-wrap { padding: 50px 56px; }
  .gsgal-lb-arrow { width: 38px; height: 38px; }
}
@media (max-width: 480px) {

  .gsgal-lightbox-img-wrap { padding: 50px 12px; }
  .gsgal-lb-prev { left: 4px; }
  .gsgal-lb-next { right: 4px; }
}
