/* ===== 私密资料库样式 ===== */

.docs-page {
  padding: 24px 32px 60px;
  max-width: 1180px;
  margin: 0 auto;
}

/* 侧栏分类 */
.docs-cats {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  margin: 8px 0;
}
.docs-cats__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted, #666);
  text-align: left;
  transition: background .15s, color .15s;
}
.docs-cats__item:hover { background: rgba(44,123,229,.06); color: var(--text-primary, #1a1a1a); }
.docs-cats__item.is-active {
  background: linear-gradient(90deg, rgba(44,123,229,.14), transparent);
  color: #2c7be5;
  font-weight: 600;
}
.docs-cats__ic { font-size: 16px; }
.docs-cats__count {
  margin-left: auto;
  font-size: 11px;
  padding: 1px 8px;
  background: rgba(0,0,0,.06);
  border-radius: 10px;
  color: #888;
}
.docs-cats__item.is-active .docs-cats__count { background: #2c7be5; color: #fff; }

/* Hero */
.docs-hero {
  padding: 24px 0 20px;
  border-bottom: 1px solid var(--border-color, #eee);
  margin-bottom: 20px;
}
.docs-hero .eyebrow {
  color: #2c7be5; font-size: 12px; letter-spacing: 2px;
  text-transform: uppercase; margin: 0 0 4px; font-weight: 600;
}
.docs-hero h1 { font-size: 28px; margin: 0 0 8px; }
.docs-hero__sub { color: var(--text-muted, #666); font-size: 15px; margin: 0 0 12px; line-height: 1.7; }
.docs-hero__meta { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: #888; }

/* 工具条 */
.docs-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  align-items: center;
}
.docs-toolbar input[type="search"] {
  flex: 1;
  min-width: 220px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 8px;
  font-size: 14px;
  background: var(--card-bg, #fff);
  color: var(--text-primary, #1a1a1a);
  transition: border-color .15s, box-shadow .15s;
}
.docs-toolbar input[type="search"]:focus {
  outline: 0;
  border-color: #2c7be5;
  box-shadow: 0 0 0 3px rgba(44,123,229,.12);
}
.docs-toolbar select {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 8px;
  font-size: 14px;
  background: var(--card-bg, #fff);
  color: var(--text-primary, #1a1a1a);
  cursor: pointer;
}
.docs-batch {
  display: flex;
  gap: 6px;
  align-items: center;
}
.docs-batch .doc-btn {
  padding: 5px 10px;
  font-size: 13px;
}
#selectedCount {
  font-weight: 600;
}

/* 卡片列表 */
.doc-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}
.doc-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-color, #ececec);
  border-radius: 10px;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.doc-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(44,123,229,.08);
  border-color: rgba(44,123,229,.25);
}
.doc-card--selected {
  background: rgba(44,123,229,.08);
  border-color: #2c7be5;
}

.doc-card__checkbox {
  flex: 0 0 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.doc-card__checkbox input {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #2c7be5;
}

.doc-card__ic {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: #94a3b8;
  letter-spacing: 0.5px;
}
.doc-card__ic.is-pdf  { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.doc-card__ic.is-word { background: linear-gradient(135deg, #2c7be5, #1e40af); }
.doc-card__ic.is-xls  { background: linear-gradient(135deg, #27ae60, #16a34a); }
.doc-card__ic.is-ppt  { background: linear-gradient(135deg, #f97316, #ea580c); }
.doc-card__ic.is-img  { background: linear-gradient(135deg, #a855f7, #7e22ce); }
.doc-card__ic.is-txt  { background: linear-gradient(135deg, #64748b, #475569); }

.doc-card__body { flex: 1; min-width: 0; }
.doc-card__name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary, #1a1a1a);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-card__meta {
  font-size: 12px;
  color: #888;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.doc-card__cat {
  color: #2c7be5;
  background: rgba(44,123,229,.08);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
}

.doc-card__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.doc-btn {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
  display: inline-block;
  transition: all .15s;
  white-space: nowrap;
}
.doc-btn--ghost {
  background: transparent;
  border-color: var(--border-color, #ddd);
  color: var(--text-primary, #333);
}
.doc-btn--ghost:hover {
  border-color: #2c7be5;
  color: #2c7be5;
}
.doc-btn--primary {
  background: linear-gradient(135deg, #2c7be5, #4f46e5);
  color: #fff;
}
.doc-btn--primary:hover {
  box-shadow: 0 4px 12px rgba(44,123,229,.35);
  transform: translateY(-1px);
}

/* 空状态 */
.doc-empty {
  padding: 60px 20px;
  text-align: center;
  color: #999;
}
.doc-empty__icon { font-size: 48px; margin-bottom: 12px; }

/* 预览模态框 */
.doc-preview-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  animation: docFadeIn .15s ease;
}
@keyframes docFadeIn { from { opacity: 0 } to { opacity: 1 } }
.doc-preview {
  width: min(1000px, 100%);
  max-height: 92vh;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.doc-preview__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid #eee;
  background: #fafafa;
}
.doc-preview__title {
  flex: 1;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #1a1a1a;
  font-size: 15px;
}
.doc-preview__actions {
  display: flex;
  gap: 8px;
}
.doc-preview__body {
  flex: 1;
  overflow: auto;
  background: #f4f4f6;
  padding: 12px;
}
.doc-preview__body--text {
  background: #fff;
  padding: 24px 32px;
}

/* mammoth 输出的 docx HTML 排版 */
.doc-html-preview {
  max-width: 760px;
  margin: 0 auto;
  color: #1a1a1a;
  font-family: "PingFang SC", "Microsoft YaHei", "Songti SC", "SimSun", sans-serif;
  line-height: 1.85;
  font-size: 15px;
}
.doc-html-preview h1 { font-size: 24px; color: #111; border-bottom: 2px solid #eee; padding-bottom: 8px; margin: 1em 0 0.6em; }
.doc-html-preview h2 { font-size: 20px; color: #1a1a1a; border-left: 4px solid #2c7be5; padding-left: 10px; margin: 1.2em 0 0.5em; }
.doc-html-preview h3 { font-size: 17px; color: #333; margin: 1em 0 0.4em; }
.doc-html-preview p { margin: 0.5em 0; }
.doc-html-preview ul, .doc-html-preview ol { padding-left: 1.6em; margin: 0.4em 0; }
.doc-html-preview li { margin: 0.2em 0; }
.doc-html-preview table { border-collapse: collapse; width: 100%; margin: 0.8em 0; font-size: 14px; }
.doc-html-preview td, .doc-html-preview th { border: 1px solid #ddd; padding: 6px 10px; }
.doc-html-preview th { background: #f5f7fa; }
.doc-html-preview img { max-width: 100%; height: auto; display: block; margin: 0.6em auto; border-radius: 4px; }
.doc-html-preview a { color: #2c7be5; text-decoration: none; }
.doc-html-preview a:hover { text-decoration: underline; }

.doc-txt-preview {
  margin: 0;
  padding: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Consolas, Menlo, "SF Mono", monospace;
  font-size: 14px;
  line-height: 1.7;
  color: #1a1a1a;
}

/* 移动端 */
@media (max-width: 768px) {
  .docs-page { padding: 14px 12px 40px; }
  .docs-hero h1 { font-size: 22px; }
  .doc-list { grid-template-columns: 1fr; }
  .doc-card__actions { flex-direction: column; }
  .doc-btn { padding: 5px 10px; font-size: 12px; }
}

/* 暗黑模式 */
:root[data-theme="dark"] .doc-card {
  background: #1e2130;
  border-color: #2a2f42;
}
:root[data-theme="dark"] .doc-card__name { color: #e2e8f0; }
:root[data-theme="dark"] .doc-preview {
  background: #1e2130;
}
:root[data-theme="dark"] .doc-preview__head {
  background: #171a26;
  border-bottom-color: #2a2f42;
}
:root[data-theme="dark"] .doc-preview__title { color: #e2e8f0; }
:root[data-theme="dark"] .doc-preview__body { background: #14161f; }
:root[data-theme="dark"] .docs-toolbar input,
:root[data-theme="dark"] .docs-toolbar select {
  background: #1e2130;
  border-color: #2a2f42;
  color: #e2e8f0;
}
