/**
 * ZTsite Hot 独立热榜样式（全新 .zthot-* 命名空间）
 *
 * 视觉规格对齐父主题热榜卡片的用户可见特性：
 * - 响应式栅格 1/2/3 列；卡片圆角阴影、头部图标+名称+副标题（副标题移动端隐藏）；
 * - 榜单滚动区 max-height 300px / min-height 200px；
 * - 排名徽章前三名浅色底彩字；热度值移动端隐藏；
 * - 加载遮罩 + 旋转动画；刷新按钮旋转动画；错误文案淡出。
 */

/* ---------- 页面栅格 ---------- */

.zthot-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 15px;
	align-items: stretch; /* 同行卡片等高，避免内容不足/抓取为空时参差 */
}

@media (min-width: 768px) {
	.zthot-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
	.zthot-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- 卡片骨架 ---------- */

.zthot-card {
	position: relative;
	display: flex;
	flex-direction: column;
	background: var(--main-bg-color, #fff);
	border-radius: var(--theme-border-radius, 8px);
	box-shadow: 0 0 10px rgba(0, 0, 0, 0.06);
	overflow: hidden;
}

.zthot-card-head {
	display: flex;
	align-items: center;
	padding: 12px 15px;
	border-bottom: 1px solid rgba(0, 0, 0, 0.05);
	line-height: 1.4;
}

.zthot-ico {
	width: 16px;
	height: auto;
	margin-right: 6px;
	flex-shrink: 0;
	vertical-align: -0.1em;
}

.zthot-name {
	font-size: 15px;
	font-weight: 600;
	color: inherit;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* 副标题：桌面端右侧灰字，移动端隐藏 */
.zthot-sub {
	margin-left: auto;
	padding-left: 8px;
	font-size: 12px;
	color: #999;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	display: none;
}

/* 「N 分钟前更新」时间戳（底栏左下角） */
.zthot-updated {
	font-size: 12px;
	color: #999;
	white-space: nowrap;
	flex-shrink: 0;
}

@media (min-width: 768px) {
	.zthot-sub { display: block; max-width: 40%; }
	.zthot-name { flex-shrink: 0; }
}

/* ---------- 榜单主体 ---------- */

.zthot-card-body {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 240px;
}

.zthot-scroll {
	flex: 1 1 auto;
	overflow-y: auto;
	max-height: 300px;
	min-height: 200px;
	padding: 5px 15px 0;
}

.zthot-list {
	margin: 0;
	padding: 5px 0;
	list-style: none;
	counter-reset: none;
}

.zthot-list li {
	display: flex;
	align-items: baseline;
	font-size: 14px;
	margin-bottom: 9px;
	line-height: 1.55;
}

.zthot-item-main {
	min-width: 0;
	flex: 1 1 auto;
	display: flex;
	align-items: baseline;
}

/* 排名徽章：前三名浅底彩字，其余灰底灰字 */
.zthot-rank {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	line-height: 18px;
	text-align: center;
	margin-right: 6px;
	transform: translateY(2px);
	font-size: 12px;
	border-radius: 3px;
	background: rgba(0, 0, 0, 0.06);
	color: #999;
}

.zthot-rank.r1 { background: #fdebeb; color: #e5564d; }
.zthot-rank.r2 { background: #fdf3e0; color: #e69b3c; }
.zthot-rank.r3 { background: #f3ecfb; color: #9a6ade; }

.zthot-link {
	color: inherit;
	text-decoration: none;
	word-break: break-word;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 1;
	-webkit-box-orient: vertical;
}

.zthot-link:hover { color: var(--theme-color, #2271b1); }

/* 热度值：仅桌面端显示 */
.zthot-heat {
	display: none;
	flex: 0 0 auto;
	margin-left: 8px;
	padding-left: 4px;
	font-size: 12px;
	color: #999;
	white-space: nowrap;
}

@media (min-width: 768px) {
	.zthot-heat { display: block; margin-left: auto; }
	.zthot-item-main { flex: 1 1 auto; }
}

/* ---------- 底栏：更新时间 / 更多 / 刷新 ---------- */

.zthot-foot {
	display: flex;
	align-items: center;
	/* 卡片被栅格/同行拉伸时，多余高度由 margin-top:auto 吸收在滚动区与底栏之间，
	   保证底栏（更新时间/更多/刷新）始终贴住卡片底部，不会随内容高度上浮 */
	margin-top: auto;
	padding: 8px 15px 10px;
	font-size: 12px;
	color: #999;
}

.zthot-more {
	color: inherit;
	text-decoration: none;
	margin-right: 10px;
}

.zthot-more:hover { color: var(--theme-color, #2271b1); }

.zthot-foot-fill { flex: 1 1 auto; }

.zthot-refresh {
	color: inherit;
	display: inline-flex;
	align-items: center;
	cursor: pointer;
	text-decoration: none;
	line-height: 1;
}

.zthot-refresh:hover { color: var(--theme-color, #2271b1); }

.zthot-svg { display: block; }

.zthot-spin { animation: zthot-rotate 0.9s linear infinite; }

@keyframes zthot-rotate {
	from { transform: rotate(0deg); }
	to   { transform: rotate(360deg); }
}

/* ---------- 加载遮罩 / 错误提示 ---------- */

.zthot-loading {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.08);
	z-index: 1;
	display: flex;
	justify-content: center;
	align-items: center;
	color: #888;
	font-size: 13px;
	border-radius: inherit;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

.zthot-loading.is-hidden {
	opacity: 0;
	visibility: hidden;
}

.zthot-loading.is-error {
	background: rgba(255, 255, 255, 0.92);
	color: #c0392b;
}

/* 中性弱提示（后台更新等过渡态，非错误） */
.zthot-loading.is-note {
	background: rgba(255, 255, 255, 0.88);
	color: #888;
}

/* 筛选空态提示 */
.zthot-empty {
	padding: 40px 16px;
	text-align: center;
	color: #999;
	font-size: 14px;
	border: 1px dashed var(--border-color, rgba(0, 0, 0, .1));
	border-radius: 8px;
	background: rgba(255, 255, 255, .5);
}

/* ---------- TAB 模式小工具 ---------- */

.zthot-tab-card {
	position: relative;
	background: var(--main-bg-color, #fff);
	border-radius: var(--theme-border-radius, 8px);
	box-shadow: 0 0 10px rgba(0, 0, 0, 0.06);
	overflow: hidden;
}

.zthot-tab-head {
	padding: 8px 15px;
	border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.zthot-tab-scroll {
	display: flex;
	overflow-x: auto;
	scrollbar-width: none;
	white-space: nowrap;
}

.zthot-tab-scroll::-webkit-scrollbar { display: none; }

.zthot-tab-btn {
	display: inline-block;
	cursor: pointer;
	opacity: 0.75;
	transition: 0.3s;
	font-size: 14px;
	line-height: 1.5;
	padding: 4px 0;
	user-select: none;
	/* 由 <span> 改为原生 <button>，重置浏览器默认外观 */
	border: none;
	background: none;
	color: inherit;
	font-family: inherit;
	text-align: left;
}

.zthot-tab-btn.active {
	color: var(--theme-color, #2271b1);
	font-weight: bold;
	opacity: 1;
}

.zthot-tab-btn + .zthot-tab-btn { margin-left: 15px; }

.zthot-tab-card .zthot-card {
	display: none;
	box-shadow: none;
	border-radius: 0;
	background: transparent;
}

.zthot-tab-card .zthot-card.is-active { display: block; }

/* 卡片组横向滚动模式（多卡并排，窄屏横向滑动） */

.zthot-x-overflow {
	overflow-x: auto;
	overflow-y: hidden;
}

.zthot-row {
	display: flex;
	gap: 15px;
	align-items: stretch;
}

.zthot-row > .zthot-card {
	flex: 0 0 auto;
	width: 340px;
}

/* ---------- 顶部分类标签 + 搜索框 ---------- */
.zthot-filter {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	padding: 10px 14px;
	margin-bottom: 16px;
	background: rgba(255, 255, 255, .7);
	border: 1px solid var(--border-color, rgba(0, 0, 0, .08));
	border-radius: 8px;
}

.zthot-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	flex: 1 1 auto;
}

.zthot-tag {
	border: 1px solid rgba(0, 0, 0, .1);
	background: transparent;
	color: inherit;
	font-size: 13px;
	line-height: 1;
	padding: 6px 12px;
	border-radius: 20px;
	cursor: pointer;
	transition: background .15s ease, color .15s ease;
}

.zthot-tag:hover { border-color: currentColor; }

.zthot-tag.is-active {
	background: #3370ff;
	border-color: #3370ff;
	color: #fff;
}

.zthot-search {
	flex: 0 0 auto;
	width: 200px;
	max-width: 100%;
	padding: 6px 12px;
	font-size: 13px;
	border: 1px solid rgba(0, 0, 0, .12);
	border-radius: 20px;
	background: rgba(255, 255, 255, .9);
}

@media (max-width: 575px) {
	.zthot-search { width: 100%; }
}

/* ---------- 可切换参数源：卡片内筛选 chips ---------- */

/* chips 内嵌内容区顶部：固定高度单行条，配合下方列表区等量收缩（.zthot-card--vars），
   保证带筛选卡片与普通卡片自然高度一致，栅格/同行不被拉伸出现空白 */
.zthot-vars {
	flex: 0 0 auto;
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	justify-content: flex-start;
	gap: 0 14px;
	height: 34px;
	box-sizing: border-box;
	padding: 0 15px;
	overflow-x: auto;
	overflow-y: hidden;
	border-bottom: 1px solid rgba(0, 0, 0, 0.05);
	background: rgba(0, 0, 0, 0.015);
	line-height: 1;
	scrollbar-width: none; /* 窄卡片溢出时横向轻扫，不占可视高度 */
}
.zthot-vars::-webkit-scrollbar { display: none; }

.zthot-var-group {
	display: inline-flex;
	flex: none;
	align-items: center;
	gap: 5px;
	white-space: nowrap;
}

.zthot-var-label {
	font-size: 12px;
	color: #999;
	white-space: nowrap;
}

.zthot-var {
	border: 1px solid rgba(0, 0, 0, 0.14);
	background: transparent;
	color: inherit;
	font-size: 12px;
	line-height: 1;
	padding: 3px 9px;
	border-radius: 20px;
	cursor: pointer;
	transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.zthot-var:hover { border-color: var(--theme-color, #3370ff); color: var(--theme-color, #3370ff); }

.zthot-var.is-active {
	background: var(--theme-color, #3370ff);
	border-color: var(--theme-color, #3370ff);
	color: #fff;
}

/* 带筛选卡片：列表区等量收缩 chips 的高度（34px），与普通卡片自然高度对齐 */
.zthot-card--vars .zthot-scroll { max-height: 266px; }

/* 切换拉取中：chips 弱化并禁点，防连点触发重复请求 */
.zthot-card.zthot-var-busy .zthot-vars {
	opacity: .55;
	pointer-events: none;
}
