/* 工具详情整页态「产品评分」区块（part-tool-rating.php + rating.js）
   不依赖主题 Tailwind 构建，全部用 mytb-rating-* 自有类，配色对齐主题（amber 星 / gray 中性）
   外层是原生 <details>：默认折叠，summary 行常驻综合分摘要，点开展开完整面板 */

.mytb-rating {
	border: 1px solid #f3f4f6;
	border-radius: 14px;
	overflow: hidden;
}

.mytb-rating-summary {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 20px;
	cursor: pointer;
	user-select: none;
	list-style: none; /* 干掉默认三角，用自绘 caret */
	background: #f9fafb;
}

.mytb-rating-summary::-webkit-details-marker {
	display: none;
}

.mytb-rating-summary:hover {
	background: #f3f4f6;
}

/* 自绘三角：折叠时朝右，展开时旋转朝下 */
.mytb-rating-caret {
	flex: none;
	width: 0;
	height: 0;
	border-top: 5px solid transparent;
	border-bottom: 5px solid transparent;
	border-left: 7px solid #9ca3af;
	transition: transform .2s ease;
}

.mytb-rating[open] .mytb-rating-caret {
	transform: rotate(90deg);
}

.mytb-rating-title {
	font-size: 16px;
	line-height: 24px;
	font-weight: 700;
	color: #111827;
}

/* summary 行的分数摘要（常驻，折叠时也能看到分） */
.mytb-rating-brief {
	display: inline-flex;
	align-items: baseline;
	gap: 6px;
	margin-left: auto;
}

.mytb-rating-brief-score {
	font-size: 18px;
	font-weight: 700;
	color: #111827;
	font-variant-numeric: tabular-nums;
}

.mytb-rating-brief-count {
	font-size: 12px;
	color: #9ca3af;
}

.mytb-rating-body {
	padding: 16px 20px 20px;
}

/* ---- 汇总面板：综合分 / 星级分布 / 三维均分 ---- */

.mytb-rating-panel {
	display: grid;
	grid-template-columns: auto 1fr 1fr;
	gap: 24px 40px;
	align-items: center;
}

@media (max-width: 640px) {
	.mytb-rating-panel {
		grid-template-columns: 1fr;
		gap: 20px;
	}
}

.mytb-rating-score-box {
	text-align: center;
	min-width: 96px;
}

.mytb-rating-score {
	font-size: 40px;
	line-height: 1.1;
	font-weight: 700;
	color: #111827;
	font-variant-numeric: tabular-nums;
}

.mytb-rating-score.is-empty {
	color: #d1d5db;
}

.mytb-rating-stars {
	margin-top: 4px;
}

.mytb-rating-count {
	margin-top: 4px;
	font-size: 13px;
	color: #6b7280;
}

.mytb-rating-count-sub {
	color: #9ca3af;
	font-size: 12px;
}

/* 星星：展示态和按钮态共用，实心 ★ 靠颜色区分亮/灭 */
.mytb-star {
	display: inline-block;
	font-style: normal;
	color: #e5e7eb;
	font-size: 16px;
	line-height: 1;
}

.mytb-star::before {
	content: "★";
}

.mytb-star.is-on {
	color: #f59e0b;
}

/* 星级分布 / 维度条 */
.mytb-rating-dist-row,
.mytb-rating-dim-row {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 6px 0;
}

.mytb-rating-dist-label,
.mytb-rating-dim-label {
	flex: none;
	width: 44px;
	font-size: 13px;
	color: #6b7280;
	white-space: nowrap;
}

.mytb-rating-dist-bar {
	flex: 1;
	height: 8px;
	background: #e5e7eb;
	border-radius: 999px;
	overflow: hidden;
}

.mytb-rating-dist-bar i {
	display: block;
	height: 100%;
	background: #111827;
	border-radius: 999px;
	transition: width .3s ease;
}

.mytb-rating-dist-pct,
.mytb-rating-dim-val {
	flex: none;
	width: 38px;
	text-align: right;
	font-size: 12px;
	color: #9ca3af;
	font-variant-numeric: tabular-nums;
}

/* ---- 打分表单 ---- */

.mytb-rating-form {
	margin-top: 16px;
}

.mytb-rating-form-head {
	font-size: 14px;
	font-weight: 600;
	color: #374151;
	margin-bottom: 8px;
}

.mytb-rating-input-row {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 4px 0;
}

.mytb-rating-input-row .mytb-rating-dim-label {
	width: 48px;
}

.mytb-star-btn {
	appearance: none;
	background: none;
	border: 0;
	padding: 2px;
	margin: 0;
	cursor: pointer;
	font-size: 22px;
	transition: transform .1s ease;
}

.mytb-star-btn:hover {
	transform: scale(1.15);
}

/* hover 预览态（JS 加/去 is-hover） */
.mytb-star-btn.is-hover {
	color: #fbbf24;
}

.mytb-rating-comment-wrap {
	margin-top: 12px;
}

.mytb-rating-comment-label {
	display: block;
	font-size: 13px;
	color: #6b7280;
	margin-bottom: 6px;
}

.mytb-rating-comment {
	display: block;
	width: 100%;
	box-sizing: border-box;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	padding: 10px 12px;
	font-size: 14px;
	line-height: 1.5;
	color: #374151;
	resize: vertical;
	min-height: 72px;
	background: #fff;
}

.mytb-rating-comment:focus {
	outline: none;
	border-color: #f03030;
	box-shadow: 0 0 0 2px rgba(240, 48, 48, 0.12);
}

.mytb-rating-form-foot {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 10px;
}

.mytb-rating-submit {
	appearance: none;
	border: 0;
	border-radius: 999px;
	padding: 7px 20px;
	font-size: 14px;
	font-weight: 600;
	color: #fff;
	background: #f03030;
	cursor: pointer;
	transition: opacity .15s ease;
}

.mytb-rating-submit:hover {
	opacity: .88;
}

.mytb-rating-submit:disabled {
	background: #e5e7eb;
	color: #9ca3af;
	cursor: not-allowed;
}

.mytb-rating-msg {
	font-size: 13px;
	color: #6b7280;
}

.mytb-rating-msg.is-error {
	color: #dc2626;
}

/* 只读态的星星（评过分的普通用户）：和按钮星星同尺寸，但无交互 */
.mytb-star-static {
	font-size: 22px;
	padding: 2px;
}

.mytb-rating-locked-tip {
	font-size: 13px;
	color: #9ca3af;
	margin: 8px 0 0;
}

.mytb-rating-login-tip {
	font-size: 14px;
	color: #6b7280;
	margin: 0;
}

.mytb-rating-login-tip a {
	color: #f03030;
	font-weight: 600;
}

/* ---- 周趋势曲线 ---- */

.mytb-rating-trend {
	margin-top: 20px;
}

.mytb-rating-trend-head {
	font-size: 14px;
	font-weight: 600;
	color: #374151;
	margin-bottom: 8px;
}

.mytb-rating-trend-chart svg {
	display: block;
	width: 100%;
	height: auto;
}

/* ---- 头部摘要旁侧「评分 / 已评」按钮 + 弹层 ---- */

.mytb-rate-badge {
	display: inline-flex;
	align-items: center;
	padding: 2px 6px;
	border-radius: 4px;
	font-size: 13px; /* 标签档 footnote，对齐全站字号阶梯 */
	font-weight: 500;
	line-height: 1;
	text-decoration: none;
	border: none;
	cursor: default;
}

.mytb-rate-badge.is-done {
	background: #f3f4f6;
	color: #9ca3af;
}

.mytb-rate-badge.is-action {
	background: #111827;
	color: #fff;
	cursor: pointer;
}

.mytb-rate-badge.is-action:hover {
	background: #000;
}

.mytb-rate-pop {
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	margin-top: 8px;
	z-index: 30;
	width: 220px;
	padding: 14px;
	border-radius: 12px;
	border: 1px solid #f3f4f6;
	background: #fff;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.mytb-rate-pop-title {
	font-size: 12px;
	font-weight: 600;
	color: #111827;
	margin-bottom: 10px;
}

.mytb-rate-pop-row {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 6px 0;
}

.mytb-rate-pop-label {
	flex: none;
	width: 40px;
	font-size: 12px;
	color: #9ca3af;
	white-space: nowrap;
}

.mytb-rate-pop-comment {
	display: block;
	width: 100%;
	box-sizing: border-box;
	margin-top: 10px;
	padding: 6px 10px;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	font-size: 12px;
	color: #111827;
	resize: none;
}

.mytb-rate-pop-foot {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 10px;
}

.mytb-rate-pop-submit {
	border: none;
	border-radius: 999px;
	padding: 4px 14px;
	font-size: 12px;
	font-weight: 600;
	color: #fff;
	background: #111827;
	cursor: pointer;
}

.mytb-rate-pop-submit:disabled {
	background: #e5e7eb;
	color: #9ca3af;
	cursor: not-allowed;
}

.mytb-rate-pop-msg {
	font-size: 13px; /* footnote */
	color: #999999;
}

.mytb-rate-pop-msg.is-error {
	color: #dc2626;
}
