/* Lightweight styles for template builder/editor pages (no external CSS needed) */
:root {
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --blue-50: #eff6ff;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --emerald-50: #ecfdf3;
  --emerald-700: #047857;
  --white: #ffffff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Inter", "Poppins", system-ui, -apple-system, sans-serif;
  background: var(--slate-50);
  color: var(--slate-900);
  min-height: 100vh;
}

/* Layout helpers */
.max-w-6xl { max-width: 1200px; width: 100%; }
.max-w-3xl { max-width: 960px; width: 100%; }
.mx-auto { margin-left: auto; margin-right: auto; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-10 { padding-top: 2.5rem; padding-bottom: 2.5rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-8 > * + * { margin-top: 2rem; }
.space-y-10 > * + * { margin-top: 2.5rem; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.place-items-center { place-items: center; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1 1 0%; }

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.md\\:grid-cols-2 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.lg\\:grid-cols-3 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.lg\\:grid-cols-2 { grid-template-columns: repeat(1, minmax(0, 1fr)); }

@media (min-width: 768px) {
  .md\\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .lg\\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Colors & text */
.bg-slate-50 { background: var(--slate-50); }
.bg-white { background: var(--white); }
.bg-white { background: rgba(255, 255, 255, 0.9); }
.bg-blue-50 { background: var(--blue-50); }
.bg-blue-600 { background: var(--blue-600); color: var(--white); }
.bg-emerald-50 { background: var(--emerald-50); }
.bg-slate-900 { background: var(--slate-900); color: var(--white); }
.text-white { color: var(--white); }
.text-slate-900 { color: var(--slate-900); }
.text-slate-700 { color: var(--slate-700); }
.text-slate-600 { color: var(--slate-600); }
.text-slate-500 { color: var(--slate-500); }
.text-blue-700 { color: var(--blue-700); }
.text-emerald-700 { color: var(--emerald-700); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.text-xs { font-size: 12px; }
.text-sm { font-size: 14px; }
.text-lg { font-size: 18px; }
.text-2xl { font-size: 24px; }
.text-3xl { font-size: 28px; }
.text-4xl { font-size: 32px; }
.md\\:text-4xl { font-size: 32px; }
@media (min-width: 768px) {
  .md\\:text-4xl { font-size: 36px; }
}
.uppercase { text-transform: uppercase; }
.tracking-tight { letter-spacing: -0.01em; }
.tracking { letter-spacing: 0.2em; }
.leading-tight { line-height: 1.1; }
.text-center { text-align: center; }

/* Borders & radius */
.border { border: 1px solid var(--slate-200); }
.border-b { border-bottom: 1px solid var(--slate-200); }
.border-slate-200 { border-color: var(--slate-200); }
.rounded-lg { border-radius: 12px; }
.rounded-xl { border-radius: 16px; }
.rounded-2xl { border-radius: 18px; }
.rounded-full { border-radius: 999px; }
.overflow-hidden { overflow: hidden; }
.shadow-sm { box-shadow: 0 6px 18px rgba(15, 23, 42, 0.1); }
.rounded-xl { border-radius: 16px; }

/* Positioning */
.sticky { position: sticky; }
.top-0 { top: 0; }
.z-10 { z-index: 10; }
.min-h-screen { min-height: 100vh; }
.w-full { width: 100%; }
.w-9 { width: 2.25rem; }
.h-10 { height: 2.5rem; }
.h-9 { height: 2.25rem; }
.mt-auto { margin-top: auto; }

/* Padding/Margin helpers */
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-5 { padding-top: 1.25rem; padding-bottom: 1.25rem; }
.py-10 { padding-top: 2.5rem; padding-bottom: 2.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-10 { margin-top: 2.5rem; }

/* Effects */
.backdrop-blur { backdrop-filter: blur(8px); }
.hover\\:text-blue-600:hover { color: var(--blue-600); }
.hover\\:bg-slate-800:hover { background: #1f2937; }
.hover\\:bg-slate-500:hover { background: #64748b; }
.hover\\:bg-blue-500:hover { background: #3b82f6; }
.hover\\:border-slate-300:hover { border-color: #cbd5e1; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary { background: var(--blue-600); color: var(--white); }
.btn-dark { background: var(--slate-900); color: var(--white); }

/* Forms */
input, textarea, select {
  font: inherit;
  color: inherit;
}
.text-area, textarea { resize: vertical; }
.field {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  background: var(--white);
}
.field:focus { outline: 2px solid var(--blue-600); outline-offset: 1px; }
.focus\\:ring-2:focus { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35); }
.focus\\:ring-blue-500:focus { box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35); }
.focus\\:border-blue-500:focus { border-color: #3b82f6; }

/* Cards & gallery */
#templateGallery {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 24px;
}
@media (min-width: 768px) {
  #templateGallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  #templateGallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

#templateGallery article {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 260px;
}

#templateGallery article .card-cover {
  height: 140px;
  background: linear-gradient(135deg, var(--blue-600), #fff 120%);
}

#templateGallery article .card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 0%;
}

#templateGallery article button {
  margin-top: auto;
  border: none;
  background: var(--slate-900);
  color: var(--white);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
}

/* Editor preview */
#preview {
  border: 1px solid var(--slate-200);
  border-radius: 18px;
  padding: 20px;
  background: var(--white);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}
#preview h4 { margin: 0; }
#preview ul { margin: 6px 0 0; padding-left: 18px; }
#preview li { margin-bottom: 4px; }
.list-disc { list-style-type: disc; }
.list-inside { list-style-position: inside; }
.min-h { min-height: 18px; }
