/**
 * Epic Tour Gallery Plugin CSS
 * Scoped styles for TourRadar & GetYourGuide product gallery
 */

/* ==========================================================================
   1. BASE WRAPPER
   ========================================================================== */
.etg-wrapper {
  position: relative;
  width: 100%;
  margin-bottom: 24px;
  user-select: none;
  box-sizing: border-box;
  container-type: inline-size;
}

.etg-wrapper *,
.etg-wrapper *::before,
.etg-wrapper *::after,
.etg-lightbox *,
.etg-mob-modal * {
  box-sizing: border-box;
}

/* ==========================================================================
   2. DESKTOP GRID (>= 768px)
   ========================================================================== */
.etg-desktop-view {
  display: block;
  width: 100%;
  position: relative;
}

.etg-desktop-grid {
  position: relative;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
}

/* Five photos: wide lead over two small tiles, with a two-photo stack on the right. */
.etg-desktop-grid--5 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(0, 1.43fr);
  grid-template-rows: minmax(0, 1.5fr) minmax(0, 0.5fr) minmax(0, 1fr);
  grid-template-areas:
    "lead lead upper"
    "lead lead lower"
    "small-a small-b lower";
  gap: 10px;
  gap: clamp(8px, 1cqw, 14px);
  height: 460px;
}
.etg-desktop-grid--5 .etg-desk-item-0 { grid-area: lead; }
.etg-desktop-grid--5 .etg-desk-item-1 { grid-area: upper; }
.etg-desktop-grid--5 .etg-desk-item-2 { grid-area: small-a; }
.etg-desktop-grid--5 .etg-desk-item-3 { grid-area: small-b; }
.etg-desktop-grid--5 .etg-desk-item-4 { grid-area: lower; }

/* 4 Images Fallback */
.etg-desktop-grid--4 {
  display: grid;
  grid-template-columns: 1.45fr 1.2fr 1fr;
  grid-template-rows: repeat(2, 1fr);
  gap: 8px;
  height: 460px;
}
.etg-desktop-grid--4 .etg-desk-item-0 { grid-column: 1; grid-row: 1 / 3; }
.etg-desktop-grid--4 .etg-desk-item-1 { grid-column: 2; grid-row: 1 / 3; }
.etg-desktop-grid--4 .etg-desk-item-2 { grid-column: 3; grid-row: 1; }
.etg-desktop-grid--4 .etg-desk-item-3 { grid-column: 3; grid-row: 2; }

/* 3 Images Fallback */
.etg-desktop-grid--3 {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  grid-template-rows: repeat(2, 1fr);
  gap: 8px;
  height: 440px;
}
.etg-desktop-grid--3 .etg-desk-item-0 { grid-column: 1; grid-row: 1 / 3; }
.etg-desktop-grid--3 .etg-desk-item-1 { grid-column: 2; grid-row: 1; }
.etg-desktop-grid--3 .etg-desk-item-2 { grid-column: 2; grid-row: 2; }

/* 2 Images Fallback */
.etg-desktop-grid--2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  height: 420px;
}

/* 1 Image Fallback */
.etg-desktop-grid--1 {
  display: block;
  height: 420px;
}
.etg-desktop-grid--1 .etg-desk-item {
  height: 100%;
}

/* Desktop Grid Item */
.etg-desk-item {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background-color: #eaedf0;
  cursor: pointer;
}

.etg-desk-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), filter 0.3s ease;
}

.etg-desk-item:hover img {
  transform: scale(1.04);
}

.etg-desk-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.08);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.etg-desk-item:hover::after {
  opacity: 1;
}

/* Glassmorphic "View all" Button (No Number) */
.etg-btn-view-all {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  background: rgba(18, 20, 26, 0.55);
  backdrop-filter: blur(10px) saturate(180%);
  -webkit-backdrop-filter: blur(10px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  color: #ffffff !important;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  text-decoration: none !important;
}

.etg-btn-view-all:hover {
  background: rgba(28, 32, 40, 0.78);
  border-color: rgba(255, 255, 255, 0.65);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  color: #ffffff !important;
}

.etg-btn-view-all svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: block;
}
.etg-btn-view-all svg path {
  fill: #ffffff !important;
}

/* ==========================================================================
   3. DESKTOP LIGHTBOX MODAL (>= 768px)
   ========================================================================== */
.etg-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999999;
  background: rgba(12, 14, 18, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  user-select: none;
}

.etg-lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.etg-lightbox-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  flex-shrink: 0;
  z-index: 30;
}

.etg-lightbox-counter {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  letter-spacing: 0.3px;
}

.etg-lightbox-close {
  background: rgba(255, 255, 255, 0.16) !important;
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.35) !important;
  color: #ffffff !important;
  width: 42px;
  height: 42px;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.etg-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.28) !important;
  border-color: rgba(255, 255, 255, 0.65) !important;
  transform: scale(1.08);
}

.etg-lightbox-close svg {
  width: 20px;
  height: 20px;
  display: block;
}
.etg-lightbox-close svg path {
  fill: #ffffff !important;
}

.etg-lightbox-stage {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 70px;
  min-height: 0;
  width: 100%;
}

.etg-lightbox-img-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.etg-lightbox-main-img {
  max-width: 90vw;
  max-height: calc(100vh - 170px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.7);
  transition: opacity 0.18s ease;
}

.etg-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.18) !important;
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.38) !important;
  box-shadow: 0 4px 22px rgba(0, 0, 0, 0.4);
  display: flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 25;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0;
  outline: none;
}

.etg-lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.32) !important;
  border-color: rgba(255, 255, 255, 0.7) !important;
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.5);
}

.etg-lightbox-prev { left: 20px; }
.etg-lightbox-next { right: 20px; }

.etg-lightbox-nav svg {
  width: 28px;
  height: 28px;
  display: block;
  flex-shrink: 0;
}
.etg-lightbox-nav svg path {
  fill: #ffffff !important;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.etg-lightbox-thumbs-bar {
  padding: 10px 24px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-shrink: 0;
  max-width: 100%;
  z-index: 20;
}

.etg-lightbox-thumbs-nav {
  background: rgba(255, 255, 255, 0.16) !important;
  backdrop-filter: blur(10px) saturate(160%);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  width: 36px;
  height: 36px;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
  padding: 0;
}

.etg-lightbox-thumbs-nav:hover {
  background: rgba(255, 255, 255, 0.3) !important;
  border-color: rgba(255, 255, 255, 0.6) !important;
  transform: scale(1.08);
}

.etg-lightbox-thumbs-nav svg {
  width: 18px;
  height: 18px;
  display: block;
}
.etg-lightbox-thumbs-nav svg path {
  fill: #ffffff !important;
}

.etg-lightbox-thumbs-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  padding: 4px 2px;
  max-width: 860px;
}

.etg-lightbox-thumbs-scroll::-webkit-scrollbar {
  height: 5px;
}
.etg-lightbox-thumbs-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.etg-lightbox-thumb {
  flex: 0 0 92px;
  height: 62px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  opacity: 0.85;
  border: 2px solid transparent;
  transition: opacity 0.2s ease, border-color 0.2s ease;
  background: #1c1d22;
}

.etg-lightbox-thumb:hover {
  opacity: 1;
}

.etg-lightbox-thumb.is-active {
  opacity: 1;
  border-color: #DC8376;
  box-shadow: 0 0 14px rgba(220, 131, 118, 0.4);
}

.etg-lightbox-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ==========================================================================
   4. MOBILE GETYOURGUIDE CAROUSEL (< 768px)
   ========================================================================== */
.etg-mobile-view {
  display: none;
}

@media (max-width: 767px) {
  .etg-desktop-view,
  .etg-lightbox {
    display: none !important;
  }

  .etg-mobile-view {
    display: block !important;
    position: relative;
    width: 100%;
    margin-bottom: 20px;
  }

  .etg-mob-carousel {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 16px;
    margin: 0 -16px;
  }
  .etg-mob-carousel::-webkit-scrollbar {
    display: none;
  }

  .etg-mob-slide {
    flex: 0 0 88%;
    scroll-snap-align: center;
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    height: 350px;
    background: #f1f3f5;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  }

  /* Slide 1: 3-Image Collage */
  .etg-mob-slide-collage {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    box-shadow: none;
  }

  .etg-mob-collage-top {
    width: 100%;
    height: 215px;
    position: relative;
    overflow: hidden;
    border-radius: 18px 18px 4px 4px;
    background: #eaedf0;
  }
  .etg-mob-collage-top img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .etg-mob-collage-bottom {
    display: flex;
    gap: 4px;
    height: 131px;
    width: 100%;
  }

  .etg-mob-collage-sub {
    flex: 1;
    height: 100%;
    position: relative;
    overflow: hidden;
    background: #eaedf0;
  }
  .etg-mob-collage-sub:first-child {
    border-radius: 4px 4px 4px 18px;
  }
  .etg-mob-collage-sub:last-child {
    border-radius: 4px 4px 18px 4px;
  }
  .etg-mob-collage-sub img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  /* Single Photo Slide */
  .etg-mob-slide-single {
    border-radius: 18px;
    overflow: hidden;
    position: relative;
  }
  .etg-mob-slide-single img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  /* "Tümünü görüntüle" Center Overlay (Image 1) */
  .etg-mob-view-all-overlay {
    position: absolute;
    inset: 0;
    background: rgba(16, 20, 26, 0.52);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
    user-select: none;
    z-index: 5;
  }
  .etg-mob-view-all-overlay svg {
    width: 28px;
    height: 28px;
    display: block;
  }
  .etg-mob-view-all-overlay svg path {
    fill: #ffffff !important;
  }

  /* Dots Pill Indicator */
  .etg-mob-dots {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(245, 247, 250, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  }
  .etg-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(40, 44, 52, 0.35);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .etg-dot.is-active {
    width: 18px;
    border-radius: 4px;
    background: #1c1e24;
  }
}

/* ==========================================================================
   5. MOBILE FULLSCREEN MODAL (GetYourGuide Feed & Swiper)
   ========================================================================== */
.etg-mob-modal {
  position: fixed;
  inset: 0;
  z-index: 99999999;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.etg-modal-view {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  overflow: hidden;
}

.etg-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  min-height: 56px;
  flex-shrink: 0;
  border-bottom: 1px solid #f0f0f0;
  background: #ffffff;
  z-index: 10;
}

.etg-modal-counter {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
  letter-spacing: 0.3px;
}

.etg-modal-btn {
  width: 40px;
  height: 40px;
  border-radius: 50% !important;
  background: #f4f5f7 !important;
  border: none !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: background 0.2s ease;
}
.etg-modal-btn:hover {
  background: #e6e8eb !important;
}
.etg-modal-btn svg {
  display: block;
}
.etg-modal-btn svg path {
  fill: #1a1a1a !important;
}

/* ==========================================================================
   6. ROCK-SOLID 2-COLUMN PHOTO FEED (Zero Overlap Guaranteed via Flexbox)
   ========================================================================== */
.etg-modal-feed {
  flex: 1 !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  padding: 14px 14px 40px !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  justify-content: space-between !important;
  align-content: flex-start !important;
  align-items: flex-start !important;
  box-sizing: border-box !important;
  width: 100% !important;
  min-height: 0;
}

.etg-modal-card {
  width: calc(50% - 6px) !important;
  max-width: calc(50% - 6px) !important;
  flex: 0 0 calc(50% - 6px) !important;
  margin: 0 0 12px 0 !important;
  padding: 0 !important;
  border-radius: 14px !important;
  overflow: hidden !important;
  position: relative !important;
  background: #f0f2f5 !important;
  cursor: pointer !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
  box-sizing: border-box !important;
}

/* 4:3 Aspect Ratio via Intrinsic Padding (Zero Height Collapse, Zero Overlap) */
.etg-modal-card-inner {
  display: block;
  position: relative !important;
  width: 100% !important;
  height: 0 !important;
  padding-top: 75% !important; /* 4:3 Aspect Ratio */
  overflow: hidden !important;
  border-radius: 14px !important;
  box-sizing: border-box !important;
}

.etg-modal-card-inner img {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
  border-radius: 14px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  transition: transform 0.25s ease !important;
}

.etg-modal-card:active .etg-modal-card-inner img {
  transform: scale(0.96) !important;
}

/* Single Photo Stage (Image 3) */
.etg-modal-single-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  position: relative;
  overflow: hidden;
  background: #ffffff;
  user-select: none;
}

.etg-modal-single-img {
  max-width: 100%;
  max-height: calc(100vh - 180px);
  max-height: calc(100dvh - 180px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  transition: opacity 0.18s ease;
}

/* Theme-safe controls: Flatsome button defaults must not resize photo tiles. */
.etg-component button,
.etg-lightbox button,
.etg-mob-modal button {
  margin: 0;
  min-width: 0;
  min-height: 0;
  letter-spacing: normal;
  text-transform: none;
  font: inherit;
}
.etg-wrapper .etg-desk-item,
.etg-wrapper .etg-trigger-photo,
.etg-wrapper .etg-trigger-feed,
.etg-lightbox .etg-lightbox-thumb {
  display: block;
  padding: 0;
  border: 0;
  line-height: 1;
  box-shadow: none;
}
.etg-wrapper .etg-desk-item { width: 100%; }
.etg-lightbox .etg-lightbox-thumb { border: 2px solid transparent; }
.etg-lightbox .etg-lightbox-thumb.is-active { border-color: #DC8376; }
.etg-component button:focus-visible,
.etg-lightbox button:focus-visible,
.etg-mob-modal button:focus-visible {
  outline: 3px solid #DC8376;
  outline-offset: -4px;
}
.etg-lightbox [hidden],
.etg-mob-modal [hidden] { display: none !important; }
.etg-image-error {
  position: absolute;
  margin: 20px;
  padding: 14px 20px;
  color: #fff;
  background: #502F2A;
  border-radius: 8px;
  text-align: center;
}
.etg-mobile-navigation {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px max(16px, env(safe-area-inset-bottom));
  flex-shrink: 0;
}
.etg-mobile-navigation button {
  flex: 1;
  background: #f4f5f7;
  border: 1px solid #e6ddd8;
  color: #502F2A;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.4;
}
.etg-modal-header { padding-top: max(12px, env(safe-area-inset-top)); }
.etg-mob-modal { overscroll-behavior: contain; }
.etg-modal-feed { overscroll-behavior: contain; }
@supports (width: 1cqw) {
  .etg-desktop-grid { height: clamp(300px, 50cqw, 460px); }
  .etg-desktop-grid--5 { height: clamp(280px, 51cqw, 565px); }
}
@media (max-width: 767px) {
  .etg-mob-slide:only-child { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .etg-wrapper *, .etg-lightbox, .etg-lightbox *, .etg-mob-modal * {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
