/**
 * 推荐阅读区域现代化样式
 *
 * 卡片式布局，带缩略图，响应式设计
 * 参考：知乎、少数派、Medium 等优秀产品
 *
 * @package Zhangbangbang
 * @since 1.0.0
 */

/* ==========================================================================
   推荐阅读容器
   ========================================================================== */
.zbb-related-posts {
	margin-top: var(--zbb-spacing-2xl);
	padding: var(--zbb-spacing-xl) 0;
	background: linear-gradient(180deg, var(--zbb-gray-50) 0%, var(--zbb-white) 100%);
	border-radius: var(--zbb-radius-xl);
	margin-left: calc(-1 * var(--zbb-spacing-lg));
	margin-right: calc(-1 * var(--zbb-spacing-lg));
	padding-left: var(--zbb-spacing-lg);
	padding-right: var(--zbb-spacing-lg);
}

/* 标题区域 */
.zbb-related-posts-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: var(--zbb-spacing-lg);
	padding-bottom: var(--zbb-spacing-md);
	border-bottom: 2px solid var(--zbb-primary);
}

.zbb-related-posts-title {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--zbb-gray-900);
	margin: 0;
}

.zbb-related-posts-title i {
	color: var(--zbb-primary);
	font-size: 1.1em;
}

.zbb-related-posts-more {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--zbb-primary);
	font-size: 14px;
	font-weight: 500;
	text-decoration: none;
	transition: all var(--zbb-transition-fast);
}

.zbb-related-posts-more:hover {
	gap: 10px;
	color: var(--zbb-primary-dark);
}

/* ==========================================================================
   卡片网格布局
   ========================================================================== */
.zbb-related-posts-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--zbb-spacing-lg);
}

/* ==========================================================================
   单个推荐卡片
   ========================================================================== */
.zbb-related-card {
	display: flex;
	flex-direction: column;
	background: var(--zbb-white);
	border-radius: var(--zbb-radius-lg);
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
	border: 1px solid var(--zbb-gray-100);
	transition: all var(--zbb-transition-normal);
	text-decoration: none;
	color: inherit;
}

.zbb-related-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
	border-color: var(--zbb-primary-light);
}

/* 缩略图区域 */
.zbb-related-card-thumb {
	position: relative;
	width: 100%;
	padding-top: 56.25%; /* 16:9 比例 */
	background: linear-gradient(135deg, var(--zbb-gray-100) 0%, var(--zbb-gray-200) 100%);
	overflow: hidden;
}

.zbb-related-card-thumb img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform var(--zbb-transition-normal);
}

.zbb-related-card:hover .zbb-related-card-thumb img {
	transform: scale(1.05);
}

/* 无图片时的占位符 - 渐变背景更美观 */
.zbb-related-card-placeholder {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	color: var(--zbb-white);
	font-size: 2.5rem;
	opacity: 1;
}

/* 不同卡片使用不同渐变色 */
.zbb-related-card:nth-child(1) .zbb-related-card-placeholder {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.zbb-related-card:nth-child(2) .zbb-related-card-placeholder {
	background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.zbb-related-card:nth-child(3) .zbb-related-card-placeholder {
	background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.zbb-related-card:nth-child(4) .zbb-related-card-placeholder {
	background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.zbb-related-card:nth-child(5) .zbb-related-card-placeholder {
	background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.zbb-related-card:nth-child(6) .zbb-related-card-placeholder {
	background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
	color: var(--zbb-gray-700);
}

/* 分类标签 */
.zbb-related-card-category {
	position: absolute;
	top: 10px;
	left: 10px;
	padding: 4px 10px;
	background: rgba(255, 255, 255, 0.95);
	color: var(--zbb-primary);
	font-size: 11px;
	font-weight: 600;
	border-radius: var(--zbb-radius-full);
	backdrop-filter: blur(4px);
}

/* 卡片内容区 */
.zbb-related-card-body {
	flex: 1;
	display: flex;
	flex-direction: column;
	padding: var(--zbb-spacing-md);
}

.zbb-related-card-title {
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.5;
	color: var(--zbb-gray-900);
	margin: 0 0 var(--zbb-spacing-sm);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	transition: color var(--zbb-transition-fast);
}

.zbb-related-card:hover .zbb-related-card-title {
	color: var(--zbb-primary);
}

.zbb-related-card-excerpt {
	font-size: 13px;
	line-height: 1.6;
	color: var(--zbb-gray-600);
	margin: 0 0 var(--zbb-spacing-sm);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	flex: 1;
}

/* 卡片底部元信息 */
.zbb-related-card-meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding-top: var(--zbb-spacing-sm);
	border-top: 1px solid var(--zbb-gray-100);
	font-size: 12px;
	color: var(--zbb-gray-500);
}

.zbb-related-card-date {
	display: flex;
	align-items: center;
	gap: 4px;
}

.zbb-related-card-date i {
	font-size: 11px;
}

.zbb-related-card-views {
	display: flex;
	align-items: center;
	gap: 4px;
}

.zbb-related-card-views i {
	font-size: 11px;
}

/* ==========================================================================
   列表式布局（备选，用于更紧凑的显示）
   ========================================================================== */
.zbb-related-posts-list {
	display: flex;
	flex-direction: column;
	gap: var(--zbb-spacing-md);
}

.zbb-related-item {
	display: flex;
	gap: var(--zbb-spacing-md);
	padding: var(--zbb-spacing-md);
	background: var(--zbb-white);
	border-radius: var(--zbb-radius-lg);
	border: 1px solid var(--zbb-gray-100);
	text-decoration: none;
	color: inherit;
	transition: all var(--zbb-transition-fast);
}

.zbb-related-item:hover {
	border-color: var(--zbb-primary-light);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.zbb-related-item-thumb {
	flex-shrink: 0;
	width: 120px;
	height: 80px;
	border-radius: var(--zbb-radius-md);
	overflow: hidden;
	background: var(--zbb-gray-100);
}

.zbb-related-item-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.zbb-related-item-content {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

.zbb-related-item-title {
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.4;
	color: var(--zbb-gray-900);
	margin: 0 0 6px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.zbb-related-item:hover .zbb-related-item-title {
	color: var(--zbb-primary);
}

.zbb-related-item-meta {
	font-size: 12px;
	color: var(--zbb-gray-500);
	display: flex;
	align-items: center;
	gap: var(--zbb-spacing-sm);
}

/* ==========================================================================
   响应式设计
   ========================================================================== */
@media (max-width: 992px) {
	.zbb-related-posts-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 768px) {
	.zbb-related-posts {
		margin-left: calc(-1 * var(--zbb-spacing-md));
		margin-right: calc(-1 * var(--zbb-spacing-md));
		padding-left: var(--zbb-spacing-md);
		padding-right: var(--zbb-spacing-md);
		border-radius: 0;
	}

	.zbb-related-posts-grid {
		grid-template-columns: 1fr;
		gap: var(--zbb-spacing-md);
	}

	/* 移动端使用横向卡片布局 */
	.zbb-related-card {
		flex-direction: row;
	}

	.zbb-related-card-thumb {
		width: 120px;
		min-width: 120px;
		padding-top: 0;
		height: 100px;
	}

	.zbb-related-card-body {
		padding: var(--zbb-spacing-sm) var(--zbb-spacing-md);
	}

	.zbb-related-card-title {
		font-size: 14px;
		-webkit-line-clamp: 2;
	}

	.zbb-related-card-excerpt {
		display: none;
	}

	.zbb-related-card-meta {
		border-top: none;
		padding-top: 0;
	}
}

@media (max-width: 480px) {
	.zbb-related-posts-header {
		flex-direction: column;
		align-items: flex-start;
		gap: var(--zbb-spacing-sm);
	}

	.zbb-related-card-thumb {
		width: 100px;
		min-width: 100px;
		height: 80px;
	}

	.zbb-related-card-title {
		font-size: 13px;
	}
}

/* ==========================================================================
   隐藏旧的推荐阅读样式
   ========================================================================== */
.zbb-random-posts {
	display: none !important;
}


/* ==========================================================================
   评论区域优化 - 减少空白，更紧凑
   ========================================================================== */
.zbb-comments-section {
	margin-top: var(--zbb-spacing-xl) !important;
	padding-top: var(--zbb-spacing-lg) !important;
}

.zbb-comment-form-wrapper {
	margin-top: var(--zbb-spacing-lg) !important;
	padding-top: var(--zbb-spacing-lg) !important;
}

/* 评论表单更紧凑 */
.zbb-comment-form .comment-reply-title {
	margin-bottom: var(--zbb-spacing-md) !important;
}

.zbb-form-group {
	margin-bottom: var(--zbb-spacing-sm) !important;
}

.zbb-comment-form textarea {
	min-height: 100px !important;
}

/* 推荐阅读与评论区之间的间距 */
.zbb-related-posts + .zbb-comments-section,
.zbb-related-posts + div > .zbb-comments-section {
	margin-top: var(--zbb-spacing-lg) !important;
}
