/* ============================================
   Lightbox 图片预览组件
   ============================================ */

/* Lightbox 容器 */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.92);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
}

/* 关闭按钮 */
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 28px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  z-index: 10;
  border-radius: 50%;
  transition: color 0.2s, background 0.2s;
  user-select: none;
}

.lightbox-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* 左右箭头按钮 */
.lightbox-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  z-index: 10;
  transition: color 0.2s, background 0.2s;
  user-select: none;
  border-radius: 4px;
}

.lightbox-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.lightbox-prev {
  left: 10px;
}

.lightbox-next {
  right: 10px;
}

/* 图片容器 */
.lightbox-image-wrap {
  max-width: 98vw;
  max-height: 95vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 10px;
}

.lightbox-image-wrap img {
  max-width: 100%;
  max-height: 95vh;
  object-fit: contain;
  border-radius: 2px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
  transform-origin: center center;
  transition: transform 0.1s ease-out;
  cursor: default;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-image-wrap img[style*="scale"] {
  transition: none;
}

.lightbox-image-wrap:active img {
  cursor: grabbing;
}

/* 图片标题 */
.lightbox-caption {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.75);
  font-size: 15px;
  letter-spacing: 2px;
  text-align: center;
  max-width: 90%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 计数器 */
.lightbox-counter {
  position: absolute;
  top: 15px;
  left: 15px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 14px;
  letter-spacing: 1px;
  user-select: none;
}

/* 响应式设计 - 平板设备 */
@media (max-width: 768px) {
  .lightbox-btn {
    width: 40px;
    height: 60px;
    font-size: 30px;
  }

  .lightbox-prev {
    left: 5px;
  }

  .lightbox-next {
    right: 5px;
  }

  .lightbox-image-wrap {
    max-width: 99vw;
    max-height: 96vh;
    padding: 5px;
  }

  .lightbox-image-wrap img {
    max-height: 96vh;
  }

  .lightbox-caption {
    font-size: 13px;
    bottom: 10px;
  }

  .lightbox-counter {
    top: 10px;
    left: 10px;
  }
}

/* 响应式设计 - 移动设备 */
@media (max-width: 480px) {
  .lightbox-close {
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    font-size: 24px;
  }

  .lightbox-btn {
    width: 36px;
    height: 50px;
    font-size: 24px;
  }

  .lightbox-prev {
    left: 2px;
  }

  .lightbox-next {
    right: 2px;
  }

  .lightbox-image-wrap {
    max-width: 100vw;
    max-height: 98vh;
    padding: 2px;
  }

  .lightbox-image-wrap img {
    max-height: 98vh;
  }

  .lightbox-counter {
    top: 8px;
    left: 8px;
    font-size: 12px;
  }

  .lightbox-caption {
    font-size: 12px;
    bottom: 8px;
    max-width: 95%;
  }
}

/* 文章内容图片可点击样式 */
.page-content img {
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.page-content img:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 文章内容图片容器（避免图片之间间距过大） */
.page-content img + img {
  margin-top: 16px;
}

/* 缩放提示 */
.lightbox-zoom-hint {
  position: absolute;
  bottom: 45px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  letter-spacing: 1px;
  text-align: center;
  white-space: nowrap;
  user-select: none;
  transition: opacity 0.3s;
}

.lightbox-zoom-hint.hidden {
  opacity: 0;
}

/* 缩放比例指示器 */
.lightbox-zoom-level {
  position: absolute;
  top: 15px;
  right: 60px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 14px;
  letter-spacing: 1px;
  user-select: none;
  transition: opacity 0.3s;
}

.lightbox-zoom-level.hidden {
  opacity: 0;
}

@media (max-width: 768px) {
  .lightbox-zoom-hint {
    font-size: 11px;
    bottom: 35px;
  }

  .lightbox-zoom-level {
    font-size: 12px;
    top: 10px;
    right: 50px;
  }
}

@media (max-width: 480px) {
  .lightbox-zoom-hint {
    font-size: 10px;
    bottom: 30px;
  }

  .lightbox-zoom-level {
    font-size: 11px;
    top: 8px;
    right: 50px;
  }
}
