/* AdNeed Platform (Site 1) — Design Templates tool
   Mirrors post-maker.css's structure/naming (pm- -> dt-) for consistency. */

.dt-title { margin: 0; }
.dt-subtitle { margin: 0 0 18px; }
.dt-header-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }

.dt-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; list-style: none; margin: 0; padding: 0; }
.dt-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden; display: flex; flex-direction: column;
}
.dt-card-thumb {
  /* position:relative anchors the price badge; 4/5 + contain shows the WHOLE
     design centred instead of cropping its edges (object-fit:cover used to
     cut text like "Proprietor" off the sides of wide/tall designs). */
  position: relative; aspect-ratio: 4 / 5; background: #f3f4f7; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.dt-price-badge {
  position: absolute; top: 8px; right: 8px; z-index: 2; max-width: calc(100% - 16px);
  padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 800; line-height: 1.2;
  background: var(--grad, linear-gradient(135deg,#F5A623,#E8491D)); color: #fff; white-space: nowrap;
  box-shadow: 0 2px 6px rgba(15,27,46,.25);
}
.dt-price-badge.is-free { background: #1F9D55; }
.dt-price-badge--owned { background: var(--navy-700, #1B2C45); }
.dt-thumb-icon { font-size: 40px; opacity: .85; }
.dt-card-thumb-img { width: 100%; height: 100%; object-fit: contain; object-position: center; display: block; }
.dt-card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.dt-card-name { margin: 0; font-family:'AdNeedRupee','Sora', sans-serif; font-size: 15px; font-weight: 800; color: var(--text); }
.dt-card-open { width: 100%; justify-content: center; font-size: 12.5px; padding: 9px 10px; }
.dt-card-actions-row { display: flex; gap: 8px; }
.dt-card-actions-row .btn { flex: 1; justify-content: center; font-size: 12.5px; padding: 9px 10px; }
.dt-mydesign-delete {
  border: 1.5px solid var(--border); background: transparent; border-radius: 8px; width: 36px;
  color: var(--text-muted); cursor: pointer;
}
.dt-mydesign-delete:hover { border-color: var(--danger, #E5533D); color: var(--danger, #E5533D); }
.dt-empty-note { color: var(--text-muted); padding: 24px 0; grid-column: 1 / -1; }
.dt-my-designs { margin-top: 28px; }

.dt-editor-topbar { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; }
.dt-back-link {
  display: flex; align-items: center; gap: 4px; background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-weight: 700; font-size: 13px; padding: 0;
}
.dt-back-link:hover { color: var(--orange-500); }
.dt-editor-template-name { margin: 0; font-weight: 700; color: var(--text); }

.dt-tabs { display: flex; gap: 7px; flex-wrap: wrap; margin: 0 0 20px; }
.dt-tab {
  border: 1.5px solid var(--border); background: var(--surface); border-radius: 20px;
  padding: 6px 14px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--text-muted);
}
.dt-tab.active { background: #FDECE4; border-color: var(--orange-500); color: var(--orange-500); }

.dt-editor-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 26px; }
.dt-editor-preview-wrap { position: relative; background: var(--bg); border-radius: 14px; border: 1px solid var(--border); padding: 12px; }
.dt-preview-canvas { width: 100%; height: auto; display: block; border-radius: 8px; }
.dt-editor-preview-wrap.is-loading .dt-preview-spinner {
  display: block; position: absolute; top:0; right:0; bottom:0; left:0; margin: auto; width: 28px; height: 28px;
  border: 3px solid rgba(15,27,46,.15); border-top-color: var(--orange-500); border-radius: 50%;
  animation: dt-spin .8s linear infinite;
}
.dt-preview-spinner { display: none; }
@keyframes dt-spin { to { transform: rotate(360deg); } }

.dt-editor-action-bar { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.dt-editor-action-bar .btn { flex: 1; justify-content: center; }

.dt-editor-fields { display: flex; flex-direction: column; gap: 14px; }
.dt-autofill-note { margin: 0 0 14px; font-size: 12px; color: var(--text-muted); line-height: 1.5; }

.dt-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text); }
.dt-field input[type="text"] {
  border: 1.5px solid var(--border); border-radius: 8px; padding: 9px 11px; font-size: 14px; font-family: inherit;
}
.dt-field--image { gap: 8px; }
.dt-field-image-preview { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

@media (max-width: 780px) {
  .dt-editor-grid { grid-template-columns: 1fr; }
}


/* ================================================================
   Redesign — wide catalog layout, category chips, unlock sheet
   ================================================================ */
.dt-wrap { align-items: flex-start; min-height: 0; padding-top: 8px; }
.dt-wrap > .auth-card { margin: 40px auto; }
.dt-page { width: 100%; max-width: 1080px; margin: 0 auto; }

.dt-header-row { padding: 6px 2px 0; }
.dt-title { font-size: 26px; text-align: left; }
.dt-subtitle { text-align: left; margin: 6px 0 16px; font-size: 14px; max-width: 620px; }
.auth-card p.sub.dt-subtitle { text-align: left; margin: 6px 0 16px; }

.dt-toolbar {
  position: sticky; top: 47px; z-index: 20; background: var(--bg);
  padding: 8px 0 10px; margin: 0 0 12px; display: flex; flex-direction: column; gap: 10px;
}
.dt-search {
  display: flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1.5px solid var(--border); border-radius: 12px; padding: 0 12px; height: 44px; color: var(--text-muted);
}
.dt-search:focus-within { border-color: var(--orange-500); }
.dt-search svg { width: 18px; height: 18px; flex-shrink: 0; }
.dt-search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; font: inherit; font-size: 14.5px; color: var(--text); }

.dt-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 1px 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.dt-chips::-webkit-scrollbar { display: none; }
.dt-chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 8px 14px; font: 600 13px 'AdNeedRupee','Manrope',sans-serif; cursor: pointer;
}
.dt-chip small { font-size: 11px; font-weight: 700; color: var(--text-muted); background: #F1F2F5; border-radius: 999px; padding: 1px 7px; }
.dt-chip.active { background: var(--navy-900, #0F1B2E); border-color: var(--navy-900, #0F1B2E); color: #fff; }
.dt-chip.active small { background: rgba(255,255,255,.18); color: #fff; }

.dt-pills-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dt-pills { display: inline-flex; background: #ECEEF2; border-radius: 10px; padding: 3px; }
.dt-pill { border: 0; background: transparent; padding: 6px 11px; border-radius: 8px; font: 700 12.5px 'AdNeedRupee','Manrope',sans-serif; color: var(--text-muted); cursor: pointer; }
.dt-pill.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(15,27,46,.15); }
.dt-result-count { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }

.dt-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .dt-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 960px) { .dt-gallery { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.dt-gallery--small { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

.dt-card { box-shadow: 0 1px 2px rgba(15,27,46,.05); transition: transform .15s, box-shadow .15s; }
.dt-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(15,27,46,.10); }
.dt-card-thumb { cursor: pointer; }
.dt-card-thumb.is-locked::after {
  content: "🔒"; position: absolute; left: 8px; bottom: 8px; width: 28px; height: 28px; border-radius: 50%;
  background: rgba(15,27,46,.72); display: grid; place-items: center; font-size: 13px; z-index: 2;
}
.dt-card-cat { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.dt-card-body { gap: 4px; padding: 10px 12px 12px; }
.dt-card-name { font-size: 14px; line-height: 1.3; margin-bottom: 6px; }
.dt-card-btn { width: 100%; justify-content: center; font-size: 12.5px; padding: 9px 8px; margin-top: auto; }
.dt-link-btn { background: none; border: 0; color: var(--orange-500); font-weight: 700; cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }

.dt-poster-stage { background: #f3f4f7; border: 1px solid var(--border); border-radius: 14px; padding: 12px; display: flex; justify-content: center; }
.dt-poster-stage img { max-width: 100%; max-height: 70vh; object-fit: contain; border-radius: 8px; }
.dt-poster-download { width: 100%; max-width: 420px; display: flex; justify-content: center; margin: 14px auto 0; }

/* Unlock sheet */
.dt-modal { position: fixed; inset: 0; z-index: 100; background: rgba(15,27,46,.55); display: none; align-items: flex-end; justify-content: center; }
.dt-modal.open { display: flex; }
body.dt-modal-open { overflow: hidden; }
.dt-modal-sheet {
  position: relative; background: var(--surface); width: 100%; max-width: 440px; max-height: 92dvh; overflow-y: auto;
  border-radius: 22px 22px 0 0; padding: 16px 18px calc(18px + env(safe-area-inset-bottom)); animation: dt-up .22s ease-out;
}
@media (min-width: 640px) { .dt-modal { align-items: center; } .dt-modal-sheet { border-radius: 22px; } }
@keyframes dt-up { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.dt-modal-x { position: absolute; top: 10px; right: 10px; z-index: 3; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(15,27,46,.7); color: #fff; cursor: pointer; }
.dt-modal-preview { background: #f3f4f7; border-radius: 14px; display: flex; justify-content: center; max-height: 42dvh; overflow: hidden; }
.dt-modal-preview img { max-height: 42dvh; max-width: 100%; object-fit: contain; }
.dt-modal-info { padding-top: 12px; }
.dt-modal-info h2 { font-size: 19px; margin: 2px 0 4px; }
.dt-modal-line { margin: 0 0 12px; font-size: 13px; color: var(--text-muted); }
.dt-modal-rows { background: #F6F7F9; border-radius: 12px; padding: 4px 14px; margin-bottom: 12px; }
.dt-modal-rows div { display: flex; justify-content: space-between; padding: 9px 0; font-size: 14px; }
.dt-modal-rows div + div { border-top: 1px solid var(--border); }
.dt-modal-rows span { color: var(--text-muted); }
.dt-modal-msg { margin: 0 0 10px; font-size: 13px; min-height: 0; }
.dt-modal-msg:empty { display: none; }
.dt-modal-msg.is-error { color: var(--error, #C0392B); background: #FDECEC; border: 1px solid #F5C6C6; border-radius: 10px; padding: 9px 12px; }
.dt-modal-btn { width: 100%; justify-content: center; text-decoration: none; }

.dt-toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--navy-900, #0F1B2E); color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 13.5px; z-index: 120; max-width: 90vw; transition: .25s;
}
.dt-toast.show { opacity: 1; transform: translate(-50%, 0); }


/* ---- Text field controls: colour swatch + text + font -------------------
   The colour control is the browser's native <input type="color">. Nothing
   styled it here (only the admin editor had a rule), so it showed as the
   OS default boxy swatch and — because .dt-field-text-row had no CSS —
   stacked ABOVE the text box. Now: a round swatch inline, left of the text. */
.dt-field-text-row { display: flex; align-items: center; gap: 10px; }
.dt-field-text-row .dt-field-text { flex: 1; min-width: 0; }
.dt-color {
  position: relative; flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--border), 0 1px 4px rgba(15,27,46,.18);
  overflow: hidden; cursor: pointer; transition: box-shadow .15s;
}
.dt-color:hover, .dt-color:focus-within { box-shadow: 0 0 0 2px var(--orange-500), 0 1px 4px rgba(15,27,46,.18); }
.dt-color input[type="color"] {
  position: absolute; inset: -8px; width: calc(100% + 16px); height: calc(100% + 16px);
  border: 0; padding: 0; background: none; cursor: pointer;
}
.dt-color input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.dt-color input[type="color"]::-webkit-color-swatch { border: 0; }
.dt-color input[type="color"]::-moz-color-swatch { border: 0; }

.dt-field-font {
  width: 100%; height: 38px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--surface);
  padding: 0 10px; font-size: 14px; color: var(--text); cursor: pointer;
}
.dt-field-font:focus, .dt-field input[type="text"]:focus { outline: 0; border-color: var(--orange-500); }
.dt-editor-fields { gap: 18px; }
.dt-field--text > span { font-size: 13px; }

/* Background overlay colour uses the same native control — keep it tidy */
.dt-field-overlay-color { width: 42px; height: 42px; padding: 0; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--border); background: none; cursor: pointer; }
