/* ==============================================================================
   TEMPLATE PICKER + TEMPLATE 2 BANNER EDITOR
   Sits inside the "प्रिंट प्रिव्यू" card, above the A4 preview.
   ============================================================================== */

.tpl-picker {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.tpl-picker-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.tpl-picker-title {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
}
.tpl-picker-hint {
  font-size: 11.5px;
  color: #64748b;
  font-weight: 600;
}

.tpl-picker-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.tpl-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 10px 10px;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 11px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
.tpl-card:hover {
  border-color: #93c5fd;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px -6px rgba(15, 23, 42, .18);
}
.tpl-card.is-active {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}
.tpl-card.is-active::after {
  content: "✓";
  position: absolute;
  top: 8px;
  left: 8px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tpl-card-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
}
.tpl-card-badge.new { background: #dcfce7; color: #15803d; }

.tpl-thumb {
  width: 100%;
  max-width: 108px;
  height: auto;
  display: block;
}
.tpl-card-name {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
}
.tpl-card-sub {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-align: center;
  line-height: 1.35;
}

/* ------------------------------ EDITOR ------------------------------ */
.tpl2-editor {
  border: 1.5px solid #fde68a;
  background: #fffdf5;
  border-radius: 12px;
  margin-bottom: 14px;
  overflow: hidden;
}

.tpl2-ed-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 0;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.tpl2-ed-title {
  font-size: 13px;
  font-weight: 800;
  color: #78350f;
}
.tpl2-ed-arrow {
  font-size: 15px;
  color: #92400e;
  transition: transform .2s;
}
.tpl2-editor.collapsed .tpl2-ed-arrow { transform: rotate(-90deg); }
.tpl2-editor.collapsed .tpl2-ed-body { display: none; }

.tpl2-ed-body { padding: 14px; }

.tpl2-help {
  font-size: 11.5px;
  color: #92400e;
  background: #fef9c3;
  border-radius: 7px;
  padding: 7px 10px;
  margin: 0 0 12px;
  font-weight: 600;
}

.tpl2-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin-bottom: 10px; }
.tpl2-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px 12px; margin-bottom: 10px; }

.tpl2-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }

.tpl2-label {
  font-size: 11.5px;
  font-weight: 800;
  color: #334155;
}
.tpl2-sub {
  font-size: 10.5px;
  font-weight: 600;
  color: #475569;
  line-height: 1.45;
}
.tpl2-sub.dim { color: #94a3b8; font-weight: 500; }

.tpl2-input {
  width: 100%;
  padding: 7px 10px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12.5px;
  color: #0f172a;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}
.tpl2-input:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, .15);
}

.tpl2-btn {
  padding: 7px 13px;
  border-radius: 8px;
  border: 0;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: filter .15s, transform .15s;
  white-space: nowrap;
}
.tpl2-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.tpl2-btn.ghost {
  background: #fff;
  color: #475569;
  border: 1.5px solid #e2e8f0;
}
.tpl2-btn.ghost:hover { background: #f8fafc; }

.tpl2-photo-row { display: flex; align-items: flex-start; gap: 10px; }

.tpl2-photo-prev {
  flex: 0 0 auto;
  width: 62px;
  height: 62px;
  border-radius: 9px;
  border: 1.5px dashed #cbd5e1;
  background:
    linear-gradient(45deg, #f1f5f9 25%, transparent 25%, transparent 75%, #f1f5f9 75%) 0 0/12px 12px,
    linear-gradient(45deg, #f1f5f9 25%, #fff 25%, #fff 75%, #f1f5f9 75%) 6px 6px/12px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.tpl2-photo-prev span { font-size: 10px; color: #94a3b8; font-weight: 700; }
.tpl2-photo-prev img { width: 100%; height: 100%; object-fit: contain; }
.tpl2-photo-prev.sym { border-style: solid; border-color: #fcd34d; }

.tpl2-photo-actions { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.tpl2-slider-wrap {
  margin-top: 9px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 9px 10px;
}
.tpl2-slider-wrap input[type="range"] { width: 100%; accent-color: #2563eb; }

.tpl2-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 6px 0 12px;
}
.tpl2-color {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.tpl2-color input[type="color"] {
  width: 44px;
  height: 32px;
  padding: 0;
  border: 1.5px solid #e2e8f0;
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
}
.tpl2-color span { font-size: 10px; font-weight: 700; color: #475569; }

.tpl2-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px dashed #fde68a;
}
.tpl2-saved {
  font-size: 11px;
  font-weight: 700;
  color: #15803d;
  opacity: 0;
  transition: opacity .25s;
}
.tpl2-saved.show { opacity: 1; }

/* -------------------- TEMPLATE 3 EXTRA LINES -------------------- */
.tpl3-only {
  border: 1.5px dashed #c7d2fe;
  background: #f5f7ff;
  border-radius: 10px;
  padding: 11px 12px 4px;
  margin: 4px 0 14px;
}
.tpl3-only-head {
  font-size: 12px;
  font-weight: 800;
  color: #3730a3;
  margin-bottom: 7px;
}
.tpl3-only .tpl2-help {
  background: #e0e7ff;
  color: #3730a3;
}

/* ------------------------------ MOBILE ------------------------------ */
@media (max-width: 900px) {
  .tpl-picker-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .tpl-picker-row { grid-template-columns: 1fr; }
  .tpl2-grid-2, .tpl2-grid-3 { grid-template-columns: 1fr; }
  .tpl2-colors { gap: 9px; }
  .tpl2-color input[type="color"] { width: 40px; height: 30px; }
}
