/**
 * Tour Media Gallery Styles
 */

.tour-media-gallery {
  position: relative;
  width: 100%;
}

/* Single item layout */
.media-single {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 12px;
  overflow: hidden;
}

.media-single .media-item {
  width: 100%;
  height: 100%;
}

/* Grid layout */
.media-grid {
  display: grid;
  grid-template-columns: var(--grid-2);
  grid-template-rows: var(--grid-2);
  gap: var(--space-xs);
  aspect-ratio: 1/1;
  border-radius: var(--border-radius-xl);
  overflow: hidden;
}

.grid-item {
  position: relative;
  overflow: hidden;
  background: #f5f5f5;
  cursor: pointer;
  transition: transform 0.2s ease;
}
.grid-item img {
  transition: transform 0.3s ease;
}

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

.grid-item.empty-cell {
  background: #e0e0e0;
  cursor: default;
}

.grid-item.empty-cell:hover {
  transform: none;
}

/* Media items */
.media-item {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.media-item img,
.media-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Video specific */
.video-item {
  position: relative;
}

.play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.3s ease;
  pointer-events: none;
}

.video-item:hover .play-overlay {
  background: rgba(0, 0, 0, 0.8);
}

.play-icon {
  color: white;
  font-size: 24px;
  margin-left: 4px;
  display: flex;
}

/* View all overlay */
.view-all-overlay {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 6px 12px;
  border-radius: var(--border-radius-xl);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.3s ease;
}

.view-all-overlay:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.05);
}

.view-all-icon {
  display: flex;
  align-items: center;
  gap: 4px;
}

.view-all-icon .camera-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .media-grid {
    /* Keep the grid layout on mobile */
    gap: 8px;
    border-radius: 8px;
  }

  .grid-item {
    /* Keep all grid items visible */
    border-radius: 6px;
  }

  .view-all-overlay {
    bottom: 12px;
    right: 12px;
    padding: 6px 12px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .media-grid {
    border-radius: 8px;
  }

  .media-single {
    border-radius: 8px;
  }

  .play-overlay {
    width: 50px;
    height: 50px;
  }

  .play-icon {
    font-size: 20px;
  }
}

/* Loading states */
.media-item img:not([src]) {
  background: #f0f0f0;
  opacity: 0.5;
}

.media-item.loading {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

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

/* PhotoSwipe Video Centering */
.pswp-video-wrapper {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 100% !important;
  padding-top: 44px; /* Account for top bar */
}

/* Hide PhotoSwipe Caption/Title Bar */
.pswp__caption {
  display: none !important;
}

/* Hide PhotoSwipe Zoom Button */
.pswp__button--zoom {
  display: none !important;
}

/* Hide PhotoSwipe Preloader (Loading Animation) */
.pswp__preloader {
  display: none !important;
}

.pswp-video-wrapper video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: default; /* Video itself should not show pointer */
}
