/* ========== 模板页 ========== */

.templates-main {
  justify-content: flex-start;
  padding-top: 32px;
}

.templates-hero {
  text-align: center;
  margin-bottom: 20px;
}

.templates-title {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.templates-subtitle {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin: 0;
}

/* ========== 分类标签 ========== */
.templates-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.category-chip {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.category-chip:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.category-chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(184, 114, 63, 0.25);
}

/* ========== 模板卡片网格 ========== */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 32px;
}

.template-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s ease;
}

.template-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* 封面 */
.template-cover {
  position: relative;
  aspect-ratio: 5 / 2.6;
  background: var(--bg-elevated);
  overflow: hidden;
}

.template-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.template-card:hover .template-cover img {
  transform: scale(1.05);
}

.template-category-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 10px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* 播放按钮（与作品卡同款） */
.work-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  color: var(--brand);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
  padding-left: 2px;
  z-index: 1;
}

.work-play:hover {
  transform: translate(-50%, -50%) scale(1.1);
  background: var(--brand);
  color: #fff;
}

/* 正文 */
.template-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.template-name {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.3;
}

.template-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.template-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.info-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.info-item svg {
  opacity: 0.7;
}

/* 角色按钮：可点击，切换显示具体角色名 */
.info-role-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.2s ease;
}

.info-role-btn svg {
  opacity: 0.7;
}

.info-role-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.info-role-btn:hover svg {
  opacity: 1;
}

.info-role-btn.expanded {
  background: var(--brand-dim);
  border-color: var(--brand);
  color: var(--brand);
  font-weight: 500;
}

.info-role-btn.expanded svg {
  opacity: 1;
}

/* 精度标签 */
.info-precision {
  margin-left: auto;
  padding: 2px 10px;
  background: var(--brand-light);
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  letter-spacing: 0.02em;
}

/* 使用按钮 */
.btn-use-template {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  margin-top: 4px;
  background: var(--brand-dim);
  border: 1px solid var(--brand);
  border-radius: var(--radius-pill);
  color: var(--brand);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.btn-use-template:hover {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 2px 8px rgba(184, 114, 63, 0.3);
}

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
  .templates-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .templates-categories { justify-content: flex-start; }
  .templates-grid { grid-template-columns: 1fr; }
}
