/* Carousel: gallery block + scroll-snap, không thư viện ngoài */
.ccn-carousel-box { position: relative; }
figure.ccn-carousel, figure.is-style-ccn-carousel {
  display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 8px;
  align-items: flex-start; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  background: transparent; padding: 0 0 6px; margin: 0;
  scrollbar-width: none;
}
figure.ccn-carousel::-webkit-scrollbar, figure.is-style-ccn-carousel::-webkit-scrollbar { display: none; }
figure.ccn-carousel .wp-block-image, figure.is-style-ccn-carousel .wp-block-image { flex: 0 0 100%; aspect-ratio: 16 / 10; margin: 0; scroll-snap-align: center; overflow: hidden; }
figure.ccn-carousel.has-nested-images, figure.is-style-ccn-carousel.has-nested-images figure.wp-block-image img,
figure.ccn-carousel.wp-block-gallery figure.wp-block-image img {
  width: 100% !important; height: 100% !important; max-height: none !important;
  border-radius: 10px; object-fit: cover !important;
}
.ccn-carousel-box .ccn-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(6,11,48,.6); color: #fff; font-size: 22px; line-height: 1;
  display: grid; place-items: center; z-index: 5; transition: background .15s;
}
.ccn-carousel-box .ccn-nav:hover { background: var(--ccn-blue-bright); }
.ccn-carousel-box .ccn-nav--prev { left: 10px; }
.ccn-carousel-box .ccn-nav--next { right: 10px; }
.ccn-carousel-box .ccn-dots {
  position: absolute; bottom: 18px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 8px; z-index: 5;
}
.ccn-carousel-box .ccn-dot {
  width: 9px; height: 9px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.65); cursor: pointer; transition: background .15s, transform .15s;
}
.ccn-carousel-box .ccn-dot.is-on { background: var(--ccn-orange); transform: scale(1.25); }
@media (max-width: 720px) { .ccn-carousel-box .ccn-nav { width: 34px; height: 34px; font-size: 18px; } }

/* Gallery ảnh sản phẩm (DOM riêng) */
.woocommerce-product-gallery { opacity: 1 !important; }
.ccn-pg { display: block; }
.ccn-pg-main { border-radius: 0; overflow: hidden; background: transparent; transition: height .25s ease; }
.ccn-pg-track {
  display: flex; flex-wrap: nowrap; align-items: flex-start; overflow-x: auto; gap: 0;
  scroll-snap-type: x mandatory; scrollbar-width: none;
}
.ccn-pg-track::-webkit-scrollbar { display: none; }
.ccn-pg-slide { flex: 0 0 100%; width: 100%; scroll-snap-align: center; }
.ccn-pg-slide img { width: 100%; height: auto; display: block; }
.ccn-pg-open { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.ccn-pg-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 10px 0 8px; }
.ccn-pg-nav button {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid #d7dee8; background: #fff;
  color: var(--ccn-navy, #060b30); font-size: 18px; line-height: 1; cursor: pointer;
  display: grid; place-items: center; padding: 0;
}
.ccn-pg-nav button:hover { background: var(--ccn-navy, #060b30); color: #fff; }
.ccn-pg-count { font-size: 13px; color: #64748b; min-width: 48px; text-align: center; }
.ccn-pg-thumbs {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 2px 0 4px; scroll-behavior: smooth;
}
.ccn-pg-thumbs::-webkit-scrollbar { display: none; }
.ccn-pg-thumb {
  flex: 0 0 62px; width: 62px; height: 62px; padding: 0; cursor: pointer; background: #f5f7fa;
  border: 2px solid transparent; border-radius: 0; overflow: hidden;
}
.ccn-pg-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ccn-pg-thumb.is-on { border-color: var(--ccn-orange, #e28a31); }
@media (max-width: 720px) { .ccn-pg-thumb { flex: 0 0 52px; width: 52px; height: 52px; } }

/* Lightbox */
.ccn-lb { position: fixed; inset: 0; z-index: 9999; display: none; align-items: center; justify-content: center;
  background: rgba(4, 8, 24, .92); padding: 24px; }
.ccn-lb.is-open { display: flex; }
.ccn-lb img { max-width: min(1100px, 92vw); max-height: 88vh; object-fit: contain; border-radius: 8px; }
.ccn-lb button { position: absolute; background: rgba(255,255,255,.12); color: #fff; border: 0; cursor: pointer;
  width: 44px; height: 44px; border-radius: 50%; font-size: 24px; line-height: 1; display: grid; place-items: center; }
.ccn-lb-close { top: 18px; right: 18px; font-size: 26px; }
.ccn-lb-prev { left: 18px; top: 50%; transform: translateY(-50%); }
.ccn-lb-next { right: 18px; top: 50%; transform: translateY(-50%); }
.ccn-lb button:hover { background: rgba(255,255,255,.28); }
/* tiêu đề mô tả sản phẩm to + giữa */
.ccn-product__body .wp-block-post-content h2:first-of-type { font-size: clamp(22px, 2.2vw, 30px); text-align: center; }

/* Bảng thông số kỹ thuật: full width, viền như bản gốc */
.ccn-product__body table { width: 100% !important; border-collapse: collapse; margin: 12px 0 18px; table-layout: fixed; }
.ccn-product__body table td, .ccn-product__body table th {
  border: 1px solid #cccccc; padding: 8px 10px; text-align: center; vertical-align: middle;
  word-wrap: break-word; width: auto;
}
.ccn-product__body table tr:first-child td, .ccn-product__body table tr:first-child th { font-weight: 600; }
/* Video và carousel tư liệu cao bằng nhau */
.ccn-video { aspect-ratio: 16 / 9; }
figure.ccn-carousel .wp-block-image, figure.is-style-ccn-carousel .wp-block-image { aspect-ratio: 16 / 9; }
.ccn-product__body figure.ccn-carousel, figure.is-style-ccn-carousel { padding-bottom: 0; }
/* Bố cục cột cho nội dung không phải block (sản phẩm dùng TinyMCE) */
.ccn-product__body .wp-block-columns { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.ccn-product__body .wp-block-column { flex: 1 1 0; min-width: 0; }
@media (max-width: 860px) { .ccn-product__body .wp-block-column { flex: 1 1 100%; } }
/* Khung 2 cột chèn từ editor cổ điển (nút "Chia cột") */
.ccn-cols { display: flex; flex-wrap: wrap; gap: 24px; }
.ccn-cols > .ccn-col { flex: 1 1 0; min-width: 0; }
@media (max-width: 860px) { .ccn-cols > .ccn-col { flex: 1 1 100%; } }

/* Carousel nhiều card: dots nằm dưới, không đè lên card */
.ccn-carousel-box--multi .ccn-dots { position: static; margin-top: 16px; }
.ccn-carousel-box--multi .ccn-nav { background: rgba(6,11,48,.72); }
.ccn-carousel-box--multi .ccn-hscroll { padding-bottom: 4px; }

/* Carousel card: nút nằm trên vùng ảnh, nền đặc hơn; thông số clamp cho đều card */
.ccn-carousel-box--multi .ccn-nav { top: 38%; background: rgba(6,11,48,.82); box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.ccn-carousel-box--multi .ccn-nav:hover { background: #1f5b96; }
.ccn-hscroll > .ccn-card .ccn-card__spec {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 9; overflow: hidden;
}

/* Slide sản phẩm: bám đúng CSS Elementor gốc (post-4633): khung 500px, nền #fafafa,
   ảnh 55% bên trái (center left), panel chữ bên phải, font Roboto / Roboto Condensed 20px. */
.ccn-prodslide { gap: 0; }
.ccn-prodslide > .ccn-slide {
  flex: 0 0 100%; box-sizing: border-box; height: var(--ccn-slide-h, 500px); overflow: hidden; background: #fafafa;
  display: grid; grid-template-columns: 55% 1fr; align-items: center;
}
.ccn-prodslide .ccn-slide__media { padding: 0 24px; display: flex; align-items: center; justify-content: center; }
.ccn-prodslide .ccn-slide__img { margin: 0; width: 100%; }
.ccn-prodslide .ccn-slide__img img { width: 100%; height: auto; max-height: var(--ccn-slide-h, 500px); object-fit: cover; display: block; }
.ccn-prodslide .ccn-slide__panel { padding: 30px 40px 30px 0; }
.ccn-slide__name {
  font-family: "Roboto", sans-serif; font-size: 20px; font-weight: 800; color: #1c1c1c;
  text-decoration: underline; text-transform: capitalize; border: 0; margin: 0;
}
.ccn-slide__label {
  font-family: "Roboto Condensed", sans-serif; font-size: 20px; font-weight: 700;
  color: #333; margin: 14px 0 0;
}
.ccn-slide__spec {
  font-family: "Roboto Condensed", sans-serif; font-size: 18px; font-weight: 400;
  line-height: 1.55; color: #2b2b2b; margin: 4px 0 0;
}
.ccn-slide__cta-wrap { margin-top: 18px; }
.ccn-slide__panel .wp-block-button__link {
  font-family: "Roboto Condensed", sans-serif; font-size: 16px; font-weight: 700;
  background: #5fc3e8; color: #fff !important; border-radius: 15px;
  padding: 10px 25px 10px 15px; text-transform: none;
}
.ccn-slide__panel .wp-block-button__link:hover { background: #3fb0da; }
.ccn-carousel-box--multi:has(.ccn-prodslide) .ccn-nav {
  width: 46px; height: 46px; border-radius: 4px; background: #e6e6e6; color: #555; font-size: 24px; box-shadow: none;
  top: 46%; transform: translateY(-50%); display: grid; place-items: center;
}
.ccn-carousel-box--multi:has(.ccn-prodslide) .ccn-nav:hover { background: #d8d8d8; color: #222; }
.ccn-carousel-box--multi:has(.ccn-prodslide) .ccn-nav--prev { left: 40px; }
.ccn-carousel-box--multi:has(.ccn-prodslide) .ccn-nav--next { right: 8px; }
.ccn-carousel-box--multi:has(.ccn-prodslide) .ccn-dots { margin-top: 12px; }
.ccn-carousel-box--multi:has(.ccn-prodslide) .ccn-dot { width: 10px; height: 10px; background: #cfcfcf; }
.ccn-carousel-box--multi:has(.ccn-prodslide) .ccn-dot.is-on { background: #6a6a6a; transform: none; }
@media (max-width: 900px) {
  .ccn-prodslide > .ccn-slide { grid-template-columns: 1fr; min-height: 0; }
  .ccn-prodslide .ccn-slide__panel { padding: 0 20px 20px; }
}
/* Ảnh slide: giữ đúng tỉ lệ gốc (site cũ dùng background-size 55% auto, không crop) */
.ccn-prodslide .ccn-slide__img { max-height: var(--ccn-slide-h, 500px); display: flex; align-items: center; justify-content: center; }
.ccn-prodslide .ccn-slide__img img {
  width: auto; height: auto; max-width: 100%; max-height: var(--ccn-slide-h, 500px);
  object-fit: contain; display: block; margin: 0 auto;
}
/* Carousel 3 ảnh/khung (CÔNG TRÌNH TIÊU BIỂU) — theo site gốc: 3 ảnh, gap 30, mũi tên mảnh nằm trong khung */
figure.ccn-carousel.ccn-carousel--3 { gap: 30px; padding-bottom: 0; align-items: stretch; }
figure.ccn-carousel.ccn-carousel--3 .wp-block-image {
  flex: 0 0 calc((100% - 60px) / 3); aspect-ratio: 7 / 6;
  border: 1px solid #e2e6ee; border-radius: 14px; overflow: hidden; background: #fff;
  box-shadow: 0 2px 10px rgba(16, 24, 40, .06);
}
figure.ccn-carousel.ccn-carousel--3.has-nested-images figure.wp-block-image img,
figure.ccn-carousel.ccn-carousel--3 .wp-block-image img { border-radius: 0 !important; }
.ccn-carousel-box--3 .ccn-nav {
  width: 40px; height: 60px; background: none; border: 0; border-radius: 0;
  color: rgba(237, 237, 237, .95); font-size: 50px; font-weight: 300;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .45);
}
.ccn-carousel-box--3 .ccn-nav:hover { background: none; color: #fff; }
.ccn-carousel-box--3 .ccn-nav--prev { left: 4px; }
.ccn-carousel-box--3 .ccn-nav--next { right: 4px; }
.ccn-carousel-box--3 .ccn-dots { position: static; margin-top: 16px; }
.ccn-carousel-box--3 .ccn-dot { width: 8px; height: 8px; background: rgba(0, 0, 0, .22); }
.ccn-carousel-box--3 .ccn-dot.is-on { background: #6EC1E4; transform: none; }
@media (max-width: 900px) {
  figure.ccn-carousel.ccn-carousel--3 { gap: 20px; }
  figure.ccn-carousel.ccn-carousel--3 .wp-block-image { flex: 0 0 calc((100% - 20px) / 2); }
}
@media (max-width: 640px) {
  figure.ccn-carousel.ccn-carousel--3 { gap: 12px; }
  figure.ccn-carousel.ccn-carousel--3 .wp-block-image { flex: 0 0 100%; }
}


/* --- Trang Gioi thieu: carousel chung nhan. Anh giu nguyen ti le, cao bang nhau, caption duoi anh.
   Selector phai manh hon rule chung cua gallery (figure.ccn-carousel.wp-block-gallery figure.wp-block-image img). --- */
figure.ccn-carousel.wp-block-gallery.ccn-about-certs__gal { align-items: flex-start; }
figure.ccn-carousel.wp-block-gallery.ccn-about-certs__gal figure.wp-block-image.ccn-about-certs__item {
  aspect-ratio: auto !important; height: 336px !important; overflow: visible !important;
  display: flex !important; flex-direction: column; align-items: center; justify-content: flex-start;
  border: 0 !important; background: none !important; box-shadow: none !important; }
figure.ccn-carousel.wp-block-gallery.ccn-about-certs__gal figure.wp-block-image.ccn-about-certs__item img {
  width: auto !important; height: 283px !important; max-width: 100% !important; max-height: 283px !important;
  object-fit: contain !important; margin: 0 auto;
  background: #fff; border: 1px solid #ececf3; border-radius: 4px; box-shadow: 0 2px 10px rgba(16, 24, 40, .06); }
figure.ccn-carousel.wp-block-gallery.ccn-about-certs__gal .wp-element-caption {
  position: static !important; inset: auto !important; color: #222 !important; background: none !important;
  margin: 14px 0 0 !important; padding: 0 !important; font-size: 16px; line-height: 1.35; text-align: center; }
@media (max-width: 900px) {
  figure.ccn-carousel.wp-block-gallery.ccn-about-certs__gal figure.wp-block-image.ccn-about-certs__item { height: 290px !important; }
  figure.ccn-carousel.wp-block-gallery.ccn-about-certs__gal figure.wp-block-image.ccn-about-certs__item img { height: 220px !important; max-height: 220px !important; }
  figure.ccn-carousel.wp-block-gallery.ccn-about-certs__gal .wp-element-caption { font-size: 14px; } }

/* MOBILE: slide sản phẩm xếp dọc, bỏ chiều cao cứng 500px để không cắt mất nội dung */
@media (max-width: 900px) {
  .ccn-prodslide > .ccn-slide { grid-template-columns: 1fr; height: auto !important; min-height: 0 !important; overflow: visible; }
  .ccn-prodslide .ccn-slide__media { padding: 16px 16px 0; }
  .ccn-prodslide .ccn-slide__img, .ccn-prodslide .ccn-slide__img img { max-height: 260px !important; }
  .ccn-prodslide .ccn-slide__panel { padding: 14px 18px 20px !important; }
  .ccn-prodslide .ccn-slide__name { font-size: 18px; }
  .ccn-prodslide .ccn-slide__label, .ccn-prodslide .ccn-slide__spec { font-size: 16px; }
  /* mũi tên đặt trên vùng ảnh, không đè lên tên sản phẩm */
  .ccn-carousel-box--multi:has(.ccn-prodslide) .ccn-nav { width: 34px; height: 44px; font-size: 18px; top: 140px !important; transform: none !important; }
  .ccn-carousel-box--multi:has(.ccn-prodslide) .ccn-nav--prev { left: 4px; }
  .ccn-carousel-box--multi:has(.ccn-prodslide) .ccn-nav--next { right: 4px; }
  .ccn-prodslide .ccn-slide__name { white-space: normal !important; overflow: visible !important; line-height: 1.3; }
}
