@charset "UTF-8";
/* WeKnora 一键下载按钮注入样式
 * 由 index.html 引入，作用于已编译的 SPA，不改动镜像源码。
 * 三处入口：
 *   1) 对话右侧「文档来源」面板的每个文件条目
 *   2) 文档详情抽屉「基本信息」区的正方形圆角按钮
 *   3) 知识库文档的卡片视图 / 列表视图
 */

/* ---------- 通用绿色小按钮（来源面板 / 卡片 / 列表） ---------- */
.wk-dl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 0 0 auto;
  height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: #2ba471;
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(43, 164, 113, 0.28);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}
.wk-dl-btn:hover {
  background: #229060;
  box-shadow: 0 2px 7px rgba(43, 164, 113, 0.42);
}
.wk-dl-btn:active { transform: translateY(1px); }
.wk-dl-btn:focus-visible { outline: 2px solid #86d9b6; outline-offset: 2px; }
.wk-dl-btn svg { width: 13px; height: 13px; flex: 0 0 13px; }
.wk-dl-btn.is-loading { opacity: 0.72; pointer-events: none; }
.wk-dl-btn.is-loading svg { animation: wk-dl-spin 0.9s linear infinite; }
.wk-dl-btn.is-error { background: #c94343; box-shadow: 0 1px 3px rgba(201, 67, 67, 0.3); }

.wk-dl-btn--ref { height: 22px; padding: 0 7px; font-size: 11px; border-radius: 5px; }
.wk-dl-btn--ref svg { width: 12px; height: 12px; flex-basis: 12px; }
.wk-dl-btn--card { height: 26px; padding: 0 10px; }
.wk-dl-btn--row { height: 24px; }

@keyframes wk-dl-spin { to { transform: rotate(360deg); } }

/* ---------- 1) 文档来源面板 ---------- */
.reference-item__title-row.has-wk-dl {
  display: flex;
  align-items: center;
  gap: 4px;
}
.reference-item__title-row.has-wk-dl .reference-item__title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reference-item__title-row.has-wk-dl > .reference-item__open { flex: 0 0 auto; }
/* 窄面板下把图标按钮收紧，给下载按钮留出空间 */
.chat-references-panel .reference-item__title-row.has-wk-dl > .reference-item__open {
  margin-left: 0;
}

/* ---------- 2) 文档详情「基本信息」正方形圆角按钮 ---------- */
.setting-drawer__section.has-wk-dl-square {
  position: relative;
  padding-right: 66px !important;
}
.wk-dl-square {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #32c187, #209463);
  color: #fff;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(32, 148, 99, 0.32);
  transition: filter 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}
.wk-dl-square:hover { filter: brightness(1.08); box-shadow: 0 5px 15px rgba(32, 148, 99, 0.44); }
.wk-dl-square:active { transform: translateY(-50%) scale(0.96); }
.wk-dl-square:focus-visible { outline: 2px solid #86d9b6; outline-offset: 2px; }
.wk-dl-square svg { width: 18px; height: 18px; }
.wk-dl-square .wk-dl-square__text { font-size: 10px; font-weight: 600; line-height: 1; letter-spacing: 0.5px; }
.wk-dl-square.is-loading { opacity: 0.78; pointer-events: none; }
.wk-dl-square.is-loading svg { animation: wk-dl-spin 0.9s linear infinite; }
.wk-dl-square.is-error { background: #c94343; }

/* ---------- 3) 卡片视图 / 列表视图 ---------- */
.knowledge-card .card-bottom.has-wk-dl {
  display: flex;
  align-items: center;
  gap: 6px;
}
.knowledge-card .card-bottom.has-wk-dl .wk-dl-btn { margin-left: auto; }
.knowledge-card .card-bottom.has-wk-dl .card-time { flex: 0 0 auto; }

.doc-list-row .cell-actions.has-wk-dl { display: flex; align-items: center; }
.doc-list-row .cell-actions.has-wk-dl > .wk-dl-btn { margin-right: 6px; }
.doc-list-row .row-title-line.has-wk-dl {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.doc-list-row .row-title-line.has-wk-dl > .row-file-name {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-list-row .row-title-line.has-wk-dl > .wk-dl-btn { margin-left: 0; flex: 0 0 auto; }

/* ---------- 暗色主题下保持清晰 ---------- */
[theme-mode="dark"] .wk-dl-btn { background: #2fae7c; }
[theme-mode="dark"] .wk-dl-btn:hover { background: #37c48d; }
[theme-mode="dark"] .wk-dl-square { background: linear-gradient(135deg, #35bd86, #238f62); }
