/* =========================================================
   TEMPLATE LIBRARY
   ========================================================= */

.templates-hero { padding-block: var(--space-8) var(--space-6); text-align: center; }
.templates-hero h1 { font-size: var(--fs-h1); margin-bottom: var(--space-3); }
.templates-hero p { color: var(--text-secondary); font-size: var(--fs-body-lg); max-width: 56ch; margin-inline: auto; }

.category-tabs {
  display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: center;
  margin-bottom: var(--space-7);
}
.category-tab {
  padding: 0.5rem 1.1rem; border-radius: var(--radius-full); border: 1.5px solid var(--border-strong);
  background: var(--bg-surface); color: var(--text-secondary); font-size: var(--fs-small); font-weight: 600;
}
.category-tab:hover { border-color: var(--lumara-purple-500); color: var(--lumara-purple-600); }
.category-tab.is-active { background: var(--brand-gradient); color: #fff; border-color: transparent; }

.template-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5);
  padding-bottom: var(--space-9);
}
@media (max-width: 980px) { .template-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) { .template-grid { grid-template-columns: 1fr; } }

.template-card { display: flex; flex-direction: column; }
.template-card-swatch {
  height: 84px; border-radius: var(--radius-md); margin-bottom: var(--space-4);
  display: flex; align-items: center; justify-content: center; gap: 6px; overflow: hidden; position: relative;
}
.template-card-swatch .swatch-dot { width: 34px; height: 34px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(255,255,255,0.5); }
.template-card-category { margin-bottom: var(--space-2); }
.template-card h3 { font-size: 1.05rem; margin-bottom: var(--space-2); }
.template-card p { color: var(--text-secondary); font-size: var(--fs-small); flex: 1; margin-bottom: var(--space-4); }
.template-card-actions { display: flex; gap: var(--space-2); }
.template-card-actions .btn { flex: 1; }

.templates-empty { grid-column: 1 / -1; }

/* Preview modal (wider than the standard modal, to fit a device frame) */
.template-preview-modal { max-width: 760px; width: 100%; }
.template-preview-body {
  max-height: 60vh; overflow-y: auto; padding: var(--space-5);
  background: var(--bg-canvas); border-radius: var(--radius-md); margin-bottom: var(--space-5);
}
.template-preview-meta { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); flex-wrap: wrap; }
.template-preview-desc { color: var(--text-secondary); font-size: var(--fs-small); margin-bottom: var(--space-4); }
