/**
 * Cainiao2026 主题 —— 评论区样式
 *
 * 视觉参考 ipcmen.com 评论区：
 *  - 区块标题：左侧 4px 强调竖条 + 2px 下分隔线
 *  - 评论列表：扁平化，条目之间用 1px 细线分隔，悬停轻微着色
 *  - 圆形描边头像（子评论缩小一级）
 *  - 回复/编辑：48×24 小按钮，悬停填充强调色
 *  - 表单：卡片化容器，圆角输入框，聚焦 3px 光圈
 *  - 表情栏：横向排列，悬停放大
 *  - 提交按钮：强调色实心圆角按钮，悬停微上浮
 *
 * 颜色全部走 main.css 的 CSS 变量，自动适配日间/夜间模式。
 */

/* ==========================================================================
   区块标题
   ========================================================================== */

.comments-area .comments-title,
.comments-area .comment-reply-title {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .5rem;
	margin: 0 0 1.25rem;
	padding-bottom: .75rem;
	border-bottom: 2px solid var(--border-color);
	font-size: 1.125rem;
	font-weight: 700;
	line-height: 1.5;
	color: var(--text-primary);
}

.comments-area .comments-title::before,
.comments-area .comment-reply-title::before {
	content: '';
	flex: 0 0 auto;
	width: 4px;
	height: 20px;
	border-radius: 5px;
	background: var(--accent);
}

.comments-area .comment-reply-title {
	font-size: 1rem;
}

.comments-area .comment-reply-title small {
	font-size: .75rem;
	font-weight: 400;
}

.comments-area #cancel-comment-reply-link {
	color: #e0533d;
	font-size: .75rem;
	text-decoration: none;
}

.comments-area #cancel-comment-reply-link:hover {
	color: #c0392b;
	text-decoration: underline;
}

/* ==========================================================================
   评论列表
   ========================================================================== */

.comments-area {
	margin-top: 2.5rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--border-color);
}

.comments-area .comment-list {
	gap: 0;
	margin: 0 0 1.5rem;
	padding: 0;
}

.comments-area .comment-list li {
	list-style: none;
}

.comments-area .comment-list > li {
	position: relative;
	padding: 1.25rem 0;
	border-bottom: 1px solid var(--border-color);
	transition: background-color .2s ease;
}

.comments-area .comment-list > li:hover {
	background-color: color-mix(in srgb, var(--accent) 4%, transparent);
}

.comments-area .comment-list > li:last-child {
	border-bottom: 0;
}

.comments-area .comment-list .comment-body {
	display: flex;
	align-items: flex-start;
	gap: .875rem;
	background: transparent;
	border: 0;
	border-radius: 0;
	padding: 0;
}

.comments-area .comment-list .comment-body:hover {
	border-color: transparent;
}

/* 头像 */
.comments-area .comment-list .comment-author {
	flex: 0 0 44px;
	width: 44px;
	line-height: 0;
}

.comments-area .comment-list .comment-author img {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: 2px solid var(--border-color);
	object-fit: cover;
	background: var(--bg-secondary);
}

.comments-area .comment-main {
	min-width: 0;
	flex: 1;
}

.comments-area .comment-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: .5rem;
	margin-bottom: .15rem;
}

.comments-area .comment-author-name {
	font-size: .875rem;
	font-weight: 600;
	color: var(--text-primary);
}

.comments-area .comment-author-name a {
	color: var(--text-primary);
}

.comments-area .comment-author-name a:hover {
	color: var(--accent);
	text-decoration: none;
}

.comments-area .comment-date {
	margin: 2px 0 8px;
	font-size: .75rem;
	color: var(--text-secondary);
}

.comments-area .comment-text {
	font-size: .875rem;
	line-height: 1.8;
	color: var(--text-primary);
	overflow-wrap: break-word;
}

.comments-area .comment-text p {
	margin: 0 0 .4em;
}

.comments-area .comment-text p:last-child {
	margin-bottom: 0;
}

/* 待审核提示 */
.comments-area .comment-awaiting-moderation {
	display: inline-block;
	margin: 0 0 .5rem;
	padding: .25rem .75rem;
	border: 1px solid color-mix(in srgb, #ffc107 45%, var(--border-color));
	border-radius: 5px;
	background: rgba(255, 193, 7, .12);
	color: #8a6d3b;
	font-size: .75rem;
	font-style: normal;
}

html[data-theme="dark"] .comments-area .comment-awaiting-moderation {
	color: #e6c26e;
}

/* 回复 / 编辑 */
.comments-area .comment-foot {
	display: flex;
	align-items: center;
	gap: .25rem;
	margin-top: .35rem;
	font-size: .8125rem;
}

.comments-area .comment-foot a,
.comments-area .comment-foot .comment-edit-link a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 48px;
	height: 24px;
	padding: 0 .5rem;
	border-radius: 5px;
	background: transparent;
	color: var(--text-secondary);
	font-size: .8125rem;
	text-decoration: none;
	transition: background-color .2s ease, color .2s ease;
}

.comments-area .comment-foot a:hover {
	background: var(--accent);
	color: #fff;
	text-decoration: none;
}

/* 嵌套回复 */
.comments-area .comment-list .children {
	display: flex;
	flex-direction: column;
	gap: 0;
	margin: .5rem 0 0;
	padding: 0 0 0 2.5rem;
	border-left: 2px solid var(--border-color);
	border-radius: 0 0 0 5px;
}

.comments-area .comment-list .children > li {
	padding: .75rem 0 .75rem .75rem;
	border-bottom: 1px solid var(--border-color);
}

.comments-area .comment-list .children > li:last-child {
	border-bottom: 0;
}

.comments-area .comment-list .children .comment-author {
	flex-basis: 36px;
	width: 36px;
}

.comments-area .comment-list .children .comment-author img {
	width: 36px;
	height: 36px;
}

.comments-area .comment-list .children .comment-author-name,
.comments-area .comment-list .children .comment-text {
	font-size: .8125rem;
}

/* 空状态 */
.comments-area .no-comments {
	padding: 1.75rem 1.25rem;
	background: var(--bg-secondary);
	border: 1px dashed var(--card-border);
	border-radius: 5px;
	color: var(--text-secondary);
	text-align: center;
	font-size: .875rem;
}

.comments-area .comments-loadmore-wrap {
	padding: .5rem 0 0;
}

/* ==========================================================================
   评论表单
   ========================================================================== */

.comments-area .comment-respond {
	margin-top: 0;
	padding: 1.5rem;
	background: var(--bg-secondary);
	border-radius: 5px;
	box-shadow: var(--shadow);
	transition: box-shadow .3s ease, background-color .25s ease, border-color .25s ease;
}

.comments-area .comment-respond:hover {
	box-shadow: var(--shadow-hover);
}

.comments-area .comment-form {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: .875rem;
	margin-top: 0;
}

/* 默认整行，昵称/邮箱/网址三个字段并排一行 */
.comments-area .comment-form > * {
	grid-column: 1 / -1;
}

.comments-area .comment-form > .comment-form-author,
.comments-area .comment-form > .comment-form-email,
.comments-area .comment-form > .comment-form-url {
	grid-column: auto;
}

.comments-area .comment-form > p {
	margin: 0;
}

.comments-area .comment-form label {
	font-size: .8125rem;
	font-weight: 500;
	color: var(--text-secondary);
}

.comments-area .comment-form p.comment-notes,
.comments-area .comment-form p.logged-in-as,
.comments-area .comment-form p.comment-notes + p {
	font-size: .8125rem;
}

.comments-area .comment-form input[type="text"],
.comments-area .comment-form input[type="email"],
.comments-area .comment-form input[type="url"],
.comments-area .comment-form textarea {
	width: 100%;
	max-width: none;
	padding: .625rem .875rem;
	border: 1.5px solid var(--border-color);
	border-radius: 5px;
	background: var(--bg-primary);
	color: var(--text-primary);
	font-family: inherit;
	font-size: .875rem;
	line-height: 1.6;
	transition: border-color .25s ease, box-shadow .25s ease, background-color .25s ease;
}

.comments-area .comment-form input[type="text"]:focus,
.comments-area .comment-form input[type="email"]:focus,
.comments-area .comment-form input[type="url"]:focus,
.comments-area .comment-form textarea:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-soft);
}

.comments-area .comment-form textarea {
	min-height: 90px;
	resize: vertical;
}

.comments-area .comment-form p.comment-form-cookies-consent {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: .4rem;
}

.comments-area .comment-form p.comment-form-cookies-consent input[type="checkbox"] {
	width: 15px;
	height: 15px;
	flex: 0 0 auto;
	margin: 0;
	accent-color: var(--accent);
}

.comments-area .comment-form p.comment-form-cookies-consent label {
	font-size: .8125rem;
}

/* --------------------------------------------------------------------------
   表情栏
   -------------------------------------------------------------------------- */

.comments-area .cainiao-comment-field {
	position: relative;
}

.comments-area .cainiao-comment-field.has-avatar {
	padding-left: 3.5rem;
}

.comments-area .cainiao-comment-avatar {
	position: absolute;
	left: 0;
	bottom: 0;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: 2px solid var(--border-color);
	object-fit: cover;
	background: var(--bg-primary);
}

.comments-area .cainiao-emoji-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 2px;
	padding: .375rem 0 .625rem;
	margin-bottom: .625rem;
	border-bottom: 1px dashed var(--border-color);
}

.comments-area .cainiao-emoji-item {
	padding: 2px 4px;
	border: 0;
	border-radius: 5px;
	background: transparent;
	color: inherit;
	font-size: 1.125rem;
	line-height: 1.2;
	cursor: pointer;
	user-select: none;
	-webkit-user-select: none;
	transition: transform .2s ease, background-color .2s ease;
}

.comments-area .cainiao-emoji-item:hover {
	transform: scale(1.25);
	background: var(--accent-soft);
}

.comments-area .cainiao-emoji-item:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 1px;
}

/* --------------------------------------------------------------------------
   提交按钮
   -------------------------------------------------------------------------- */

.comments-area .comment-form p.form-submit {
	display: flex;
	flex-direction: row;
	justify-content: flex-end;
	align-items: center;
	gap: .75rem;
	margin: .25rem 0 0;
}

.comments-area .comment-form .submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .375rem;
	padding: .625rem 1.75rem;
	border: 0;
	border-radius: 5px;
	background: var(--accent);
	color: #fff;
	font-family: inherit;
	font-size: .875rem;
	font-weight: 500;
	line-height: 1.5;
	cursor: pointer;
	box-shadow: 0 2px 8px var(--accent-soft);
	transition: background-color .3s ease, transform .3s ease, box-shadow .3s ease;
}

.comments-area .comment-form .submit:hover {
	background: var(--accent-hover);
	filter: none;
	transform: translateY(-1px);
	box-shadow: 0 4px 16px var(--accent-soft);
}

.comments-area .comment-form .submit:active {
	transform: translateY(0);
}

.comments-area .comment-form .submit[disabled] {
	opacity: .65;
	cursor: not-allowed;
	transform: none;
}

.comments-area .cainiao-icon-plane {
	flex: 0 0 auto;
	display: block;
}

/* ==========================================================================
   响应式
   ========================================================================== */

@media (max-width: 767px) {
	.comments-area .comment-respond {
		padding: 1rem;
		border-radius: 5px;
	}

	.comments-area .comment-form {
		grid-template-columns: minmax(0, 1fr);
		gap: .625rem;
	}

	.comments-area .comment-list .children {
		padding-left: 1.5rem;
	}

	.comments-area .comment-list .comment-author,
	.comments-area .comment-list .children .comment-author {
		flex-basis: 36px;
		width: 36px;
	}

	.comments-area .comment-list .comment-author img,
	.comments-area .comment-list .children .comment-author img {
		width: 36px;
		height: 36px;
	}

	.comments-area .cainiao-comment-field.has-avatar {
		padding-left: 2.75rem;
	}

	.comments-area .cainiao-comment-avatar {
		width: 36px;
		height: 36px;
	}

	.comments-area .comment-form p.form-submit {
		justify-content: stretch;
	}

	.comments-area .comment-form .submit {
		width: 100%;
	}
}
