@charset "utf-8";
/**
 * Image Viewer - 图片查看器样式
 * 从 template/images.html 提取的公共样式
 */

/* 图片查看器基础样式 */
.image-viewer {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity var(--transition-normal, 0.3s ease-in-out);
  touch-action: manipulation;
}

.image-viewer.active {
  display: flex;
  opacity: 1;
}

.image-viewer img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: var(--border-radius-md, 8px);
  transition: transform var(--transition-normal, 0.3s ease-in-out);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* 关闭按钮 */
.image-viewer .close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: var(--border-radius-full, 50%);
  color: white;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10001;
  -webkit-tap-highlight-color: transparent;
}

.image-viewer .close-btn:hover,
.image-viewer .close-btn:focus {
  background: rgba(255, 255, 255, 0.3);
  outline: 2px solid rgba(255, 255, 255, 0.5);
}

/* 导航按钮 */
.image-viewer .nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: var(--border-radius-full, 50%);
  color: white;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10001;
  -webkit-tap-highlight-color: transparent;
}

.image-viewer .nav-btn:hover,
.image-viewer .nav-btn:focus {
  background: rgba(255, 255, 255, 0.3);
  outline: 2px solid rgba(255, 255, 255, 0.5);
}

.image-viewer .nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.image-viewer .prev-btn {
  left: 20px;
}

.image-viewer .next-btn {
  right: 20px;
}

/* 计数器 */
.image-viewer .counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  background: rgba(0, 0, 0, 0.5);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 10001;
  user-select: none;
  -webkit-user-select: none;
}

/* Gallery 图片悬停效果 */
.gallery-image {
  transition: transform 0.2s ease, opacity 0.2s ease;
  cursor: pointer;
}

.gallery-image:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .image-viewer {
    touch-action: pan-x pan-y;
  }

  .image-viewer img {
    max-width: 95%;
    max-height: 85%;
    touch-action: none;
  }

  .image-viewer .close-btn {
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
    font-size: 18px;
    touch-action: manipulation;
    pointer-events: auto;
    z-index: 10002;
  }

  .image-viewer .nav-btn {
    width: 44px;
    height: 44px;
    font-size: 18px;
    touch-action: manipulation;
    pointer-events: auto;
    z-index: 10002;
  }

  .image-viewer .prev-btn {
    left: 10px;
  }

  .image-viewer .next-btn {
    right: 10px;
  }

  .image-viewer .counter {
    bottom: 20px;
    font-size: 12px;
    padding: 6px 12px;
  }

  .gallery-image:hover {
    transform: none;
  }

  .gallery-image:active {
    transform: scale(0.95);
    opacity: 0.8;
  }
}

/* 超小屏幕适配 */
@media (max-width: 480px) {
  .image-viewer .nav-btn {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  .image-viewer .close-btn {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  .image-viewer .counter {
    bottom: 15px;
    font-size: 11px;
    padding: 4px 8px;
  }
}
