.cfe-gallery-display {
  --cfe-thumb-size: 84px;
  --cfe-accent: #3a4b98;
  --cfe-thumbs-bg: #ffffff;
}

.cfe-gallery-card {
  border-radius: 16px;
  overflow: hidden;
  background: var(--cfe-thumbs-bg);
}

.cfe-gallery-main {
  position: relative;
  width: 100%;
  /* Trước đây biến --cfe-main-height được khai báo nhưng không nơi nào dùng
     tới — control "Chiều cao ảnh chính" trong Elementor vì vậy không có tác
     dụng gì, nay áp dụng đúng vào đây. */
  height: var(--cfe-main-height, 480px);
  overflow: hidden;
  background: #eceef3;
  cursor: pointer;
}

.cfe-gallery-main-img {
  width: 100%;
  height: 100% !important;
  object-fit: cover;
  display: block;
}

.cfe-gallery-expand {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  color: #20263a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(20, 25, 60, 0.18);
}

.cfe-gallery-expand:hover {
  background: rgba(255, 255, 255, 0.92);
  color: #20263a;
}

.cfe-gallery-thumbs-wrap {
  background: var(--cfe-thumbs-bg);
  padding: 16px 20px;
}

.cfe-gallery-thumbs-swiper {
  overflow: hidden;
  padding: 6px 0;
}

.cfe-gallery-thumb-slide {
  width: var(--cfe-thumb-size);
  flex-shrink: 0;
}

.cfe-gallery-thumb {
  display: block;
  width: 100%;
  height: var(--cfe-thumb-size);
  padding: 0 !important;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid transparent;
  background: none !important;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease;
}

.cfe-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cfe-gallery-thumb.is-active {
  border-color: var(--cfe-accent);
  transform: scale(1.3);
}

/* Bố cục "Dọc bên trái" — cột thumbnail cuộn dọc tĩnh (không carousel/Swiper,
   không autoplay) nằm bên trái, ảnh chính lấp phần còn lại bên phải. Cột
   thumbnail dùng chung đúng height với ảnh chính (--cfe-main-height) để 2 bên
   luôn cao bằng nhau, không cần đo JS. */
.cfe-gallery-card--vertical {
  display: flex;
  gap: 12px;
  padding: 12px;
}

.cfe-gallery-thumbs-col {
  flex: none;
  width: calc(var(--cfe-thumb-size) + 8px);
  height: var(--cfe-main-height, 480px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

.cfe-gallery-card--vertical .cfe-gallery-main {
  flex: 1;
  min-width: 0;
  border-radius: 12px;
}

.cfe-gallery-card--vertical .cfe-gallery-thumb {
  flex: none;
}

/* Bố cục dọc: thumbnail xếp sát nhau trong 1 cột hẹp — phóng to (scale) như
   bố cục ngang sẽ đè lên thumbnail kế bên, nên chỉ đổi màu viền để báo hiệu
   đang chọn, không scale. */
.cfe-gallery-card--vertical .cfe-gallery-thumb.is-active {
  border-color: #3a4b98;
  transform: none;
}

/* lightbox */
.cfe-gallery-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999999;
}

.cfe-gallery-lightbox.is-open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.cfe-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 20, 0.92);
}

.cfe-lightbox-stage {
  position: relative;
  z-index: 1;
  width: 88vw;
  height: 82vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

.cfe-lightbox-stage.is-zoomed {
  cursor: grab;
}

.cfe-lightbox-stage.is-dragging {
  cursor: grabbing;
}

.cfe-lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center center;
  will-change: transform;
}

.cfe-lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.cfe-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.26);
}

.cfe-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.cfe-lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.26);
}

.cfe-lightbox-nav:focus {
  background: rgba(255, 255, 255, 0.14);
}

.cfe-lightbox-prev {
  left: 20px;
}

.cfe-lightbox-next {
  right: 20px;
}

.cfe-lightbox-zoom {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 100px;
  padding: 8px 16px;
}

.cfe-zoom-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: #eceef3;
  color: #20263a;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.cfe-zoom-btn:hover,
.cfe-zoom-btn:focus {
  background: transparent;
  color: #20263a;
}

.cfe-zoom-value {
  font-family: system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #20263a;
  min-width: 42px;
  text-align: center;
}

body.cfe-lightbox-locked {
  overflow: hidden;
}
