/* 🎨 媒体预览组件样式 */

/* CSS变量定义 */
.media-preview-container {
  --preview-bg: rgba(0, 0, 0, 0.9);
  --header-bg: rgba(0, 0, 0, 0.7);
  --text-primary: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --button-bg: rgba(255, 255, 255, 0.1);
  --button-active: rgba(255, 255, 255, 0.2);
  --border-color: rgba(255, 255, 255, 0.2);
  --shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.3);
}

/* 🎨 预览容器 */
.media-preview-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  background: var(--preview-bg);
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* 🎨 背景遮罩 */
.preview-mask {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent;
}

/* 🎨 预览内容 */
.preview-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

/* 🎨 头部工具栏 */
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32rpx;
  background: var(--header-bg);
  backdrop-filter: blur(20rpx);
  border-bottom: 1rpx solid var(--border-color);
}

.header-info {
  flex: 1;
  min-width: 0;
}

.media-title {
  display: block;
  font-size: 32rpx;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 8rpx;
}

.media-info {
  font-size: 26rpx;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16rpx;
}

.action-btn {
  width: 72rpx;
  height: 72rpx;
  border-radius: 36rpx;
  background: var(--button-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(10rpx);
}

.action-btn:active {
  background: var(--button-active);
  transform: scale(0.9);
}

.action-btn.close-btn {
  background: rgba(255, 59, 48, 0.8);
}

.action-icon {
  font-size: 32rpx;
  color: var(--text-primary);
}

/* 🎨 媒体容器 */
.media-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* 🎨 图片预览 */
.image-preview {
  width: 100%;
  height: 100%;
  position: relative;
}

.image-swiper {
  width: 100%;
  height: 100%;
}

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

.preview-image {
  max-width: 100%;
  max-height: 100%;
  border-radius: 16rpx;
  box-shadow: var(--shadow);
}

.image-counter {
  position: absolute;
  bottom: 40rpx;
  left: 50%;
  transform: translateX(-50%);
  padding: 12rpx 24rpx;
  background: var(--header-bg);
  border-radius: 24rpx;
  backdrop-filter: blur(20rpx);
}

.counter-text {
  font-size: 28rpx;
  color: var(--text-primary);
  font-weight: 500;
}

/* 🎨 视频预览 */
.video-preview {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.preview-video {
  width: 100%;
  max-height: 80%;
  border-radius: 16rpx;
  box-shadow: var(--shadow);
}

.video-info {
  position: absolute;
  bottom: 40rpx;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 24rpx;
  padding: 12rpx 24rpx;
  background: var(--header-bg);
  border-radius: 24rpx;
  backdrop-filter: blur(20rpx);
}

.video-duration,
.video-size {
  font-size: 26rpx;
  color: var(--text-secondary);
}

/* 🎨 文件预览 */
.file-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80rpx 40rpx;
  text-align: center;
}

.file-icon-container {
  width: 200rpx;
  height: 200rpx;
  border-radius: 32rpx;
  background: var(--button-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 40rpx;
  backdrop-filter: blur(20rpx);
  border: 2rpx solid var(--border-color);
}

.file-icon {
  font-size: 120rpx;
}

.file-details {
  margin-bottom: 60rpx;
}

.file-name {
  display: block;
  font-size: 36rpx;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16rpx;
  word-break: break-word;
}

.file-size,
.file-type {
  display: block;
  font-size: 28rpx;
  color: var(--text-secondary);
  margin-bottom: 8rpx;
}

.file-actions {
  display: flex;
  gap: 24rpx;
}

.file-action-btn {
  padding: 24rpx 48rpx;
  background: var(--button-bg);
  border-radius: 32rpx;
  border: 1rpx solid var(--border-color);
  transition: all 0.3s ease;
  backdrop-filter: blur(20rpx);
}

.file-action-btn:active {
  background: var(--button-active);
  transform: scale(0.95);
}

.action-text {
  font-size: 30rpx;
  color: var(--text-primary);
  font-weight: 500;
}

/* 🎨 音频预览 */
.audio-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80rpx 40rpx;
}

.audio-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40rpx;
  margin-bottom: 60rpx;
}

.audio-cover {
  width: 200rpx;
  height: 200rpx;
  border-radius: 100rpx;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

.audio-icon {
  font-size: 80rpx;
  color: white;
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 32rpx;
  width: 100%;
  max-width: 600rpx;
}

.play-btn {
  width: 96rpx;
  height: 96rpx;
  border-radius: 48rpx;
  background: var(--button-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(20rpx);
  border: 2rpx solid var(--border-color);
}

.play-btn:active {
  background: var(--button-active);
  transform: scale(0.9);
}

.play-btn.playing {
  background: rgba(52, 199, 89, 0.8);
}

.play-icon {
  font-size: 40rpx;
  color: var(--text-primary);
}

.audio-progress {
  flex: 1;
}

.progress-bar {
  height: 8rpx;
  background: var(--button-bg);
  border-radius: 4rpx;
  margin-bottom: 16rpx;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  border-radius: 4rpx;
  transition: width 0.3s ease;
}

.time-info {
  display: flex;
  justify-content: space-between;
}

.current-time,
.total-time {
  font-size: 24rpx;
  color: var(--text-secondary);
}

.audio-info {
  text-align: center;
}

.audio-name {
  display: block;
  font-size: 32rpx;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12rpx;
  word-break: break-word;
}

.audio-size {
  font-size: 26rpx;
  color: var(--text-secondary);
}

/* 🎨 加载和错误状态 */
.loading-overlay,
.error-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--preview-bg);
  border-radius: 16rpx;
}

.loading-spinner {
  width: 60rpx;
  height: 60rpx;
  border: 4rpx solid var(--border-color);
  border-top: 4rpx solid var(--text-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 24rpx;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text,
.error-text {
  font-size: 28rpx;
  color: var(--text-secondary);
  margin-bottom: 24rpx;
}

.error-icon {
  font-size: 80rpx;
  margin-bottom: 24rpx;
}

.retry-btn {
  padding: 16rpx 32rpx;
  background: var(--button-bg);
  border-radius: 24rpx;
  border: 1rpx solid var(--border-color);
  transition: all 0.3s ease;
}

.retry-btn:active {
  background: var(--button-active);
  transform: scale(0.95);
}

.retry-text {
  font-size: 26rpx;
  color: var(--text-primary);
}

/* 🎨 底部操作栏 */
.preview-footer {
  padding: 32rpx;
  background: var(--header-bg);
  backdrop-filter: blur(20rpx);
  border-top: 1rpx solid var(--border-color);
}

.footer-actions {
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.footer-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8rpx;
  padding: 16rpx;
  border-radius: 16rpx;
  transition: all 0.3s ease;
  min-width: 120rpx;
}

.footer-btn:active {
  background: var(--button-bg);
  transform: scale(0.95);
}

.footer-icon {
  font-size: 32rpx;
}

.footer-text {
  font-size: 24rpx;
  color: var(--text-secondary);
}

/* 🎨 手势提示 */
.gesture-tips {
  position: absolute;
  bottom: 160rpx;
  left: 50%;
  transform: translateX(-50%);
  padding: 16rpx 32rpx;
  background: var(--header-bg);
  border-radius: 32rpx;
  backdrop-filter: blur(20rpx);
  animation: tipsFadeIn 0.5s ease-out 1s both;
}

@keyframes tipsFadeIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20rpx);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.tips-text {
  font-size: 24rpx;
  color: var(--text-secondary);
  text-align: center;
}

/* 📱 响应式设计 */
@media screen and (max-width: 375px) {
  .preview-header {
    padding: 24rpx;
  }

  .media-title {
    font-size: 28rpx;
  }

  .action-btn {
    width: 64rpx;
    height: 64rpx;
  }

  .action-icon {
    font-size: 28rpx;
  }

  .file-icon-container {
    width: 160rpx;
    height: 160rpx;
  }

  .file-icon {
    font-size: 96rpx;
  }
}

@media screen and (min-width: 414px) {
  .preview-header {
    padding: 40rpx;
  }

  .media-title {
    font-size: 36rpx;
  }

  .action-btn {
    width: 80rpx;
    height: 80rpx;
  }

  .action-icon {
    font-size: 36rpx;
  }

  .file-icon-container {
    width: 240rpx;
    height: 240rpx;
  }

  .file-icon {
    font-size: 140rpx;
  }
}
