/* ── Template Browser Modal ──────────────────── */
.template-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.template-browser {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  width: 720px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

.template-browser-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.template-browser-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.template-browser-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: none;
  color: var(--panel-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 200ms;
}

.template-browser-close:hover {
  background: rgba(220,38,38,0.15);
  color: #ef4444;
}

.template-categories {
  display: flex;
  gap: 8px;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  overflow-x: auto;
}

.template-cat-btn {
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--panel-text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 200ms;
}

.template-cat-btn:hover {
  border-color: var(--color-brand);
  color: var(--color-brand);
  background: rgba(242,0,0,0.06);
}

.template-cat-btn.active {
  background: var(--color-brand);
  border-color: var(--color-brand);
  color: #fff;
  box-shadow: 0 2px 8px rgba(242,0,0,0.3);
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.template-card {
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 250ms;
  background: rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
}

.template-card:hover {
  border-color: var(--color-brand);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(242,0,0,0.2);
}

.template-card canvas {
  max-width: 100%;
  max-height: 100%;
}

/* ── Shape Library ───────────────────────────── */
.shape-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.shape-item {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 200ms;
  padding: 10px;
}

.shape-item:hover {
  border-color: var(--color-brand);
  background: rgba(242,0,0,0.08);
  transform: scale(1.05);
}

.shape-item svg {
  width: 100%;
  height: 100%;
  color: var(--panel-text-muted);
  transition: color 200ms;
}

.shape-item:hover svg {
  color: var(--color-brand);
}
