/**
 * Tour Gallery Styles - Balanced Layout
 * Improved symmetry and consistent styling
 */


/* Main Container */
.tour-gallery-container-xw7421 {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 4px;
  max-width: 100%;
  margin: 0 auto;
  position: relative;
  align-items: stretch;
}

/* Featured Image (Large) - Left Side */
.tour-gallery-main-xw7421 {
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: 16px 0 0 16px;
  /* มนเฉพาะด้านซ้าย (ด้านนอก) */
  background: transparent;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Gallery Grid Container - Right Side */
.tour-gallery-grid-xw7421 {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow: hidden;
  border-radius: 0 16px 16px 0;
  /* มนเฉพาะด้านขวา (ด้านนอก) */
  background: transparent;
  height: 100%;
  min-height: 0;
}

/* Carousel Wrapper */
.tour-gallery-carousel-xw7421 {
  flex: 1;
  overflow: hidden;
  position: relative;
  height: 100%;
  min-height: 0;
}

/* Track - holds all image groups */
.tour-gallery-track-xw7421 {
  display: flex;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  height: 100%;
  min-height: 0;
}

/* Each page of 4 images */
.tour-gallery-track-xw7421>* {
  flex: 0 0 100%;
  min-width: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 4px;
  padding: 0;
  height: 100%;
  min-height: 0;
}

/* Individual Grid Items */
.tour-gallery-grid-item-xw7421 {
  position: relative;
  overflow: hidden;
  border-radius: 0;
  /* ค่าเริ่มต้นไม่มนทุกมุม */
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  background: transparent;
}

/* มุมมนเฉพาะด้านนอก (ขวาบน/ขวาล่าง) ของ grid 2x2 */
/* Layout: [1][2] บน, [3][4] ล่าง */
.tour-gallery-grid-item-xw7421:nth-child(1) {
  border-radius: 0;
  /* ซ้ายบน - ไม่มน (ติดภาพใหญ่) */
}

.tour-gallery-grid-item-xw7421:nth-child(2) {
  border-radius: 0 16px 0 0;
  /* ขวาบน - มุมขวาบนมน */
}

.tour-gallery-grid-item-xw7421:nth-child(3) {
  border-radius: 0;
  /* ซ้ายล่าง - ไม่มน (ติดภาพใหญ่) */
}

.tour-gallery-grid-item-xw7421:nth-child(4) {
  border-radius: 0 0 16px 0;
  /* ขวาล่าง - มุมขวาล่างมน */
}

/* Gallery Items */
.tour-gallery-item-xw7421 {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  display: block;
  overflow: hidden;
}

.tour-gallery-item-xw7421 img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  opacity: 0;
}

.tour-gallery-item-xw7421 img.loaded {
  opacity: 1;
}

.tour-gallery-item-xw7421:hover img,
.tour-gallery-item-xw7421:focus img {
  transform: scale(1.05);
}

.tour-gallery-item-xw7421::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0);
  transition: background 0.3s ease;
  z-index: 1;
  pointer-events: none;
}

.tour-gallery-item-xw7421:hover::before {
  background: rgba(0, 0, 0, 0.1);
}

.tour-gallery-item-xw7421:focus {
  outline: 3px solid #0073aa;
  outline-offset: 2px;
  z-index: 2;
}

.tour-gallery-item-xw7421:focus-visible {
  outline: 3px solid #0073aa;
  outline-offset: 2px;
}

/* Skeleton Loading */
.tour-gallery-skeleton-xw7421 {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
      #f0f0f0 0%,
      #e0e0e0 20%,
      #f0f0f0 40%,
      #f0f0f0 100%);
  background-size: 200% 100%;
  animation: skeleton-loading-xw7421 1.8s ease-in-out infinite;
  transition: opacity 0.3s ease;
  z-index: 1;
}

@keyframes skeleton-loading-xw7421 {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* Carousel Navigation Buttons */
.tour-gallery-nav-xw7421 {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.tour-gallery-nav-xw7421:hover:not(:disabled) {
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  transform: translateY(-50%) scale(1.08);
}

.tour-gallery-nav-xw7421:active:not(:disabled) {
  transform: translateY(-50%) scale(0.95);
}

.tour-gallery-nav-xw7421:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.tour-gallery-nav-xw7421:focus-visible {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

.tour-gallery-prev-xw7421 {
  left: 10px;
}

.tour-gallery-next-xw7421 {
  right: 10px;
}

.tour-gallery-nav-xw7421 svg {
  color: #333;
  width: 18px;
  height: 18px;
  stroke-width: 2.5;
}

/* Lightbox Modal */
.tour-gallery-lightbox-xw7421 {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tour-gallery-lightbox-xw7421.active {
  display: flex;
  opacity: 1;
}

.tour-gallery-lightbox-overlay-xw7421 {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.94);
  backdrop-filter: blur(12px);
  cursor: pointer;
}

.tour-gallery-lightbox-content-xw7421 {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 100px;
  z-index: 1;
}

/* Lightbox Controls */
.tour-gallery-lightbox-close-xw7421 {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  z-index: 10;
  backdrop-filter: blur(8px);
}

.tour-gallery-lightbox-close-xw7421:hover,
.tour-gallery-lightbox-close-xw7421:focus {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.tour-gallery-lightbox-close-xw7421:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.tour-gallery-lightbox-prev-xw7421,
.tour-gallery-lightbox-next-xw7421 {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  z-index: 10;
  backdrop-filter: blur(8px);
}

.tour-gallery-lightbox-prev-xw7421:hover,
.tour-gallery-lightbox-next-xw7421:hover,
.tour-gallery-lightbox-prev-xw7421:focus,
.tour-gallery-lightbox-next-xw7421:focus {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-50%) scale(1.05);
}

.tour-gallery-lightbox-prev-xw7421:active,
.tour-gallery-lightbox-next-xw7421:active {
  transform: translateY(-50%) scale(0.95);
}

.tour-gallery-lightbox-prev-xw7421:focus-visible,
.tour-gallery-lightbox-next-xw7421:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.tour-gallery-lightbox-prev-xw7421 {
  left: 24px;
}

.tour-gallery-lightbox-next-xw7421 {
  right: 24px;
}

/* Lightbox Image */
.tour-gallery-lightbox-image-wrapper-xw7421 {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.tour-gallery-lightbox-image-xw7421 {
  max-width: 100%;
  max-height: calc(100vh - 280px);
  width: auto;
  height: auto;
  object-fit: contain;
  transition: opacity 0.25s ease;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.tour-gallery-lightbox-counter-xw7421 {
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  margin-top: 16px;
  margin-bottom: 12px;
  padding: 8px 18px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 20px;
  backdrop-filter: blur(8px);
  letter-spacing: 0.3px;
}

/* Thumbnail Carousel */
.tour-gallery-lightbox-thumbs-xw7421 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  max-width: 800px;
  width: 100%;
}

.tour-gallery-thumbs-track-xw7421 {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 8px 0;
  flex: 1;
  scrollbar-width: none;
  /* Firefox */
  -ms-overflow-style: none;
  /* IE/Edge */
}

.tour-gallery-thumbs-track-xw7421::-webkit-scrollbar {
  display: none;
  /* Chrome/Safari */
}

.tour-gallery-thumb-item-xw7421 {
  flex: 0 0 auto;
  width: 80px;
  height: 60px;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: transparent;
  padding: 0;
  transition: all 0.25s ease;
  opacity: 0.6;
}

.tour-gallery-thumb-item-xw7421:hover {
  opacity: 0.9;
  border-color: rgba(255, 255, 255, 0.6);
  transform: scale(1.05);
}

.tour-gallery-thumb-item-xw7421.active {
  opacity: 1;
  border-color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.tour-gallery-thumb-item-xw7421 img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tour-gallery-thumb-nav-xw7421 {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  backdrop-filter: blur(8px);
}

.tour-gallery-thumb-nav-xw7421:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.08);
}

.tour-gallery-thumb-nav-xw7421:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.tour-gallery-thumb-nav-xw7421 svg {
  color: #fff;
  width: 18px;
  height: 18px;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .tour-gallery-container-xw7421 {
    grid-template-columns: 1.3fr 1fr;
  }
}

@media (max-width: 968px) {
  .tour-gallery-container-xw7421 {
    grid-template-columns: 1.5fr 1fr;
  }

  .tour-gallery-nav-xw7421 {
    width: 34px;
    height: 34px;
  }

  .tour-gallery-prev-xw7421 {
    left: 8px;
  }

  .tour-gallery-next-xw7421 {
    right: 8px;
  }

  .tour-gallery-nav-xw7421 svg {
    width: 16px;
    height: 16px;
  }
}

@media (max-width: 768px) {
  .tour-gallery-container-xw7421 {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  /* บนมือถือภาพใหญ่อยู่ด้านบน */
  .tour-gallery-main-xw7421 {
    aspect-ratio: 16 / 10;
    border-radius: 16px 16px 0 0;
    /* มนเฉพาะด้านบน */
  }

  /* ภาพเล็กอยู่ด้านล่าง */
  .tour-gallery-grid-xw7421 {
    min-height: 280px;
    border-radius: 0 0 16px 16px;
    /* มนเฉพาะด้านล่าง */
  }

  .tour-gallery-track-xw7421>* {
    gap: 4px;
  }

  /* ปรับมุมมนสำหรับ mobile (แนวตั้ง) - ล่างซ้าย/ล่างขวา */
  .tour-gallery-grid-item-xw7421:nth-child(1) {
    border-radius: 0;
  }

  .tour-gallery-grid-item-xw7421:nth-child(2) {
    border-radius: 0;
  }

  .tour-gallery-grid-item-xw7421:nth-child(3) {
    border-radius: 0 0 0 12px;
    /* มุมซ้ายล่าง */
  }

  .tour-gallery-grid-item-xw7421:nth-child(4) {
    border-radius: 0 0 12px 0;
    /* มุมขวาล่าง */
  }

  .tour-gallery-nav-xw7421 {
    width: 32px;
    height: 32px;
  }

  .tour-gallery-prev-xw7421 {
    left: 8px;
  }

  .tour-gallery-next-xw7421 {
    right: 8px;
  }

  .tour-gallery-lightbox-content-xw7421 {
    padding: 50px 24px 80px;
  }

  .tour-gallery-lightbox-prev-xw7421,
  .tour-gallery-lightbox-next-xw7421 {
    width: 48px;
    height: 48px;
  }

  .tour-gallery-lightbox-prev-xw7421 {
    left: 12px;
  }

  .tour-gallery-lightbox-next-xw7421 {
    right: 12px;
  }

  .tour-gallery-lightbox-close-xw7421 {
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
  }

  .tour-gallery-lightbox-thumbs-xw7421 {
    max-width: 100%;
    gap: 8px;
  }

  .tour-gallery-thumb-item-xw7421 {
    width: 70px;
    height: 52px;
  }

  .tour-gallery-thumb-nav-xw7421 {
    width: 32px;
    height: 32px;
  }

  .tour-gallery-thumb-nav-xw7421 svg {
    width: 16px;
    height: 16px;
  }
}

@media (max-width: 580px) {
  .tour-gallery-container-xw7421 {
    gap: 3px;
  }

  .tour-gallery-main-xw7421 {
    aspect-ratio: 4 / 3;
    border-radius: 14px 14px 0 0;
    /* มนเฉพาะด้านบน */
  }

  .tour-gallery-grid-xw7421 {
    min-height: 240px;
    border-radius: 0 0 14px 14px;
    /* มนเฉพาะด้านล่าง */
  }

  .tour-gallery-track-xw7421>* {
    gap: 3px;
  }

  /* ปรับมุมมนให้เล็กลงบน mobile */
  .tour-gallery-grid-item-xw7421:nth-child(3) {
    border-radius: 0 0 0 10px;
    /* มุมซ้ายล่าง */
  }

  .tour-gallery-grid-item-xw7421:nth-child(4) {
    border-radius: 0 0 10px 0;
    /* มุมขวาล่าง */
  }
}

@media (max-width: 480px) {
  .tour-gallery-container-xw7421 {
    gap: 3px;
  }

  .tour-gallery-main-xw7421 {
    aspect-ratio: 4 / 3;
  }

  .tour-gallery-grid-xw7421 {
    min-height: 200px;
  }

  .tour-gallery-track-xw7421>* {
    gap: 3px;
  }

  .tour-gallery-nav-xw7421 {
    width: 30px;
    height: 30px;
  }

  .tour-gallery-prev-xw7421 {
    left: 6px;
  }

  .tour-gallery-next-xw7421 {
    right: 6px;
  }

  .tour-gallery-nav-xw7421 svg {
    width: 14px;
    height: 14px;
  }

  .tour-gallery-nav-xw7421 {
    width: 28px;
    height: 28px;
  }

  .tour-gallery-prev-xw7421 {
    left: -14px;
  }

  .tour-gallery-next-xw7421 {
    right: -14px;
  }

  .tour-gallery-nav-xw7421 svg {
    width: 16px;
    height: 16px;
  }

  .tour-gallery-thumb-item-xw7421 {
    width: 60px;
    height: 45px;
  }

  .tour-gallery-thumb-nav-xw7421 {
    width: 28px;
    height: 28px;
  }

  .tour-gallery-thumb-nav-xw7421 svg {
    width: 14px;
    height: 14px;
  }
}

/* Print Styles */
@media print {

  .tour-gallery-nav-xw7421,
  .tour-gallery-lightbox-xw7421 {
    display: none !important;
  }

  .tour-gallery-container-xw7421 {
    break-inside: avoid;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .tour-gallery-item-xw7421:focus {
    outline-width: 4px;
  }

  .tour-gallery-nav-xw7421 {
    background: #fff;
    border: 2px solid #000;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {

  .tour-gallery-item-xw7421 img,
  .tour-gallery-track-xw7421,
  .tour-gallery-lightbox-xw7421,
  .tour-gallery-skeleton-xw7421,
  .tour-gallery-nav-xw7421,
  .tour-gallery-lightbox-close-xw7421,
  .tour-gallery-lightbox-prev-xw7421,
  .tour-gallery-lightbox-next-xw7421 {
    transition: none;
    animation: none;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {

  .tour-gallery-main-xw7421,
  .tour-gallery-grid-xw7421,
  .tour-gallery-grid-item-xw7421 {
    background: transparent;
  }

  .tour-gallery-skeleton-xw7421 {
    background: linear-gradient(90deg,
        #2a2a2a 0%,
        #3a3a3a 20%,
        #2a2a2a 40%,
        #2a2a2a 100%);
  }
}
