/* ================================================================
 * DS 用户画像 / 个性化推荐 v7.15.0
 * 全部 ds- 前缀 / box-sizing 全 reset
 * ================================================================ */

.ds-profile-interest,
.ds-profile-interest *,
.ds-profile-recommend,
.ds-profile-recommend *,
.ds-profile-related,
.ds-profile-related * {
  box-sizing: border-box;
}

/* ================================================================
 * 1. 兴趣标签(个人中心用)
 * ================================================================ */
.ds-profile-interest {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.ds-profile-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: #3a8ee6;
  background: #f0f7ff;
  border: 1px solid #bfdbfe;
  border-radius: 16px;
  text-decoration: none;
  transition: all 0.18s;
  user-select: none;
}

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

.ds-profile-tag-icon {
  font-size: 12px;
}

/* 按 score 强弱分级(高分更大) */
.ds-profile-tag[data-score="10"], .ds-profile-tag[data-score="9"], .ds-profile-tag[data-score="8"] {
  background: #dbeafe;
  border-color: #93c5fd;
  font-size: 14px;
  padding: 7px 14px;
}
.ds-profile-tag[data-score="7"], .ds-profile-tag[data-score="6"], .ds-profile-tag[data-score="5"] {
  background: #e0e7ff;
  border-color: #a5b4fc;
}

/* ================================================================
 * 2. 为你推荐(单页 / 列表)
 * ================================================================ */
.ds-profile-recommend {
  margin: 24px 0;
  padding: 18px 20px;
  background: linear-gradient(135deg, #faf5ff 0%, #eff6ff 100%);
  border: 1px solid #e0e7ff;
  border-radius: 10px;
}

.ds-profile-rec-title {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 700;
  color: #4338ca;
}

.ds-profile-rec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.ds-profile-rec-card {
  display: block;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: all 0.18s;
}

.ds-profile-rec-card:hover {
  border-color: #3a8ee6;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(58, 142, 230, 0.2);
}

.ds-profile-rec-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #f3f4f6;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ds-profile-rec-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ds-profile-rec-empty {
  font-size: 32px;
  color: #9ca3af;
}

.ds-profile-rec-info {
  padding: 10px 12px;
}

.ds-profile-rec-info h4 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: #1f2937;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ds-profile-rec-meta {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: #6b7280;
}

/* ================================================================
 * 3. 相关资源(文章末尾)
 * ================================================================ */
.ds-profile-related {
  margin: 20px 0;
  padding: 14px 18px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.ds-profile-related h3 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
}

.ds-profile-related-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 6px 14px;
}

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

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

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

.ds-profile-related-list li small {
  flex-shrink: 0;
  color: #888;
  font-size: 11px;
}

/* ================================================================
 * 4. 暗色模式
 * ================================================================ */
@media (prefers-color-scheme: dark) {
  .ds-profile-tag {
    color: #60a5fa;
    background: #1e3a5f;
    border-color: #60a5fa;
  }
  .ds-profile-tag:hover {
    color: #fff;
    background: #3a8ee6;
  }
  .ds-profile-tag[data-score="10"], .ds-profile-tag[data-score="9"], .ds-profile-tag[data-score="8"] {
    background: #1e3a8a;
    border-color: #60a5fa;
  }
  .ds-profile-tag[data-score="7"], .ds-profile-tag[data-score="6"], .ds-profile-tag[data-score="5"] {
    background: #312e81;
    border-color: #818cf8;
  }
  .ds-profile-recommend {
    background: linear-gradient(135deg, #1e1b4b 0%, #1e3a5f 100%);
    border-color: #4f46e5;
  }
  .ds-profile-rec-title { color: #c7d2fe; }
  .ds-profile-rec-card {
    background: #1f2937;
    border-color: #374151;
  }
  .ds-profile-rec-card:hover { border-color: #60a5fa; }
  .ds-profile-rec-info h4 { color: #f3f4f6; }
  .ds-profile-rec-meta { color: #9ca3af; }
  .ds-profile-related {
    background: #1f2937;
    border-color: #374151;
  }
  .ds-profile-related h3 { color: #f3f4f6; }
  .ds-profile-related-list li { border-bottom-color: #374151; }
  .ds-profile-related-list li a { color: #d1d5db; }
  .ds-profile-related-list li a:hover { color: #60a5fa; }
  .ds-profile-related-list li small { color: #9ca3af; }
}

/* ================================================================
 * 5. 响应式
 * ================================================================ */
@media (max-width: 600px) {
  .ds-profile-rec-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .ds-profile-related-list {
    grid-template-columns: 1fr;
  }
  .ds-profile-recommend {
    padding: 14px 16px;
  }
}
