.brand-pg-root {
  display: flex;
  gap: var(--brand-pg-gallery--gap, 20px);
  align-items: flex-start;
  position: relative;
}

.brand-pg-root[data-pos="right"] {
  flex-direction: row-reverse;
}

.brand-pg-root[data-pos="bottom"] {
  flex-direction: column-reverse;
}

.brand-pg-root[data-pos="top"] {
  flex-direction: column;
}

.brand-pg-root[data-pos="bottom"] .brand-pg-thumbs,
.brand-pg-root[data-pos="top"] .brand-pg-thumbs {
  width: 100%;
  flex-direction: row;
  overflow-x: auto;
  max-height: none;
}

.brand-pg-root[data-pos="bottom"] .brand-pg-thumb,
.brand-pg-root[data-pos="top"] .brand-pg-thumb {
  flex: 0 0 calc(var(--brand-pg-thumb--size, 80px));
  width: var(--brand-pg-thumb--size, 80px);
}

.brand-pg-thumbs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: var(--brand-pg-thumb--size, 80px);
  max-height: 800px;
  overflow-y: auto;
  flex-shrink: 0;
  scrollbar-width: thin;
}

.brand-pg-thumbs::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
.brand-pg-thumbs::-webkit-scrollbar-thumb {
  background-color: #ccc;
}

.brand-pg-thumb {
  border: 1px solid transparent;
  background: none;
  padding: 0;
  cursor: pointer;
  transition: opacity 0.2s, border-color 0.2s;
  border-radius: var(--brand-pg-gallery--radius, 4px);
  overflow: hidden;
  position: relative;
  aspect-ratio: 1;
}

.brand-pg-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-pg-thumb[aria-selected="true"] {
  border-color: var(--brand-pg-gallery--color-active, var(--brand-color-primary, #000));
}

.brand-pg-main {
  flex-grow: 1;
  position: relative;
  min-width: 0;
}

/* Sticky feature */
.brand-pg-root[data-sticky="true"] {
  align-items: flex-start;
}
.brand-pg-root[data-sticky="true"] .brand-pg-main,
.brand-pg-root[data-sticky="true"] .brand-pg-thumbs {
  position: sticky;
  top: 20px;
}

.brand-pg-viewport {
  position: relative;
  width: 100%;
  border-radius: var(--brand-pg-gallery--radius, 4px);
  overflow: hidden;
  background: #f9f9f9;
  aspect-ratio: var(--sg-aspect-ratio, 1 / 1);
  min-height: 200px;
}

.brand-pg-slide {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-pg-slide.is-active {
  opacity: 1;
  pointer-events: auto;
  z-index: 2;
}

.brand-pg-slide img {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Hover Zoom Effect */
.brand-pg-root[data-zoom="true"] .brand-pg-slide.is-active {
  cursor: zoom-in;
}
.brand-pg-root[data-zoom="true"] .brand-pg-slide.is-zoomed {
  background-size: 200%;
}
.brand-pg-root[data-zoom="true"] .brand-pg-slide.is-zoomed img {
  opacity: 0;
}

/* Mobile Feature: Dots */
.brand-pg-dots {
  display: none;
  justify-content: center;
  gap: 8px;
  margin-top: 15px;
}

.brand-pg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ccc;
  border: none;
  padding: 0;
  cursor: pointer;
}

.brand-pg-dot.is-active {
  background: var(--brand-pg-gallery--color-active, var(--brand-color-primary, #000));
}

/* Arrows Navigation */
.brand-pg-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  background: rgba(255, 255, 255, 0.8);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: opacity 0.2s, background 0.2s;
  opacity: 0;
}

.brand-pg-main:hover .brand-pg-nav {
  opacity: 1;
}

.brand-pg-nav:hover {
  background: #fff;
}

.brand-pg-nav--prev { left: 10px; }
.brand-pg-nav--next { right: 10px; }

.brand-pg-nav svg {
  width: 20px;
  height: 20px;
}

/* Hide navigation if only 1 slide */
.brand-pg-root[data-count="1"] .brand-pg-nav,
.brand-pg-root[data-count="1"] .brand-pg-dots,
.brand-pg-root[data-count="1"] .brand-pg-thumbs {
  display: none;
}

/* Mobile Responsive */
@media (max-width: 767px) {
  .brand-pg-root {
    flex-direction: column !important;
  }
  .brand-pg-thumbs {
    display: none;
  }
  .brand-pg-dots {
    display: flex;
  }
  
  .brand-pg-viewport {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    aspect-ratio: auto;
  }
  .brand-pg-viewport::-webkit-scrollbar {
    display: none;
  }
  
  .brand-pg-slide {
    position: relative;
    flex: 0 0 100%;
    opacity: 1;
    scroll-snap-align: center;
    pointer-events: auto;
  }
  
  .brand-pg-nav {
    display: none;
  }
}
