.template-detail-head .template-detail-wrapper {
  display: flex;
  gap: 48px;
  align-items: flex-start;
}

/* CỘT TRÁI */
.template-detail-head .template-detail-wrapper > div:first-child {
  width: 624px;
}

/* CỘT PHẢI */
.template-detail-head .template-detail-wrapper > div:last-child {
  width: 624px;
  display: flex;
}
.template-detail-head .swiper.mySwiper {
  margin: 0;
}
/* =========================================================
   TEMPLATE DETAIL – SWIPER + OWL (FINAL MERGED)
   ========================================================= */

/* =========================
   HEAD
========================= */
.template-detail-head {
  padding: 72px 0;
  background: #f5faff;
}

.template-detail-head .ct-container {
  position: relative;
  height: 100%;
}

/* =========================
   LAYOUT 2 CỘT
========================= */
.template-detail-head .template-detail-wrapper {
  display: flex;
  gap: 53px;
  width: 100%;
  max-width: 100%;
  align-items: flex-start;
}

/* =========================================================
   SWIPER – ẢNH LỚN BÊN TRÁI (ƯU TIÊN)
   ========================================================= */
.template-detail-head .swiper {
  width: 560px; /* ưu tiên */
  height: 900px; /* ưu tiên */
}

.template-detail-head .swiper-slide {
  border-radius: 8px;
  overflow: auto;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.08);
  display: flex;
  background-color: white;
  flex-direction: column;
  /* Firefox */
}

/* Chrome / Safari / Edge */
.template-detail-head .swiper-slide::-webkit-scrollbar {
  width: 0px;
}

.template-detail-head .swiper-slide::-webkit-scrollbar-button {
  display: none; /* ẩn hai mũi tên */
}

.template-detail-head .swiper-slide::-webkit-scrollbar-track {
  background: #ebf4f5;
  border-radius: 8px;
}

.template-detail-head .swiper-slide::-webkit-scrollbar-thumb {
  background-color: #919191;
  border-radius: 8px;
  border: 2px solid #ebf4f5;
}

/* =========================================================
   CỘT PHẢI – WRAPPER
   ========================================================= */
.template-detail-pages {
  width: 100%;
  max-width: 100%;
}

.template-detail-head .template-detail-pages .wrapper {
  overflow: hidden;
}

.template-detail-head .template-detail-pages .wrapper .title-page {
  font-size: 20px;
  line-height: 1.5;
  color: #212121;
  font-weight: 600;
  margin-bottom: 8px;
}

/* =========================================================
   OWL WRAPPER
   ========================================================= */
.template-detail-pages-wrapper {
  position: relative;
  width: 100%;
  max-width: 100%;
}

/* chỉ nhốt overflow ở stage-outer (rất quan trọng) */
.template-detail-pages-wrapper .owl-stage-outer {
  overflow: hidden;
  padding-top: 48px;
  padding-bottom: 48px;
}

/* =========================================================
   OWL ITEM – VISIBILITY + SCALE
   ========================================================= */
.template-detail-pages-wrapper .owl-item {
  z-index: 0;
  scale: 0.85; /* ưu tiên */
  opacity: 0; /* bổ sung */
  pointer-events: none; /* bổ sung */
  transition: all 0.35s ease;
}

.template-detail-pages-wrapper .owl-item.active {
  opacity: 1;
  pointer-events: auto;
}

/* center item */
.template-detail-pages-wrapper .owl-item.center {
  scale: 1;
  z-index: 3;
}

/* =========================================================
   ITEM WRAPPER (GIỮ SIZE – KHÔNG TRÀN)
   ========================================================= */
.template-detail-pages-wrapper .item-wrapper {
  position: relative;
  width: 306px;
}

/* item chính */
.template-detail-head .template-detail-pages-wrapper .item {
  width: 306px;
  height: 408px;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  background-color: #f5fafa;
  flex-direction: column;
}

.template-detail-head .template-detail-pages-wrapper .item img {
  width: 306px;
  display: block;
}

/* =========================================================
   CENTER ITEM – NỔI BẬT
   ========================================================= */
.template-detail-head .template-detail-pages-wrapper .owl-item.center .item {
  width: 306px;
}

/* =========================================================
   OVERLAY
   ========================================================= */
.template-detail-head .template-detail-pages-wrapper .overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.2); /* ưu tiên */
  opacity: 1;
  transition: 0.3s ease;
  pointer-events: none;
}

.template-detail-head .template-detail-pages-wrapper .owl-item.center .overlay {
  opacity: 0;
  background: transparent;
}

/* =========================================================
   TEXT / DESC
   ========================================================= */
.template-detail-head .template-detail-pages-wrapper .desc {
  margin-top: 10px;
  text-align: center;
  color: #212121;
  font-size: 16px;
  opacity: 0.5;
  transform: translateY(6px);
  transition: 0.35s ease;
}

.template-detail-head .template-detail-pages-wrapper .owl-item.center .desc {
  color: #212121;
  opacity: 1;
  transform: translateY(0);
}

/* =========================================================
   OWL NAV
   ========================================================= */
.template-detail-head .template-detail-pages-wrapper .owl-nav {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding-bottom: 48px;
}

.template-detail-head .template-detail-pages-wrapper .project-nav {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  color: #014379;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 0 4px rgba(1, 67, 121, 0.15);
  cursor: pointer;
}

/* =========================================================
   COLOR LIST
   ========================================================= */
.template-detail-head .color-wrapper {
  margin-top: 16px;
  width: 624px;
}

.template-detail-head .color-wrapper .colors {
  margin-top: 48px;
  display: flex;
  gap: 11px;
  flex-wrap: wrap;
}

.template-detail-head .color-wrapper .color-item {
  width: 80px;
  height: 90px;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.1);
}

.template-detail-head .color-wrapper .color {
  width: 100%;
  height: 60px;
}

.template-detail-head .color-wrapper .c-text {
  text-align: center;
  font-size: 14px;
  margin-top: 4px;
}
.owl-carousel.owl-drag .owl-item.cloned:first-child {
  width: 160px !important;
}

@media screen and (max-width: 1400px) {
  .template-detail-head .swiper {
    width: 380px;
    height: 660px;
  }

  .template-detail-head .swiper-slide img {
    width: 380px;
    height: 660px;
    object-fit: cover;
  }

  .template-detail-head .template-detail-wrapper > div:first-child {
    width: 480px;
  }
  .template-detail-head .template-detail-wrapper {
    display: flex;
    justify-content: center;
    gap: 0px;
  }
}

@media screen and (max-width: 1170px) {
  .template-detail-head .swiper {
    width: 280px;
    height: 560px;
  }

  .template-detail-head .swiper-slide img {
    width: 280px;
    height: 560px;
    object-fit: cover;
  }

  .template-detail-head .template-detail-wrapper > div:first-child {
    width: 480px;
  }
  .template-detail-head .template-detail-wrapper {
    display: flex;
    justify-content: center;
    gap: 0px;
  }

  /* thu nhỏ item wrapper */
  .template-detail-pages-wrapper .item-wrapper {
    width: 206px;
  }

  /* item chính */
  .template-detail-head .template-detail-pages-wrapper .item {
    width: 206px;
    height: 308px;
  }

  .template-detail-head .template-detail-pages-wrapper .item img {
    width: 206px;
    height: 308px;
  }

  /* =========================================================
   CENTER ITEM – NỔI BẬT
   ========================================================= */
  .template-detail-head .template-detail-pages-wrapper .owl-item.center .item {
    width: 206px;
  }
  .owl-carousel.owl-drag .owl-item.cloned:first-child {
    width: 200px !important;
  }
}

@media screen and (max-width: 1140px) {
  .template-detail-head .swiper {
    width: 380px;
    height: 660px;
  }

  .template-detail-head .swiper-slide img {
    width: 380px;
    height: 660px;
    object-fit: cover;
  }

  .template-detail-head .template-detail-wrapper > div:first-child {
    width: 480px;
  }
  .template-detail-head .template-detail-wrapper {
    display: flex;
    justify-content: center;
    gap: 0px;
  }

  .template-detail-head .template-detail-wrapper {
    gap: 32px; /* thu gap cho vừa khung */
  }

  /* CỘT TRÁI (swiper) */
  .template-detail-head .template-detail-wrapper > div:first-child {
    flex: 0 0 50%;
    max-width: 50%;
  }

  /* CỘT PHẢI (owl + content) */
  .template-detail-head .template-detail-wrapper > div:last-child {
    flex: 0 0 50%;
    max-width: 50%;
  }

  .owl-carousel.owl-drag .owl-item.cloned:first-child {
    width: 150px !important;
  }
}

@media screen and (max-width: 1100px) {
  .owl-carousel.owl-drag .owl-item.cloned:first-child {
    width: 120px !important;
  }
}

@media screen and (max-width: 880px) {
  .template-detail-head .swiper {
    width: 300px;
    height: 580px;
  }

  .template-detail-head .swiper-slide img {
    width: 300px;
    height: 580px;
    object-fit: cover;
  }

  .template-detail-head .template-detail-wrapper > div:first-child {
    width: 400px;
  }
  .template-detail-head .template-detail-wrapper {
    display: flex;
    justify-content: center;
    gap: 0px;
  }

  .template-detail-head .template-detail-wrapper {
    gap: 32px; /* thu gap cho vừa khung */
  }

  /* CỘT TRÁI (swiper) */
  .template-detail-head .template-detail-wrapper > div:first-child {
    flex: 0 0 50%;
    max-width: 50%;
  }

  /* CỘT PHẢI (owl + content) */
  .template-detail-head .template-detail-wrapper > div:last-child {
    flex: 0 0 50%;
    max-width: 50%;
  }

  .owl-carousel.owl-drag .owl-item.cloned:first-child {
    width: 80px !important;
  }
}

@media screen and (max-width: 690px) {
  .template-detail-head .template-detail-wrapper {
    display: flex;
    flex-direction: column;

    width: 100%;
  }
  .template-detail-pages-wrapper {
    display: none !important;
  }

  .template-detail-head .template-detail-wrapper > div:last-child {
    order: 1;
  }

  .template-detail-head .template-detail-wrapper > div:first-child {
    order: 2;
  }

  .template-detail-head .template-detail-wrapper > div {
    width: 100%;
    max-width: 100% !important;
  }

  .owl-carousel.owl-drag .owl-item.cloned:first-child {
    width: 200px !important;
  }
  .template-detail-head .template-detail-wrapper > div:first-child {
    display: flex;
    justify-content: center;
    margin-left: 10%;
  }
}

@media screen and (max-width: 679px) {
  .owl-carousel.owl-drag .owl-item.cloned:first-child {
    width: 190px !important;
  }
}

@media screen and (max-width: 645px) {
  .owl-carousel.owl-drag .owl-item.cloned:first-child {
    width: 150px !important;
  }
}
@media (max-width: 601px) {
  .owl-carousel.owl-drag .owl-item.cloned:first-child {
    width: clamp(520px, 114vw, 690px) !important;
  }

  .owl-carousel.owl-drag .owl-item.cloned:last-child {
    display: none;
  }
}
@media (max-width: 450px) {
  .owl-carousel.owl-drag .owl-item.cloned:first-child {
    width: clamp(328px, 111vw, 562px) !important;
  }

  .owl-carousel.owl-drag .owl-item.cloned:last-child {
    display: none;
  }
}

/* 
@media (max-width: 591px) {
.owl-carousel.owl-drag .owl-item.cloned:first-child{
  width: 680px !important;
}
}
@media (max-width: 580px) {
.owl-carousel.owl-drag .owl-item.cloned:first-child{
  width: 662px !important;
}
}
@media (max-width: 509px) {
.owl-carousel.owl-drag .owl-item.cloned:first-child{
  width: 568px !important;
}
}


@media (max-width: 415px) {
.owl-carousel.owl-drag .owl-item.cloned:first-child{
  width: 100px !important;
}
 */
@media screen and (max-width: 509px) {
  .template-detail-head .template-detail-wrapper > div:first-child {
    display: flex;
    justify-content: center;
    margin-left: 0;
  }
}
/*  
@media screen and (max-width: 440px) {
 
  .owl-carousel.owl-drag .owl-item.cloned:first-child{
  width: 473px !important;
}


} */
body.product-image-lightbox-open {
  overflow: hidden;
}

.product-image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 16px;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;
}

.product-image-lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ✅ FIX CHÍNH Ở ĐÂY */
.product-image-lightbox__dialog {
  position: relative;
  z-index: 1;

  width: 1200px;
  max-width: 100%;

  height: auto; /* ❗ bỏ fix cứng */
  max-height: calc(100vh - 32px); /* ❗ co theo màn hình */

  margin: 0; /* ❗ bỏ margin auto */

  padding: 24px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);

  display: flex;
  flex-direction: column;

  /* Zoom support */
  transform-origin: center;
  transition: transform 0.2s ease;
  transform: scale(1);
  overflow: auto;
}

.product-image-lightbox__dialog.is-zoomed {
  transform: scale(1.5);
  overflow: auto;
}

/* Swiper full dialog - scrollable */
.product-image-lightbox__swiper {
  width: 100%;
  height: 80vh;
  max-height: calc(100vh - 120px);
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-image-lightbox__swiper::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.product-image-lightbox__swiper::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.product-image-lightbox__swiper::-webkit-scrollbar-thumb {
  background: #c7c7c7;
  border-radius: 4px;
}

.product-image-lightbox__swiper::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Center ảnh trong slide */
.product-image-lightbox__swiper .swiper-slide {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-shrink: 0;
  overflow: auto;
  padding: 20px 0;
}

.product-image-lightbox__swiper .swiper-slide::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.product-image-lightbox__swiper .swiper-slide::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.product-image-lightbox__swiper .swiper-slide::-webkit-scrollbar-thumb {
  background: #707070;
  border-radius: 4px;
}

.product-image-lightbox__swiper .swiper-slide::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* ✅ FIX ẢNH AUTO RESIZE */
.product-image-lightbox__image {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  border-radius: 8px;
  cursor: zoom-in;
  transition: cursor 0.2s ease;
}

.product-image-lightbox__image.is-zoomed {
  cursor: zoom-out;
}

/* Close button */
.product-image-lightbox__close {
  position: fixed;
  top: 16px;
  right: 16px;

  width: 44px;
  height: 44px;

  border: 0;
  border-radius: 999px;

  background: rgba(36, 34, 34, 0.92);
  color: #ffffff;

  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  z-index: 100000;
}

.product-image-lightbox__close:hover {
  background: #ffffff;
}

/* ❌ bỏ scroll xấu */
.product-image-lightbox .swiper {
  overflow: auto;
}

@media screen and (max-width: 767px) {
  .product-image-lightbox__dialog {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    margin: 8px auto;
    padding: 56px 12px 12px;
    top: 10px;
  }

  .product-image-lightbox__close {
    top: 10px;
    right: 10px;
  }
}

.product-image-lightbox__dialog {
  display: block;
}

.product-image-lightbox__viewport {
  grid-column: 1 / 4;
  grid-row: 2;
  overflow: auto;
  padding: 8px 0;
}

.product-image-lightbox__image {
  transition:
    opacity 0.14s ease,
    transform 0.14s ease;
}

.product-image-lightbox__image.is-switching-left {
  opacity: 0;
  transform: translateX(-22px);
}

.product-image-lightbox__image.is-switching-right {
  opacity: 0;
  transform: translateX(22px);
}

.product-image-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
  font-size: 24px;
  cursor: pointer;
  z-index: 3;
}

.product-image-lightbox__nav--prev {
  left: 12px;
}
.product-image-lightbox__nav--next {
  right: 12px;
}

.product-image-lightbox__swiper-prev,
.product-image-lightbox__swiper-next {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
}

.product-image-lightbox__swiper-prev::after,
.product-image-lightbox__swiper-next::after {
  font-size: 18px;
  font-weight: 700;
}

.product-image-lightbox__counter {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.7);
  color: #fff;
  font-size: 13px;
  z-index: 3;
}
