/* 热门文章侧边栏 widget 样式 */

.card-popular-post .item-content {
  padding: 0;
}

.popular-list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: popular-rank;
}

.popular-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(128, 128, 128, 0.2);
  counter-increment: popular-rank;
  transition: all 0.2s ease;
}

.popular-item:last-child {
  border-bottom: none;
}

.popular-item:hover {
  background: rgba(128, 128, 128, 0.06);
  border-radius: 6px;
  padding-left: 6px;
}

/* 排名数字 */
.popular-item::before {
  content: counter(popular-rank);
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  font-size: 12px;
  font-weight: bold;
  color: #fff;
  background: #c5c5c5;
  border-radius: 6px;
}

/* 前三名高亮 */
.popular-item:nth-child(1)::before {
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
}

.popular-item:nth-child(2)::before {
  background: linear-gradient(135deg, #ffa502, #ff7f50);
}

.popular-item:nth-child(3)::before {
  background: linear-gradient(135deg, #ffd32a, #f6b93b);
}

.popular-item a {
  flex: 1 1 auto;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  font-size: 14px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.popular-item a:hover {
  color: #11998e;
}

.popular-views {
  flex: 0 0 auto;
  font-size: 12px;
  color: #999;
  background: rgba(128, 128, 128, 0.12);
  padding: 1px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.popular-note {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(128, 128, 128, 0.15);
  font-size: 12px;
  color: #aaa;
  text-align: center;
}

/* 回退模式(GA4 数据不足时显示最新文章,无排名数字) */
.card-popular-post--fallback .popular-item::before {
  display: none;
}

.card-popular-post--fallback .popular-item {
  padding-left: 0;
}

.card-popular-post--fallback .popular-item:hover {
  padding-left: 6px;
}

/* 暗色模式适配 */
[data-theme="dark"] .popular-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .popular-views {
  background: rgba(255, 255, 255, 0.1);
  color: #bbb;
}

[data-theme="dark"] .popular-item a:hover {
  color: #38ef7d;
}
