.cpvg-gallery {
  display: flex;
  flex-wrap: nowrap;
  gap: 1rem;
  --thumb-size: 80px;
  --thumb-spacing: 8px;
  --thumb-count: 4;
  --thumb-count-mobile: 4;
}

.cpvg-left, .cpvg-right {
  flex-direction: row;
}

.cpvg-top, .cpvg-bottom {
  flex-direction: column;
}

.cpvg-thumbnails-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.cpvg-thumbnails-scroll {
  overflow: hidden;
  max-height: calc(var(--thumb-count) * var(--thumb-size) + 20px);
  max-width: calc(var(--thumb-count) * var(--thumb-size) + 20px);
  scroll-behavior: smooth;
}

.cpvg-thumbnails {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--thumb-spacing);
}

.cpvg-top .cpvg-thumbnails,
.cpvg-bottom .cpvg-thumbnails {
  flex-direction: row;
}

.cpvg-thumb-item {
  width: var(--thumb-size);
  height: var(--thumb-size);
  flex-shrink: 0;
  overflow: hidden;
}

.cpvg-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

.cpvg-main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.cpvg-main-display {
  max-width: 100%;
  height: auto;
  display: block;
}

.cpvg-arrows-vertical {
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 2;
}

.cpvg-arrow {
  font-size: 24px;
  padding: 5px;
  color: #fff;
  background: #ffffff;
  border-radius: 50%;
  margin: 5px 0;
  width: 32px;
  height: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background 0.3s;
}

.cpvg-arrow:hover {
  background: #444;
}

/* Modal */
.cpvg-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  padding-top: 60px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.8);
}

.cpvg-modal-content {
  margin: auto;
  background-color: #111;
  padding: 0;
  border: 1px solid #888;
  width: 90%;
  max-width: 800px;
  position: relative;
  border-radius: 10px;
}

.cpvg-close {
  color: #fff;
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10000;
}

.cpvg-close:hover,
.cpvg-close:focus {
  color: #bbb;
  text-decoration: none;
  cursor: pointer;
}

/* Responsive: cambia la variable --thumb-count por --thumb-count-mobile */
@media (max-width: 768px) {
  .cpvg-gallery {
    flex-direction: column !important;
  }

  .cpvg-gallery.cpvg-left,
  .cpvg-gallery.cpvg-right {
    flex-direction: row !important;
  }

  .cpvg-gallery.cpvg-left .cpvg-thumbnails-wrapper,
  .cpvg-gallery.cpvg-right .cpvg-thumbnails-wrapper {
    order: 0;
  }

  .cpvg-gallery.cpvg-left .cpvg-main,
  .cpvg-gallery.cpvg-right .cpvg-main {
    order: 1;
  }

  .cpvg-gallery.cpvg-left .cpvg-thumbnails,
  .cpvg-gallery.cpvg-right .cpvg-thumbnails {
    flex-direction: column;
  }

  .cpvg-gallery.cpvg-top .cpvg-thumbnails,
  .cpvg-gallery.cpvg-bottom .cpvg-thumbnails {
    flex-direction: row;
  }

  .cpvg-thumbnails-scroll {
    overflow: hidden;
    max-height: calc(var(--thumb-count-mobile) * var(--thumb-size) + 20px);
    max-width: 100%;
  }

  .cpvg-thumbnails {
    flex-wrap: nowrap;
  }
}