/* AdNeed Platform (Site 1) — Card Maker tool styles.
   CP18 follow-up: Card Maker moved off its old hand-coded canvas presets
   onto the same Google-Slides-backed engine Post Maker uses (see
   card-maker.js's own header comment) — this file is now a close port
   of post-maker.css's structure (same "-pm-" shapes, "-cm-" prefix)
   rather than the old canvas-preset-gallery layout it replaces. Two
   views live inside #toolCard: #cmGalleryView (browse designs by
   category, unlock) and #cmEditorView (fill placeholders, preview,
   download) — only one visible at a time, toggled in card-maker.js. */

.auth-card--cm {
  max-width: 980px; text-align: left;
  /* Same reasoning as Post Maker's .auth-card--pm: chrome now lives on
     the individual gallery tiles (.cm-card), not one big card wrapping
     the whole page. */
  background: none; border: none; box-shadow: none; padding: 8px 0 32px;
}
.auth-card--cm .auth-logo { margin: 0 0 16px; }
.auth-card--cm h1 { text-align: left; }
.auth-card--cm > p.sub { text-align: left; }

.cm-title { margin: 0; }
.cm-subtitle { margin: 0 0 18px; }

/* ---------------------------------------------------------------- Title row (title + price tag) */
.cm-header-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 6px;
}
.cm-price-tag {
  font-family:'AdNeedRupee','Sora', sans-serif; font-weight: 700; font-size: 12.5px; color: var(--orange-500);
  background: #FDECE4; border: 1px solid rgba(232,73,29,.25); border-radius: 999px; padding: 6px 12px;
}

/* ---------------------------------------------------------------- Category tabs */
.cm-tabs { display: flex; gap: 7px; flex-wrap: wrap; margin: 0 0 20px; }
.cm-tab {
  font-family:'AdNeedRupee','Manrope', sans-serif; font-size: 12.5px; font-weight: 700;
  color: var(--text-muted); background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 999px; padding: 8px 14px; cursor: pointer; transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.cm-tab:hover { border-color: rgba(232,73,29,.35); }
.cm-tab.active { background: #FDECE4; border-color: var(--orange-500); color: var(--orange-500); }

/* ---------------------------------------------------------------- Gallery grid
   No fixed aspect-ratio on the thumb (unlike the old canvas version) —
   a real Slides design can be landscape (business card) or portrait
   (wedding invite), so the image is left to report its own natural size
   and the tile grows/shrinks around it instead of cropping either
   orientation to fit a box built for the other. */
.cm-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.cm-card {
  border: 1.5px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--surface);
  display: flex; flex-direction: column;
}
.cm-card-thumb {
  min-height: 150px; background: linear-gradient(135deg, #FFF3E8, #FDECE4);
  display: flex; align-items: center; justify-content: center; position: relative;
}
.cm-card-thumb .cm-thumb-icon { font-size: 40px; opacity: .85; }
.cm-card-thumb.has-thumb .cm-thumb-icon, .cm-card-thumb.is-loading .cm-thumb-icon { display: none; }
.cm-card-thumb-img { width: 100%; display: block; }
.cm-thumb-spinner {
  display: none; width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid rgba(232,73,29,.18); border-top-color: var(--orange-500);
  animation: cmThumbSpin .8s linear infinite;
}
.cm-card-thumb.is-loading .cm-thumb-spinner { display: block; }
@keyframes cmThumbSpin { to { transform: rotate(360deg); } }
.cm-card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.cm-card-cat { font-family:'AdNeedRupee','Sora', sans-serif; font-weight: 700; font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--orange-500); }
.cm-card-name { margin: 0; font-family:'AdNeedRupee','Sora', sans-serif; font-size: 15px; font-weight: 800; color: var(--text); }
.cm-card-actions { margin-top: auto; padding-top: 8px; }
.cm-card-actions .btn--unlock { background: var(--grad); color: #fff; }
.cm-card-actions .btn--open { background: var(--surface); color: var(--navy-900); border: 1.5px solid var(--navy-900); }
.cm-card-actions .btn { width: 100%; justify-content: center; font-size: 12.5px; padding: 9px 10px; }
.cm-empty-note { color: var(--text-muted); padding: 24px 0; text-align: center; }

/* ---------------------------------------------------------------- Editor */
.cm-editor-topbar { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; }
.cm-back-link {
  display: inline-flex; align-items: center; gap: 4px; font-family:'AdNeedRupee','Manrope', sans-serif;
  font-weight: 700; font-size: 13px; color: var(--text-muted); background: none; border: none; cursor: pointer; padding: 0;
}
.cm-back-link:hover { color: var(--orange-500); }
.cm-editor-preset-name { margin: 0; font-weight: 700; color: var(--text); }

.cm-editor-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 26px; }
@media (max-width: 760px) { .cm-editor-grid { grid-template-columns: 1fr; } }

.cm-editor-preview-wrap { position: relative; }
.cm-editor-preview-frame {
  border: 1.5px solid var(--border); border-radius: 14px; overflow: hidden; background: #F4F4F6;
  display: flex; align-items: center; justify-content: center; min-height: 260px; position: relative;
}
.cm-editor-preview-frame img { width: 100%; display: block; }
.cm-editor-preview-wrap.is-loading .cm-editor-preview-frame::after {
  content: ""; position: absolute; top:0; right:0; bottom:0; left:0; background: rgba(255,255,255,.55);
}
.cm-preview-spinner {
  display: none; position: absolute; top: 50%; left: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border-radius: 50%; border: 3px solid rgba(0,0,0,.1); border-top-color: var(--orange-500);
  animation: cmThumbSpin .8s linear infinite;
}
.cm-editor-preview-wrap.is-loading .cm-preview-spinner { display: block; }
.cm-preview-empty { color: var(--text-muted); font-size: 13.5px; padding: 20px; text-align: center; }
.cm-editor-download-row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

.cm-editor-fields { display: flex; flex-direction: column; gap: 14px; }
.cm-field { margin-bottom: 0; }
.cm-field textarea, .cm-field input {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--border); font-family:'AdNeedRupee','Manrope', sans-serif; font-size: 14px;
  background: var(--surface); color: var(--text);
}
.cm-field textarea { min-height: 68px; resize: vertical; }
.cm-field textarea:focus, .cm-field input:focus {
  outline: none; border-color: var(--orange-500); box-shadow: 0 0 0 3px rgba(232,73,29,.10);
}
.cm-autofill-note { margin: 0 0 14px; font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.cm-autofill-note a { color: var(--orange-500); font-weight: 700; }
/* .field-label / .tool-note render unstyled without qr-tool.css's
   shared rules (this page doesn't import it, same as before this
   migration) — kept self-contained here rather than adding that
   cross-file dependency, matching post-maker.css's own note. */
.field-label { display: block; font-family:'AdNeedRupee','Sora', sans-serif; font-weight: 700; font-size: 12.5px; color: var(--text); margin: 0 0 5px; }
.tool-note { color: var(--text-muted); font-size: 12.5px; line-height: 1.6; margin: 22px 0 0; }
.cm-unlock-box {
  border: 1.5px dashed rgba(232,73,29,.4); border-radius: 12px; padding: 14px 16px;
  background: #FFF9F4; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.cm-unlock-box p { margin: 0; font-size: 13.5px; color: var(--text-muted); }
