/* Photo Gallery - Modern Grid Layout (Airbnb-style) */
.photo-gallery-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  grid-template-rows: 250px 250px;
  gap: 8px;
  margin-bottom: 20px;
  height: auto;
  border-radius: 12px;
  overflow: hidden; /* This ensures the entire grid has rounded corners as one unit */
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 0; /* Remove individual image border radius */
  background-color: rgba(38, 38, 38, 0.5);
}

/* Apply rounded corners only to the outer corners of the grid */
.photo-gallery-grid .gallery-item:first-child {
  grid-row: 1 / span 2;
  grid-column: 1;
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}

/* Fix for middle-top image (2nd image) */
.photo-gallery-grid .gallery-item:nth-child(2) {
  border-radius: 0; /* Reset any border radius */
}

/* Only add top-right border radius to the 3rd image (top-right position) */
.photo-gallery-grid .gallery-item:nth-child(3) {
  border-top-right-radius: 12px;
}

.photo-gallery-grid .gallery-item:nth-child(5) {
  border-bottom-right-radius: 12px;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center; /* Will be overridden by SmartCrop */
  transition: transform 0.3s ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

/* Placeholder logo for profiles with fewer than 5 photos (desktop only) */
.gallery-item.gallery-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111;
}

.gallery-item.gallery-placeholder img {
  width: 50%;
  height: auto;
  object-fit: contain;
  opacity: 0.15;
}

.gallery-item.gallery-placeholder:hover img {
  transform: none;
}

/* Show all photos button */
.show-all-photos {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 5px;
}

.show-all-photos svg {
  flex-shrink: 0;
}

.show-all-photos .mobile-text {
  display: none;
}

.show-all-photos .desktop-text {
  display: inline;
}

@media (max-width: 480px) {
  .show-all-photos {
    padding: 6px 12px;
    font-size: 13px;
    bottom: 8px;
    right: 8px;
  }

  .show-all-photos .mobile-text {
    display: inline;
  }

  .show-all-photos .desktop-text {
    display: none;
  }
}

.show-all-photos:hover {
  background-color: rgba(0, 0, 0, 0.9);
}

/* Responsive for tablets */
@media (max-width: 768px) {
  .photo-gallery-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 200px 200px;
  }

  .photo-gallery-grid .gallery-item:first-child {
    grid-column: 1 / span 2;
    grid-row: 1;
    border-radius: 0;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
  }

  .photo-gallery-grid .gallery-item:nth-child(2) {
    border-radius: 0;
    border-bottom-left-radius: 12px;
  }

  .photo-gallery-grid .gallery-item:nth-child(3) {
    border-radius: 0;
    border-bottom-right-radius: 12px;
  }

  /* Show only the first 3 images on mobile */
  .photo-gallery-grid .gallery-item:nth-child(n+4) {
    display: none;
  }

  /* Hide placeholder logos on tablet */
  .gallery-item.gallery-placeholder {
    display: none !important;
  }
}

/* Responsive for mobile - Rotated desktop layout */
@media (max-width: 480px) {
  .photo-gallery-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 250px 125px 125px;
    gap: 8px;
    border-radius: 12px;
    overflow: hidden;
  }

  /* Image 1 - Full width at top with top rounded corners */
  .photo-gallery-grid .gallery-item:first-child {
    grid-column: 1 / -1;
    grid-row: 1;
    border-radius: 0;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
  }

  .photo-gallery-grid .gallery-item:first-child img {
    height: 100%;
    width: 100%;
    object-fit: cover;
  }

  /* Image 2 - Top left of grid (no special corners) */
  .photo-gallery-grid .gallery-item:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
    border-radius: 0;
    display: block;
  }

  /* Image 3 - Top right of grid (no special corners) */
  .photo-gallery-grid .gallery-item:nth-child(3) {
    grid-column: 2;
    grid-row: 2;
    border-radius: 0;
    display: block;
  }

  /* Image 4 - Bottom left with bottom-left rounded corner */
  .photo-gallery-grid .gallery-item:nth-child(4) {
    grid-column: 1;
    grid-row: 3;
    border-radius: 0;
    border-bottom-left-radius: 12px;
    display: block;
  }

  /* Image 5 - Bottom right with bottom-right rounded corner */
  .photo-gallery-grid .gallery-item:nth-child(5) {
    grid-column: 2;
    grid-row: 3;
    border-radius: 0;
    border-bottom-right-radius: 12px;
    display: block;
  }

  /* Hide placeholder logos on mobile */
  .gallery-item.gallery-placeholder {
    display: none !important;
  }

  /* All images after 5th - hide on mobile, shown via Fancybox */
  .photo-gallery-grid .gallery-item:nth-child(n+6) {
    display: none;
  }

  /* All grid images same height */
  .photo-gallery-grid .gallery-item:nth-child(n+2) img {
    height: 100%;
    width: 100%;
    object-fit: cover;
  }
}

/* ===== VIDEO GALLERY STYLES ===== */

/* Video Gallery Section */
.video-gallery-section {
  margin-bottom: 20px;
}

.video-gallery-section h2 {
  margin-bottom: 15px;
}

/* Mobile/Desktop visibility toggles */
.mobile-only {
  display: block;
}

.desktop-only {
  display: none !important;
}

@media (max-width: 768px) {
  .video-gallery-section {
    padding: 0 !important;
  }

  .video-gallery-section h2 {
    display: none;
  }

  .video-carousel {
    border-radius: 0;
    background: transparent;
  }

  .video-carousel-item video {
    border-radius: 0;
  }
}

@media (min-width: 769px) {
  .mobile-only {
    display: none !important;
  }

  .desktop-only {
    display: grid !important;
  }
}

/* ===== MOBILE: Swipe Carousel ===== */
.video-carousel {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 12px;
  background: #000;
  max-width: 100%;
}

/* Stories-style progress bar at top */
.video-carousel-progress {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, transparent 100%);
}

.video-carousel-progress .progress-segment {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.35);
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.video-carousel-progress .progress-segment.active {
  background: #fff;
}

.video-carousel-progress .progress-segment:hover {
  background: rgba(255,255,255,0.6);
}

.video-carousel-progress .progress-segment.active:hover {
  background: #fff;
}

.video-carousel-track {
  display: flex;
  transition: transform 0.3s ease-out;
  touch-action: pan-y;
  width: 100%;
}

.video-carousel-item {
  min-width: 100%;
  max-width: 100%;
  flex: 0 0 100%;
  flex-shrink: 0;
  background: #000;
  position: relative;
  overflow: hidden;
}

/* Landscape video container with blur background */
.video-carousel-item.landscape-video {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
}

.video-carousel-item.landscape-video .blur-background {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1.5);
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(30px) brightness(0.5);
  z-index: 1;
  pointer-events: none;
}

.video-carousel-item.landscape-video video:not(.blur-background) {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 50vh;
  object-fit: contain;
}

.video-carousel-item video {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  background: #000;
}

.video-carousel-item video::-webkit-media-controls-panel {
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
}

.video-carousel-item video::-webkit-media-controls-play-button,
.video-carousel-item video::-webkit-media-controls-volume-slider {
  filter: brightness(1.2);
}

/* Carousel dots */
.video-carousel-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px 0;
  background: rgba(0, 0, 0, 0.5);
}

.video-carousel-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all 0.3s ease;
}

.video-carousel-dots .dot.active {
  background: #fff;
  width: 24px;
  border-radius: 4px;
}

/* Carousel counter */
.video-carousel-counter {
  text-align: center;
  padding: 8px;
  font-size: 14px;
  color: #999;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 0 0 12px 12px;
}

.video-carousel-counter .current-video {
  color: #fff;
  font-weight: 600;
}

/* ===== DESKTOP: Grid Layout ===== */
.video-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.video-gallery-grid .gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-gallery-grid .gallery-item video {
  width: 100%;
  height: auto;
  display: block;
  background: #000;
  pointer-events: auto;
  max-height: 400px;
  object-fit: contain;
}

.vid-duration {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  z-index: 10;
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', monospace;
}

@media (max-width: 768px) {
  .vid-duration {
    top: 28px;
  }
}

.video-gallery-grid .gallery-item video::-webkit-media-controls-panel {
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
}

.video-gallery-grid .gallery-item video::-webkit-media-controls-play-button,
.video-gallery-grid .gallery-item video::-webkit-media-controls-volume-slider,
.video-gallery-grid .gallery-item video::-webkit-media-controls-timeline {
  filter: brightness(1.2);
}

/* Play button overlay */
.video-play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.video-gallery-grid .gallery-item:hover .video-play-overlay {
  opacity: 0.8;
}

/* Show all videos button */
.show-all-videos {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 5px;
}

.show-all-videos:hover {
  background-color: rgba(0, 0, 0, 0.9);
}