/* ================================================================
 * DS 资源标签系统 v7.8.0
 * 全部 ds- 前缀 / box-sizing 全 reset
 * ================================================================ */

.ds-tags-bar,
.ds-tags-bar *,
.ds-tag-cloud,
.ds-tag-cloud *,
.ds-related-by-tag,
.ds-related-by-tag * {
  box-sizing: border-box;
}

/* ================================================================
 * 1. 单资源标签条
 * ================================================================ */
.ds-tags-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 14px 0;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.ds-tags-icon {
  font-size: 14px;
  color: #64748b;
  margin-right: 4px;
}

.ds-tag {
  display: inline-block;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  color: #475569;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  text-decoration: none;
  transition: all 0.18s;
  cursor: pointer;
}

.ds-tag:hover {
  color: #fff;
  background: #3a8ee6;
  border-color: #3a8ee6;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(58, 142, 230, 0.3);
}

.ds-tag-ai {
  color: #8b5cf6;
  border-color: #ddd6fe;
  background: #f5f3ff;
}

.ds-tag-ai:hover {
  color: #fff;
  background: #8b5cf6;
  border-color: #8b5cf6;
}

.ds-tag-manual {
  color: #475569;
  border-color: #e2e8f0;
  background: #fff;
}

.ds-tag-import {
  color: #10b981;
  border-color: #d1fae5;
  background: #f0fdf4;
}

.ds-tag-import:hover {
  color: #fff;
  background: #10b981;
  border-color: #10b981;
}

/* ================================================================
 * 2. 标签云
 * ================================================================ */
.ds-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  padding: 12px 0;
  line-height: 1.6;
}

.ds-tag-cloud-item {
  display: inline-block;
  padding: 4px 10px;
  font-weight: 500;
  color: #3a8ee6;
  background: #f0f7ff;
  border-radius: 14px;
  text-decoration: none;
  transition: all 0.18s;
  line-height: 1.4;
}

.ds-tag-cloud-item:hover {
  color: #fff;
  background: #3a8ee6;
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(58, 142, 230, 0.3);
}

.ds-tag-cloud-item sup {
  margin-left: 4px;
  font-size: 10px;
  font-weight: 600;
  color: #ef4444;
  vertical-align: super;
}

.ds-tag-cloud-item:hover sup {
  color: #fff;
}

/* ================================================================
 * 3. 相关资源
 * ================================================================ */
.ds-related-by-tag {
  margin: 20px 0;
  padding: 16px 18px;
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.ds-related-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
  color: #222;
}

.ds-related-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ds-related-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed #e5e7eb;
  font-size: 14px;
}

.ds-related-list li:last-child {
  border-bottom: none;
}

.ds-related-list li a {
  color: #333;
  text-decoration: none;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 10px;
}

.ds-related-list li a:hover {
  color: #3a8ee6;
  text-decoration: underline;
}

.ds-related-common {
  flex-shrink: 0;
  font-size: 12px;
  color: #888;
  padding: 2px 8px;
  background: #f0f7ff;
  border-radius: 10px;
}

/* ================================================================
 * 4. 暗色模式
 * ================================================================ */
@media (prefers-color-scheme: dark) {
  .ds-tags-bar {
    background: #1f2937;
    border-color: #374151;
  }
  .ds-tags-icon { color: #9ca3af; }
  .ds-tag {
    color: #d1d5db;
    background: #111827;
    border-color: #374151;
  }
  .ds-tag:hover {
    color: #fff;
    background: #3a8ee6;
    border-color: #3a8ee6;
  }
  .ds-tag-ai {
    color: #c4b5fd;
    background: #1e1b4b;
    border-color: #4c1d95;
  }
  .ds-tag-import {
    color: #6ee7b7;
    background: #064e3b;
    border-color: #047857;
  }
  .ds-tag-cloud-item {
    color: #60a5fa;
    background: #1e3a8a;
  }
  .ds-tag-cloud-item:hover {
    color: #fff;
    background: #3a8ee6;
  }
  .ds-related-by-tag {
    background: #1f2937;
    border-color: #374151;
  }
  .ds-related-title { color: #f3f4f6; }
  .ds-related-list li { border-bottom-color: #374151; }
  .ds-related-list li a { color: #d1d5db; }
  .ds-related-list li a:hover { color: #60a5fa; }
  .ds-related-common {
    color: #9ca3af;
    background: #1e3a8a;
  }
}

/* ================================================================
 * 5. 响应式
 * ================================================================ */
@media (max-width: 600px) {
  .ds-tags-bar { padding: 8px 10px; gap: 4px; }
  .ds-tag { font-size: 11px; padding: 2px 8px; }
  .ds-related-list li { font-size: 13px; }
}
