/* ================= 模板库侧边栏样式 ================= */
.template-sidebar {
  position: fixed;
  top: 68px;
  right: 0;
  width: 320px;
  height: calc(100vh - 68px);
  background: rgba(30, 41, 59, 0.98);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.3);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.template-sidebar.open {
  transform: translateX(0);
}

.template-sidebar-header {
  flex: 0 0 auto;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
}

.template-sidebar-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
}

.template-sidebar-title svg {
  stroke: var(--primary);
  filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.4));
}

.template-sidebar-hint {
  margin: 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.5;
}

.template-sidebar-content {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 20px;
}

.template-sidebar-content::-webkit-scrollbar {
  width: 6px;
}

.template-sidebar-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.template-sidebar-content::-webkit-scrollbar-track {
  background: transparent;
}

.template-category {
  margin-bottom: 24px;
}

.template-category:last-child {
  margin-bottom: 0;
}

.template-category-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}

.template-category-title::before {
  content: '';
  width: 3px;
  height: 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent-2));
  border-radius: 2px;
}

.template-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.template-card {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  cursor: grab;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 6px;
  user-select: none;
}

.template-card:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--primary);
  transform: translateX(-4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.template-card:active {
  cursor: grabbing;
  transform: scale(0.98);
}

.template-card.dragging {
  opacity: 0.5;
  border: 2px dashed var(--primary);
}

.template-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.template-card-title svg {
  width: 16px;
  height: 16px;
  stroke: var(--primary);
  flex-shrink: 0;
}

.template-card-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

body.template-sidebar-open .board {
  padding-right: 340px;
}
