/* ========================================
   文件浏览器 — 公共样式
   ======================================== */

/* --- CSS 变量 --- */
:root {
  --section-bg: #f8f9fa;
  --card-shadow: 0 2px 8px rgba(0,0,0,0.1);
  --card-hover-shadow: 0 6px 20px rgba(0,0,0,0.18);
  --card-radius: 10px;
  --thumbnail-height: 160px;
  --accent-blue: #0d6efd;
  --accent-red: #dc3545;
  --accent-green: #198754;
  --accent-purple: #6f42c1;
}

/* --- 页面整体 --- */
body {
  background: #eef1f5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* --- 页面标题 --- */
.page-header {
  text-align: center;
  padding: 32px 0 24px;
}
.page-header h1 {
  font-weight: 700;
  font-size: 2rem;
  color: #2c3e50;
}
.page-header p {
  color: #6c757d;
  margin-bottom: 0;
}

/* --- 区块容器 --- */
.section-block {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
  padding: 24px 20px;
  margin-bottom: 28px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid #e9ecef;
}
.section-header .icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #fff;
  flex-shrink: 0;
}
.section-header .icon-wrap.images-icon  { background: var(--accent-blue); }
.section-header .icon-wrap.mp3-icon     { background: var(--accent-purple); }
.section-header .icon-wrap.office-icon  { background: var(--accent-green); }

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  color: #343a40;
}
.section-header .badge-count {
  margin-left: auto;
  font-size: 0.8rem;
  background: #e9ecef;
  color: #495057;
  padding: 2px 12px;
  border-radius: 20px;
  font-weight: 500;
}

/* --- 缩略图卡片网格 --- */
.thumbnail-grid {
  /* 使用 Bootstrap row/col 布局 */
}

/* --- 单个卡片 --- */
.file-card {
  border: 1px solid #e9ecef;
  border-radius: var(--card-radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background: #fff;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.file-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-hover-shadow);
}

/* 缩略图区域 */
.file-card .thumb-wrap {
  width: 100%;
  height: var(--thumbnail-height);
  overflow: hidden;
  background: #f0f2f5;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* 图片缩略图 */
.file-card .thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* MP3 / Office 占位图标 */
.file-card .thumb-wrap .placeholder-icon {
  font-size: 3rem;
  opacity: 0.6;
  line-height: 1;
}

/* 文件信息区 */
.file-card .card-info {
  padding: 10px 12px;
  flex: 1;
  display: flex;
  align-items: center;
}
.file-card .card-info .file-name {
  font-size: 0.82rem;
  color: #343a40;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
  width: 100%;
  line-height: 1.3;
}

/* Office 卡片颜色标记 */
.file-card.type-docx .thumb-wrap { background: #dce9fa; }
.file-card.type-pdf  .thumb-wrap { background: #fce4e4; }
.file-card.type-xlsx .thumb-wrap { background: #e4f5e4; }

.file-card.type-docx .placeholder-icon { color: var(--accent-blue); }
.file-card.type-pdf  .placeholder-icon { color: var(--accent-red); }
.file-card.type-xlsx .placeholder-icon { color: var(--accent-green); }

/* --- 模态框 — 全屏大图 --- */
#imageModal .modal-content {
  background: transparent;
  border: none;
  box-shadow: none;
}
#imageModal .modal-body {
  text-align: center;
  padding: 10px;
}
#imageModal .modal-body img {
  max-width: 95vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 4px 30px rgba(0,0,0,0.5);
}
#imageModal .modal-header {
  border: none;
  position: absolute;
  top: 0;
  right: 0;
  z-index: 10;
}
#imageModal .btn-close {
  background-color: rgba(255,255,255,0.8);
  border-radius: 50%;
  padding: 8px;
  opacity: 0.9;
}

/* --- 模态框 — 音频播放 --- */
#audioModal .modal-dialog {
  max-width: 480px;
}
#audioModal .modal-body {
  text-align: center;
  padding: 30px 20px;
}
#audioModal .audio-visual {
  font-size: 4rem;
  color: var(--accent-purple);
  margin-bottom: 20px;
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50%      { transform: scale(1.08); opacity: 1; }
}
#audioModal .audio-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: #343a40;
  word-break: break-all;
}
#audioModal audio {
  width: 100%;
  outline: none;
}

/* --- 模态框 — Office 文档查看 --- */
#officeModal .modal-dialog {
  max-width: 95vw;
  height: 95vh;
}
#officeModal .modal-content {
  height: 100%;
}
#officeModal .modal-body {
  padding: 0;
  height: calc(100% - 60px);
  overflow: hidden;
}
#officeModal .modal-body iframe {
  width: 100%;
  height: 100%;
  border: none;
}
#officeModal .fallback-download {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 20px;
  color: #6c757d;
}
#officeModal .fallback-download .big-icon {
  font-size: 4rem;
}
#officeModal .fallback-download p {
  font-size: 1rem;
  max-width: 360px;
  text-align: center;
}

/* --- 空状态 --- */
.empty-state {
  text-align: center;
  padding: 30px;
  color: #adb5bd;
}
.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

/* --- 响应式微调 --- */
@media (max-width: 576px) {
  :root {
    --thumbnail-height: 120px;
  }
  .page-header h1 { font-size: 1.5rem; }
  .section-block { padding: 16px 12px; }
  .section-header h2 { font-size: 1.05rem; }
  #officeModal .modal-dialog {
    max-width: 100vw;
    height: 100vh;
    margin: 0;
  }
}
