/* Wrapper vars (scrollbar colors from Elementor) */
:root {
  --cvpg-scrollbar-color: #888;
  --cvpg-scrollbar-track: transparent;
}

/* ==========
   WRAP
   ========== */
.cvpg-gallery-wrap {
  display: flex;
  gap: 20px;
  align-items: center;
  width: 100%;
}

/* ==========
   LAYOUTS
   ========== */
.cvpg-gallery-wrap.cvpg-pos-left { flex-direction: row; }
.cvpg-gallery-wrap.cvpg-pos-left .cvpg-thumbs-wrap { order: 1; }
.cvpg-gallery-wrap.cvpg-pos-left .cvpg-main-wrap { order: 2; }

.cvpg-gallery-wrap.cvpg-pos-right { flex-direction: row; }
.cvpg-gallery-wrap.cvpg-pos-right .cvpg-main-wrap { order: 1; }
.cvpg-gallery-wrap.cvpg-pos-right .cvpg-thumbs-wrap { order: 2; }

.cvpg-gallery-wrap.cvpg-pos-bottom {
  flex-direction: column;
  align-items: stretch;
}
.cvpg-gallery-wrap.cvpg-pos-bottom .cvpg-main-wrap { order: 1; }
.cvpg-gallery-wrap.cvpg-pos-bottom .cvpg-thumbs-wrap { order: 2; }

/* ==========
   THUMBS
   ========== */
.cvpg-thumbs-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: auto;
  gap: 8px;
}

/* Bazowo: JS ustawia maxHeight/maxWidth i overflow zależnie od pozycji */
.cvpg-thumbs {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: auto;
  overflow: auto;
  max-height: none;
  max-width: none;
  -webkit-overflow-scrolling: touch;
}

/* Miniatury – nie ustawiamy width/max-width tutaj (Elementor steruje) */
.cvpg-thumbs img {
  display: block;
  height: auto;
  cursor: pointer;

  /* baza dla kontrolek obramowania w Elementor */
  border-style: solid;
  border-width: 0;
  border-color: transparent;
  border-radius: 0;

  box-sizing: border-box;
}

/* Active bez narzucania wartości */
.cvpg-thumbs img.active {}

/* Hover/Active – bez zmiany border-width (żeby nie skakało) */
.cvpg-thumbs img:hover,
.cvpg-thumbs img:active {
  opacity: 0.9;
}

/* ==========
   MAIN
   ========== */
.cvpg-main-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  justify-content: space-between;
  min-width: 0;
  overflow: visible;

  /* ZMIENNE dla strzałek: baza + offset (Elementor ustawia) */
  --cvpg-main-left-base: 0px;
  --cvpg-main-right-base: 0px;
  --cvpg-main-left-offset: 0px;
  --cvpg-main-right-offset: 0px;
}

.cvpg-main {
  width: 100%;
  min-width: 0;
  touch-action: pan-y; /* swipe poziomy z JS, pionowy scroll zostaje */
}

.cvpg-main img,
.cvpg-main a {
  display: block;
  width: 100%;
}

.cvpg-main img { border-radius: 6px; }

/* ==========
   BUTTONS
   ========== */
.cvpg-main-arrow,
.cvpg-thumbs-arrow {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  user-select: none;
  border-radius: 8px;
  transition: background-color 0.2s ease, opacity 0.2s ease, transform 0.1s ease;
  background: transparent;
  box-sizing: border-box;
}

/* Strzałki zdjęcia głównego: absolute + wyjazd poza kontener */
.cvpg-main-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
}

/* Klucz: left/right z calc(base + offset) */
.cvpg-main-left  { left:  calc(var(--cvpg-main-left-base)  + var(--cvpg-main-left-offset)); }
.cvpg-main-right { right: calc(var(--cvpg-main-right-base) + var(--cvpg-main-right-offset)); }

.cvpg-main-arrow:hover,
.cvpg-thumbs-arrow:hover {
  opacity: 0.95;
}

.cvpg-main-arrow:active,
.cvpg-thumbs-arrow:active {
  transform: translateY(-50%) scale(0.98);
}

/* Ikony (fa / svg) */
.cvpg-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.cvpg-icon i { line-height: 1; }

/* domyślnie ukryte – JS pokaże gdy trzeba */
.cvpg-thumbs-prev,
.cvpg-thumbs-next {
  display: none;
}

/* ==========
   BOTTOM: miniatury poziomo
   ========== */
.cvpg-gallery-wrap.cvpg-pos-bottom .cvpg-thumbs-wrap {
  flex-direction: row;
  align-items: center;
  justify-content: center;
}

.cvpg-gallery-wrap.cvpg-pos-bottom .cvpg-thumbs {
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
  max-width: 100%;
}

.cvpg-gallery-wrap.cvpg-pos-bottom .cvpg-thumbs-arrow {
  width: auto;
}

/* ==========
   SCROLLBAR (miniatury)
   ========== */
.cvpg-thumbs::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

.cvpg-thumbs::-webkit-scrollbar-track {
  background: var(--cvpg-scrollbar-track);
}

.cvpg-thumbs::-webkit-scrollbar-thumb {
  background: var(--cvpg-scrollbar-color);
  border-radius: 6px;
}

.cvpg-thumbs {
  scrollbar-width: thin;
  scrollbar-color: var(--cvpg-scrollbar-color) var(--cvpg-scrollbar-track);
}

/* ==========
   WISHLIST (overlay)
   ========== */
.cvpg-wishlist-wrap {
  position: absolute;
  top: 12px;    /* Elementor nadpisze */
  right: 12px;  /* Elementor nadpisze */
  z-index: 6;
  pointer-events: auto;
}

.cvpg-wishlist-wrap.cvpg-wishlist-left  { left: 12px; right: auto; }
.cvpg-wishlist-wrap.cvpg-wishlist-right { right: 12px; left: auto; }

/* Natywny przycisk pluginu ukryty, ale obecny w DOM */
.cvpg-wishlist-native {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Reset motywu + domyślna widoczność */
.cvpg-wishlist-btn {
  -webkit-appearance: none;
  appearance: none;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background-color: transparent;
  border: 0 !important;
  margin: 0;
  line-height: 1;
  cursor: pointer;

  box-shadow: none !important;
  filter: none !important;
  outline: none !important;

  padding: 8px;        /* Elementor nadpisze */
  border-radius: 8px;  /* jeśli chcesz osobną kontrolkę – można dopisać */
}

.cvpg-wishlist-btn:focus,
.cvpg-wishlist-btn:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

/* Domyślny rozmiar (Elementor nadpisze) */
.cvpg-wishlist-btn .cvpg-icon { font-size: 20px; }
.cvpg-wishlist-btn .cvpg-icon svg { width: 20px; height: 20px; }

/* Toggle ikon */
.cvpg-wishlist-icon-added { display: none; }
.cvpg-wishlist-wrap.cvpg-wishlist-added .cvpg-wishlist-icon-add { display: none; }
.cvpg-wishlist-wrap.cvpg-wishlist-added .cvpg-wishlist-icon-added { display: inline-flex; }

/* ==========
   MOBILE
   ========== */
@media (max-width: 600px) {
  .cvpg-gallery-wrap { gap: 14px; }
}