/* 사진 편집기 — 캔바식 템플릿 갤러리 (T1+T2 2026-06-06)
   라이트 톤 · 보라 accent · 둥근 카드 · 2열 썸네일. 스코프: .pe-tplg */

.pe-tplg {
  padding: 4px 2px 16px;
  color: #111827;
  -webkit-tap-highlight-color: transparent;
}

/* 검색 */
.pe-tplg-search {
  height: 48px;
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid #e8eaf0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}
.pe-tplg-search-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
}
.pe-tplg-search input {
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  min-width: 0;
}
.pe-tplg-search input::placeholder { color: #9ca3af; }
.pe-tplg-search input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* 칩 */
.pe-tplg-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0 14px;
  scrollbar-width: none;
}
.pe-tplg-chips::-webkit-scrollbar { display: none; }
.pe-tplg-chip {
  flex: 0 0 auto;
  height: 38px;
  padding: 0 15px;
  border-radius: 14px;
  border: 0;
  background: #f5f0ee;
  color: #374151;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.04em;
  cursor: pointer;
  transition: background .14s ease, color .14s ease, box-shadow .14s ease;
}
.pe-tplg-chip.is-active {
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #8b5cf6);
  box-shadow: 0 8px 18px rgba(124, 58, 237, 0.22);
}

/* 선택 프리뷰 */
.pe-tplg-preview:empty { display: none; }
.pe-tplg-preview-inner {
  margin: 2px 0 14px;
  padding: 12px;
  border: 1px solid #ece8f7;
  border-radius: 18px;
  background: linear-gradient(180deg, #faf8ff, #fff);
  box-shadow: 0 12px 30px rgba(124, 58, 237, 0.08);
}
.pe-tplg-preview-canvas {
  width: 100%;
  max-height: 360px;
  border-radius: 14px;
  background-color: #f3f4f6;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.1);
}
.pe-tplg-preview-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 11px 2px 0;
  font-size: 14px;
  font-weight: 800;
  color: #111827;
}
.pe-tplg-selected-actions {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 10px;
  margin-top: 11px;
}
.pe-tplg-primary {
  height: 48px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, #7c3aed, #8b5cf6);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.pe-tplg-secondary {
  height: 48px;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  background: #fff;
  color: #111827;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
}
/* [기본] purpose 별 기본 템플릿 지정/해제 토글 (잇비 자동적용 우선) */
.pe-tplg-default-toggle {
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid #e3d3a6;
  border-radius: 14px;
  background: #fffdf6;
  color: #7a5a16;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.02em;
  cursor: pointer;
}
.pe-tplg-default-toggle svg { color: #c9a24b; }
.pe-tplg-default-toggle.on {
  border-color: transparent;
  background: linear-gradient(135deg, #e7ce8c, #c9a24b);
  color: #1b140a;
}
.pe-tplg-default-toggle.on svg { color: #1b140a; }
/* [기본] 카드 썸네일 "기본" 배지 */
.pe-tplg-default-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #e7ce8c, #c9a24b);
  color: #1b140a;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: -0.02em;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

/* 그리드 */
.pe-tplg-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding-bottom: 12px;
}
.pe-tplg-card {
  min-width: 0;
  padding: 0;
  border: 1px solid #e8eaf0;
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
  text-align: left;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .14s ease, border-color .14s ease;
}
.pe-tplg-card:active { transform: scale(0.985); }
.pe-tplg-card.is-selected {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.22), 0 12px 32px rgba(15, 23, 42, 0.08);
}
.pe-tplg-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  background-color: #f3f4f6;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}
.pe-tplg-badge {
  position: absolute;
  right: 8px;
  top: 8px;
  min-height: 23px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #374151;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: -0.03em;
  backdrop-filter: blur(8px);
}
.pe-tplg-pro {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #1a160f;
  background: linear-gradient(135deg, #e7c878, #caa15a);
}
.pe-tplg-thumb .pe-tplg-pro { position: absolute; left: 8px; top: 8px; }
.pe-tplg-bmk {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 0;
  background: rgba(17, 24, 39, 0.55);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.pe-tplg-bmk.on {
  background: #8b5cf6;
}
.pe-tplg-bmk.on svg { fill: #fff; }
.pe-tplg-card-title {
  padding: 10px 10px 2px;
  font-size: 13px;
  font-weight: 800;
  color: #111827;
  letter-spacing: -0.04em;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.pe-tplg-card-sub {
  padding: 0 10px 11px;
  font-size: 11.5px;
  font-weight: 600;
  color: #6b7280;
  line-height: 1.25;
}

/* 빈 상태 */
.pe-tplg-empty {
  grid-column: 1 / -1;
  padding: 36px 16px;
  text-align: center;
}
.pe-tplg-empty strong {
  display: block;
  font-size: 14px;
  font-weight: 800;
  color: #374151;
}
.pe-tplg-empty p {
  margin: 7px 0 0;
  font-size: 12.5px;
  color: #9ca3af;
  line-height: 1.5;
}

@media (width <= 430px) {
  .pe-tplg-grid { gap: 10px; }
  .pe-tplg-card-title { font-size: 12.5px; }
  .pe-tplg-chip { height: 36px; padding: 0 13px; font-size: 12.5px; }
}
