/* ========================================
   CodeNotes - Components
   卡片、按钮、标签、广告位等UI组件
   ======================================== */

/* 文章卡片 */
.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.post-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
  transform: scaleX(0);
  transition: transform var(--transition-base);
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-hover);
}

.post-card:hover::before {
  transform: scaleX(1);
}

.post-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.post-category {
  color: var(--accent-primary);
  font-weight: 600;
  text-decoration: none;
}

.post-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.post-title a {
  color: var(--text-primary);
  text-decoration: none;
  background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary));
  background-size: 0% 2px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size var(--transition-base);
}

.post-title a:hover {
  background-size: 100% 2px;
}

.post-excerpt {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.tag:hover {
  background: var(--accent-gradient);
  color: white;
  border-color: transparent;
  transform: translateY(-1px);
}

/* 侧边栏组件 */
.widget {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.widget-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border-color);
  position: relative;
}

.widget-title::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 40px;
  height: 2px;
  background: var(--accent-gradient);
}

/* 热点文章排行 */
.hot-posts {
  list-style: none;
}

.hot-post-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
  transition: all var(--transition-fast);
}

.hot-post-item:last-child {
  border-bottom: none;
}

.hot-post-item:hover {
  padding-left: 0.5rem;
}

.hot-rank {
  width: 24px;
  height: 24px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

.hot-post-item:nth-child(1) .hot-rank { background: #fef3c7; color: #d97706; }
.hot-post-item:nth-child(2) .hot-rank { background: #f3f4f6; color: #4b5563; }
.hot-post-item:nth-child(3) .hot-rank { background: #fef2f2; color: #dc2626; }

[data-theme="dark"] .hot-post-item:nth-child(1) .hot-rank { background: rgba(217, 119, 6, 0.2); }
[data-theme="dark"] .hot-post-item:nth-child(2) .hot-rank { background: rgba(75, 85, 99, 0.3); }
[data-theme="dark"] .hot-post-item:nth-child(3) .hot-rank { background: rgba(220, 38, 38, 0.2); }

.hot-post-title {
  font-size: 0.9rem;
  color: var(--text-primary);
  text-decoration: none;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hot-post-title:hover {
  color: var(--accent-primary);
}

/* 广告位样式 */
.ad-widget {
  overflow: hidden;
  padding: 0;
  position: relative;
}

.ad-label {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  z-index: 10;
}

.ad-image {
  width: 100%;
  height: auto;
  display: block;
  transition: transform var(--transition-slow);
}

.ad-widget:hover .ad-image {
  transform: scale(1.05);
}

.ad-banner {
  width: 100%;
  margin: 3rem 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.ad-banner-content {
  position: relative;
  height: 120px;
  overflow: hidden;
}

.ad-banner img {
  width: 100%;
  height: 100%;
  object-fit: fill;
}

/* 标签云 */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-cloud .tag {
  font-size: 0.85rem;
}

.tag-lg { font-size: 1rem; padding: 0.4rem 1rem; }
.tag-sm { font-size: 0.75rem; padding: 0.2rem 0.6rem; }

/* 建站信息 */
.site-info {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.8;
}

.site-info-row {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  border-bottom: 1px dashed var(--border-color);
}

.site-info-row:last-child {
  border-bottom: none;
}

/* 分页 */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.page-btn:hover, .page-btn.active {
  background: var(--accent-gradient);
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}

.page-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 按钮组件 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 6px -1px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 12px -2px var(--accent-glow);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--bg-secondary);
}

/* 时间轴样式 */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent-gradient);
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  padding: 0 0 0.5rem 1.5rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.65rem;
  top: 0.5rem;
  width: 12px;
  height: 12px;
  background: var(--bg-card);
  border: 2px solid var(--accent-primary);
  border-radius: 50%;
  transition: all var(--transition-base);
}

.timeline-item:hover::before {
  background: var(--accent-primary);
  transform: scale(1.2);
  box-shadow: var(--shadow-glow);
}

.timeline-date {
  font-size: 0.85rem;
  color: var(--accent-primary);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.timeline-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.8rem;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
}

.timeline-content:hover {
  border-color: var(--accent-primary);
  transform: translateX(5px);
}

/* 友链卡片 */
.friend-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: all var(--transition-base);
}

.friend-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-md);
}

.friend-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.friend-info h4 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.friend-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* 搜索高亮 */
.search-highlight {
  background: linear-gradient(120deg, rgba(56, 189, 248, 0.3) 0%, rgba(129, 140, 248, 0.3) 100%);
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 600;
}