/* Layout Grid */
.post-content-grid {
	display: grid;
	grid-template-columns: 1fr 300px;
	gap: 2rem;
	max-width: 1400px;
	margin: 0 auto;
}

.post-sidebar {
	position: relative;
	width: 100%;
	z-index: 5;
}

.post-sidebar-sticky {
	width: 100%;
	z-index: 10;
}

/* TOC Styles */
.toc {
	margin-bottom: 1.5rem;
	padding: 1rem;
	background: var(--bg-secondary);
	border-radius: 12px;
	border: 1px solid var(--border-color);
}

.toc.toc-hidden .toc-unlock-link {
	display: none;
}

.toc-title {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 600;
	color: var(--text-primary);
	cursor: pointer;
	user-select: none;
	padding-bottom: 0.5rem;
	border-bottom: 1px solid var(--border-color);
	margin-bottom: 1rem;
}

.toc-title svg {
	flex-shrink: 0;
	stroke: var(--text-accent);
}

.toc-unlock-link {
	display: block;
}

.toc-unlock-link ul {
	list-style: none;
	padding: 0;
	margin: 0;
}

.toc-unlock-link li {
	margin: 0.5rem 0;
}

.toc-unlock-link a {
	display: block;
	color: var(--text-secondary);
	text-decoration: none;
	font-size: 13px;
	padding: 0.25rem 0.5rem;
	border-radius: 4px;
	transition: all 0.2s ease;
	line-height: 1.4;
}

.toc-unlock-link a:hover,
.toc-unlock-link a.active {
	color: var(--text-accent);
	background: rgba(255, 62, 69, 0.1);
	transform: translateX(4px);
}

.toc-unlock-link .toc-h2 {
	padding-left: 0;
}

.toc-unlock-link .toc-h3 {
	padding-left: 1rem;
	font-size: 12px;
}

.toc-unlock-link .toc-h4 {
	padding-left: 2rem;
	font-size: 11px;
}

/* Related Posts - Sidebar */
.related-posts-sidebar {
	margin-top: 2rem;
	padding: 0 1rem;
	background: var(--bg-secondary);
	border-radius: 12px;
	border: 1px solid var(--border-color);
}

.related-posts-title {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 600;
	color: var(--text-primary);
	margin-bottom: 1rem;
	padding-bottom: 0.5rem;
	border-bottom: 1px solid var(--border-color);
}

.related-posts-title svg {
	flex-shrink: 0;
	stroke: var(--text-accent);
}

.related-posts-list {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.related-post-item {
	display: flex;
	gap: 0.75rem;
	padding: 0.75rem;
	border-radius: 8px;
	transition: all 0.2s ease;
	cursor: pointer;
}

.related-post-item:hover {
	background: var(--bg-tertiary);
	transform: translateX(2px);
}

.related-post-image {
	flex-shrink: 0;
	width: 60px;
	height: 60px;
	border-radius: 6px;
	overflow: hidden;
}

.related-post-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.2s ease;
}

.related-post-item:hover .related-post-image img {
	transform: scale(1.05);
}

.related-post-content {
	flex: 1;
	min-width: 0;
}

.related-post-title {
	margin: 0 0 0.25rem 0;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
}

.related-post-title a {
	color: var(--text-primary);
	text-decoration: none;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	transition: color 0.2s ease;
}

.related-post-title a:hover {
	color: var(--text-accent);
}

.related-post-meta {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 11px;
	color: var(--text-secondary);
}

.related-post-meta span {
	display: flex;
	align-items: center;
	gap: 0.25rem;
}

.related-post-meta .reading-time::before {
	content: "•";
	margin-right: 0.25rem;
}

/* Related Posts - Mobile Grid */
.related-posts-mobile {
	margin-top: 3rem;
	padding: 2rem;
	background: var(--bg-secondary);
	border-radius: 16px;
	border: 1px solid var(--border-color);
	padding-top: 0;
}

.related-posts-mobile .related-posts-title {
	display: flex;
	align-items: center;
	gap: 12px;
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--text-primary);
	margin-bottom: 1.5rem;
	text-align: center;
	justify-content: center;
	padding-top: 0;
	margin-top: 8px;
}

.related-posts-mobile .related-posts-title svg {
	stroke: var(--text-accent);
}

.related-posts-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 1.5rem;
}

.related-post-card {
	background: var(--bg-primary);
	border-radius: 12px;
	overflow: hidden;
	border: 1px solid var(--border-color);
	transition: all 0.3s ease;
	cursor: pointer;
}

.related-post-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.related-post-card-image {
	position: relative;
	aspect-ratio: 16/9;
	overflow: hidden;
}

.related-post-card-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.related-post-card:hover .related-post-card-image img {
	transform: scale(1.05);
}

.related-post-card-content {
	padding: 1rem;
}

.related-post-card-title {
	margin: 0.5rem 0;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.3;
}

.related-post-card-title a {
	color: var(--text-primary);
	text-decoration: none;
	transition: color 0.2s ease;
}

.related-post-card-title a:hover {
	color: var(--text-accent);
}

.related-post-card-excerpt {
	font-size: 0.875rem;
	color: var(--text-secondary);
	line-height: 1.4;
	margin-bottom: 0.75rem;
}

.related-posts-more {
	margin-top: 2rem;
	text-align: center;
	display: flex;
	gap: 1rem;
	justify-content: center;
	flex-wrap: wrap;
}

.btn-load-more-related {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 24px;
	border-radius: 24px;
	font-weight: 600;
	font-size: 0.875rem;
	transition: all 0.3s ease;
	border: none;
	cursor: pointer;
	text-decoration: none;
}

.btn-load-more-related {
	background: var(--text-accent);
	color: white;
}

.btn-load-more-related:hover:not(:disabled) {
	background: #e3384a;
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(255, 62, 69, 0.3);
}

.btn-load-more-related:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	transform: none;
}

.btn-spinner {
	animation: spin 1s linear infinite;
}

@keyframes spin {
	from {
		transform: rotate(0deg);
	}

	to {
		transform: rotate(360deg);
	}
}

/* Đảm bảo ẩn nội dung TOC khi có class toc-hidden */
.toc.toc-hidden .toc-unlock-link {
	display: none !important;
}

/* Thêm chỉ báo trạng thái đóng/mở (tùy chọn) */
.toc-title {
	position: relative;
}

.toc-title::after {
	content: '';
	position: absolute;
	right: 0;
	top: 50%;
	width: 8px;
	height: 8px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translateY(-50%) rotate(45deg);
	transition: transform 0.3s ease;
}

.toc.toc-hidden .toc-title::after {
	transform: translateY(-50%) rotate(-135deg);
}


/* Default state */
#toc-content {
	display: block !important;
}

/* Hidden state */
.toc.toc-hidden #toc-content {
	display: none !important;
}




/* Media Queries */
@media (max-width: 1200px) {
	.post-content-grid {
		grid-template-columns: 1fr 250px;
		gap: 1.5rem;
	}

	.related-posts-sidebar {
		padding: 0 1rem;
	}

	.toc {
		padding: 1rem;
	}

	.related-post-item {
		padding: 0.5rem;
	}

	.related-post-image {
		width: 50px;
		height: 50px;
	}
}

@media (max-width: 900px) {
	.post-content-grid {
		grid-template-columns: 1fr;
		gap: 1rem;
	}

	.post-sidebar {
		order: -1;
		position: static;
	}

	.post-sidebar-sticky {
		position: static;
		float: left;
		width: 100%;
		margin-top: 20px;
	}

	.related-posts-mobile {
		display: block;
		padding: 1.5rem;
		margin-top: 2rem;
	}

	.related-posts-mobile .related-posts-list {
		display: grid;
		grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
		gap: 1rem;
	}

	.related-posts-mobile .related-post-item {
		flex-direction: column;
		text-align: center;
	}

	.related-posts-mobile .related-post-image {
		width: 100%;
		height: 120px;
		margin: 0 auto 0.5rem;
	}
}

@media (max-width: 640px) {
	.related-posts-mobile {
		margin-top: 2rem;
		padding: 0 1.5rem;
		padding-bottom: 1.5rem;
	}

	.related-posts-grid {
		grid-template-columns: 1fr;
		gap: 1rem;
	}

	.related-posts-mobile .related-posts-title {
		font-size: 1.1rem;
	}
}