.gallery-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  color: white;
  user-select: none;
  overflow: hidden;
}

/* Content area */
.gallery-content {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  perspective: 1000px;
}

.gallery-content-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  opacity: 0;
  position: absolute;
  transition: transform 0.6s ease, opacity 0.6s ease;
  backface-visibility: hidden;
}

.gallery-content-item.active {
  opacity: 1;
  position: relative;
}

/* Transition effects */
.gallery-content-item.entering.slide-left {
  transform: translateX(100%);
  animation: slideInLeft 0.6s forwards;
}

.gallery-content-item.leaving.slide-left {
  animation: slideOutLeft 0.6s forwards;
}

@keyframes slideInLeft {
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutLeft {
  to { transform: translateX(-100%); opacity: 0; }
}

.gallery-content-item.entering.slide-right {
  transform: translateX(-100%);
  animation: slideInRight 0.6s forwards;
}

.gallery-content-item.leaving.slide-right {
  animation: slideOutRight 0.6s forwards;
}

@keyframes slideInRight {
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
  to { transform: translateX(100%); opacity: 0; }
}

.gallery-content-item.entering.fade-zoom {
  transform: scale(0.8);
  animation: fadeZoomIn 0.6s forwards;
}

.gallery-content-item.leaving.fade-zoom {
  animation: fadeZoomOut 0.6s forwards;
}

@keyframes fadeZoomIn {
  to { transform: scale(1); opacity: 1; }
}

@keyframes fadeZoomOut {
  to { transform: scale(1.2); opacity: 0; }
}

.gallery-content-item.entering.flip {
  transform: rotateY(-90deg);
  animation: flipIn 0.6s forwards;
}

.gallery-content-item.leaving.flip {
  animation: flipOut 0.6s forwards;
}

@keyframes flipIn {
  to { transform: rotateY(0deg); opacity: 1; }
}

@keyframes flipOut {
  to { transform: rotateY(90deg); opacity: 0; }
}

.gallery-content-item.entering.cube {
  transform: translateZ(-400px) rotateY(90deg);
  animation: cubeIn 0.6s forwards;
}

.gallery-content-item.leaving.cube {
  animation: cubeOut 0.6s forwards;
}

@keyframes cubeIn {
  to { transform: translateZ(0) rotateY(0deg); opacity: 1; }
}

@keyframes cubeOut {
  to { transform: translateZ(-400px) rotateY(-90deg); opacity: 0; }
}

.gallery-content-item.entering.drop {
  transform: translateY(-100%);
  animation: dropIn 0.6s forwards cubic-bezier(.17,.67,.83,.67);
}

.gallery-content-item.leaving.drop {
  animation: dropOut 0.6s forwards cubic-bezier(.17,.67,.83,.67);
}

@keyframes dropIn {
  to { transform: translateY(0); opacity: 1; }
}

@keyframes dropOut {
  to { transform: translateY(100%); opacity: 0; }
}

.gallery-content img,
.gallery-content video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.gallery-content video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gallery-audio-wrapper, .gallery-location-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gallery-audio-icon {
  font-size: 80px;
  margin-bottom: 20px;
  color: #f1f1f1;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
  100% { transform: scale(1); opacity: 1; }
}

.gallery-text-content {
  max-width: 80%;
  max-height: 80%;
  padding: 20px;
  overflow-y: auto;
  background-color: rgba(40, 40, 40, 0.7);
  border-radius: 8px;
  font-size: 18px;
  line-height: 1.6;
}

/* Caption design */
.gallery-caption-wrapper {
  position: absolute;
  bottom: 100px;
  left: 20px;
  right: 20px;
  background-color: rgba(0, 0, 0, 0.7);
  border-radius: 5px;
  padding: 10px 15px;
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.4s ease, opacity 0.4s ease;
  z-index: 15;
  max-height: 100px;
  overflow: hidden;
}

.gallery-caption-wrapper.show {
  transform: translateY(0);
  opacity: 1;
}

.gallery-caption {
  white-space: nowrap;
  overflow: hidden;
  font-size: 16px;
  line-height: 1.4;
}

.gallery-caption.scrolling {
  animation: scrollCaption linear forwards;
  padding-right: 50px;
}

@keyframes scrollCaption {
  0% { transform: translateX(0); }
  10% { transform: translateX(0); }
  90% { transform: translateX(calc(-100% + 250px)); }
  100% { transform: translateX(calc(-100% + 250px)); }
}

/* Controls */
.gallery-controls {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 80px;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.gallery-controls > * {
  pointer-events: auto;
}

.controls-visible .gallery-controls,
.controls-visible .gallery-thumbnails,
.controls-visible .gallery-info,
.controls-visible .gallery-caption-wrapper.show {
  opacity: 1;
}

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  border-radius: 50%;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s;
  z-index: 15;
}

.gallery-nav:hover {
  background-color: rgba(50, 50, 50, 0.8);
  transform: translateY(-50%) scale(1.1);
}

.gallery-nav-left {
  left: 20px;
}

.gallery-nav-right {
  right: 20px;
}

.gallery-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  border-radius: 50%;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s;
  z-index: 15;
}

.gallery-close:hover {
  background-color: rgba(255, 0, 0, 0.5);
  transform: scale(1.1);
}

.gallery-play {
  position: absolute;
  bottom: 100px;
  right: 20px;
  width: 40px;
  height: 40px;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  border-radius: 50%;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s;
  z-index: 15;
}

.gallery-play:hover {
  background-color: rgba(0, 100, 0, 0.5);
  transform: scale(1.1);
}

.gallery-play.playing {
  background-color: rgba(0, 160, 0, 0.5);
}

/* Progress bar */
.gallery-progress-bar {
  position: absolute;
  bottom: 85px;
  left: 20px;
  right: 70px;
  height: 4px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  overflow: hidden;
  z-index: 15;
}

.gallery-progress-indicator {
  height: 100%;
  width: 0%;
  background-color: #3498db;
  transition: width 0.1s linear;
}

/* Thumbnails */
.gallery-thumbnails {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  display: flex;
  overflow-x: auto;
  background-color: rgba(20, 20, 20, 0.8);
  padding: 10px;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 10;
}

.gallery-thumbnail {
  width: 60px;
  height: 60px;
  margin-right: 8px;
  background-size: cover;
  background-position: center;
  background-color: #333;
  cursor: pointer;
  border: 2px solid transparent;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
}

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

.gallery-thumbnail.active {
  border-color: #3498db;
  transform: scale(1.1);
}

.gallery-thumbnail-text {
  background-color: #2c3e50;
  padding: 5px;
  text-align: center;
  word-break: break-word;
}

.gallery-thumbnail-video::before {
  content: "▶";
  color: rgba(255, 255, 255, 0.7);
  font-size: 20px;
}

.gallery-thumbnail-audio::before {
  content: "♪";
  color: rgba(255, 255, 255, 0.7);
  font-size: 20px;
}

/* Info area */
.gallery-info {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  padding: 15px;
  background-color: rgba(0, 0, 0, 0.5);
  max-width: 60%;
  opacity: 0;
  transition: opacity 0.3s ease;
  text-align: center;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  z-index: 10;
}

.gallery-author {
  font-weight: bold;
  margin-bottom: 5px;
}

.gallery-time {
  font-size: 0.9em;
  color: #ccc;
  margin-bottom: 5px;
}

.gallery-text {
  font-size: 1em;
  max-height: 100px;
  overflow-y: auto;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .gallery-nav {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  
  .gallery-info {
    max-width: 90%;
    padding: 10px;
  }
  
  .gallery-text-content {
    max-width: 95%;
    font-size: 16px;
  }
  
  .gallery-caption-wrapper {
    bottom: 90px;
  }
  
  .gallery-play {
    bottom: 90px;
  }
  
  .gallery-progress-bar {
    bottom: 75px;
  }
}