/* Campaign Launcher — tool-specific styles layered on /assets/app.css.
   Mobile-first: large touch targets, one-handed phone use. */

.field-group { display: grid; gap: 10px; }
.group-label {
  font-size: 13px; color: var(--text-dim); font-weight: 600;
  letter-spacing: 0.02em;
}
.group-label small { font-weight: 400; color: var(--text-dim); opacity: 0.75; }

/* Mode toggle — two big tappable cards */
.mode-toggle { display: flex; gap: 10px; }
.mode-btn {
  flex: 1; display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 16px; cursor: pointer; text-align: left;
  font: inherit; min-height: 56px; transition: border-color 0.12s, background 0.12s;
}
.mode-btn strong { font-size: 15px; }
.mode-btn small { font-size: 12px; color: var(--text-dim); }
.mode-btn.active { border-color: var(--accent); background: var(--card-hover); }
.mode-btn.active small { color: var(--text); }

/* Read-only objective pill */
.readonly-field { display: grid; gap: 6px; }
.readonly-pill {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; font-weight: 600; color: var(--text);
}
.readonly-pill small { font-weight: 400; color: var(--text-dim); display: block; margin-top: 2px; }

/* Money input with prefix */
.money-input { position: relative; display: flex; align-items: center; }
.money-prefix {
  position: absolute; left: 12px; color: var(--text-dim); pointer-events: none; font-size: 15px;
}
.money-input input { padding-left: 26px; width: 100%; }

/* Ad-set / audience blocks */
.adset-block {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; display: grid; gap: 8px;
}
.adset-head { display: flex; align-items: baseline; gap: 8px; }
.adset-name { font-weight: 600; font-size: 14px; }
.adset-sub { font-size: 12px; color: var(--text-dim); }
.adset-note { font-size: 12px; color: var(--text-dim); margin: 0; }

.aud-checks { display: grid; gap: 8px; }
.aud-check {
  display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text);
  cursor: pointer; padding: 6px 0; min-height: 32px;
}
.aud-check input { width: 20px; height: 20px; flex: none; cursor: pointer; }
.aud-check.unusable { color: var(--text-dim); }
.aud-check .aud-flag {
  font-size: 11px; background: rgba(239,68,68,0.15); color: var(--danger);
  border-radius: 10px; padding: 1px 8px; margin-left: auto;
}
.aud-exclude .aud-check { color: var(--text-dim); }
.aud-exclude::before {
  content: "Excludes:"; font-size: 11px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.06em;
}

/* Action bar — sticky-ish, big buttons */
.action-bar { display: flex; gap: 10px; margin-top: 8px; }
.action-bar button { flex: 1; min-height: 52px; font-size: 16px; }
button.ghost {
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 20px; font-weight: 600; cursor: pointer; font-size: 15px;
}
button.ghost:hover { background: var(--card-hover); border-color: var(--accent); }
button.ghost:disabled { opacity: 0.5; cursor: not-allowed; }
.safety-line { font-size: 12px; color: var(--text-dim); margin: 4px 0 0; line-height: 1.5; }

/* Preview tree — campaign -> ad sets -> ads */
.plan-tree { display: grid; gap: 10px; margin-top: 14px; }
.plan-node {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
}
.plan-node.campaign { border-color: var(--accent); }
.plan-node .node-title { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plan-node .node-meta { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.plan-children { display: grid; gap: 8px; margin: 10px 0 0 14px; padding-left: 12px; border-left: 2px solid var(--border); }
.plan-leaf {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
}
.plan-leaf .leaf-title { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.plan-leaf .leaf-meta { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.badge {
  font-size: 11px; border-radius: 10px; padding: 1px 8px; font-weight: 600; white-space: nowrap;
}
.badge.ok { background: rgba(16,185,129,0.15); color: var(--success); }
.badge.skip { background: rgba(148,163,184,0.18); color: var(--text-dim); }
.badge.err { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge.paused { background: rgba(228,255,26,0.12); color: var(--accent); }

.paused-banner {
  background: rgba(228,255,26,0.10); border: 1px solid var(--accent); color: var(--accent);
  border-radius: 12px; padding: 12px 14px; font-size: 13px; font-weight: 600; margin-top: 14px;
}

.aud-report { display: grid; gap: 6px; margin-top: 12px; }
.aud-report .ar-row {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px;
}
.aud-report .ar-role { color: var(--text-dim); font-size: 12px; min-width: 72px; }
.aud-report .ar-name { flex: 1; }

.deep-link-box {
  display: block; text-align: center; background: var(--accent); color: var(--accent-text);
  border-radius: 14px; padding: 14px 20px; font-weight: 700; text-decoration: none; margin-top: 14px;
  min-height: 52px;
}
.deep-link-box:hover { transform: translateY(-1px); }

/* Confirm dialog reuses .modal-* from app.css */
.confirm-list { list-style: none; padding: 0; margin: 8px 0; font-size: 14px; display: grid; gap: 6px; }
.confirm-list li { display: flex; gap: 8px; }
.confirm-list .ck { color: var(--success); }

/* ===================== WIZARD (Setup -> Generate -> Pick -> Preview -> Launch) ===================== */

/* Step rail */
.step-rail {
  list-style: none; display: flex; gap: 4px; padding: 0; margin: 0 0 24px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.step-rail li {
  flex: 1 0 auto; display: flex; align-items: center; gap: 8px;
  color: var(--text-dim); font-size: 13px; font-weight: 600; white-space: nowrap;
  padding: 6px 10px; border-radius: 10px; min-width: 0;
}
.step-rail li .dot {
  width: 24px; height: 24px; flex: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--border); font-size: 12px; font-weight: 700;
}
.step-rail li.active { color: var(--text); }
.step-rail li.active .dot { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.step-rail li.done .dot { background: var(--success); color: #052e22; border-color: var(--success); }
.step-rail li.done { color: var(--text); }

/* Step panels */
.wizard-step { display: grid; gap: 18px; }
.wizard-step[hidden] { display: none; }
.step-intro { font-size: 13px; color: var(--text-dim); margin: 0; line-height: 1.55; }
.step-intro code { background: var(--card); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-size: 12px; }

.wizard-nav { display: flex; gap: 10px; margin-top: 4px; }
.wizard-nav button { flex: 1; min-height: 52px; font-size: 16px; }
.wizard-nav .ghost { flex: 0 0 auto; min-width: 96px; }

.opt-sub { display: block; font-weight: 400; color: var(--text-dim); font-size: 11px; margin-top: 2px; }
.aud-check small.opt-sub { margin-left: 30px; }

/* ===================== PICK STEP ===================== */
.pick-block {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px; display: grid; gap: 10px;
}
.pick-h { font-size: 15px; margin: 0; text-transform: none; letter-spacing: 0; color: var(--text); display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pick-h small { font-size: 12px; font-weight: 500; color: var(--text-dim); }
.pick-desc { font-size: 12px; color: var(--text-dim); margin: 0; }
.pick-empty { font-size: 13px; color: var(--text-dim); margin: 0; }

.lp-input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px;
  font: inherit; font-size: 14px; color: var(--text); background: var(--bg);
}
.lp-input:focus { outline: none; border-color: var(--accent); }
.lp-full { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--text-dim); word-break: break-all; line-height: 1.5; }
.lp-full .ok { color: var(--success); font-weight: 700; }
.lp-full .miss { color: var(--danger); font-weight: 700; }

/* Ratio toggle (image gallery) */
.ratio-toggle {
  display: inline-flex; gap: 4px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px; width: fit-content;
}
.ratio-toggle button {
  border: none; background: transparent; padding: 6px 14px; border-radius: 999px;
  font: inherit; font-size: 12px; font-weight: 700; color: var(--text-dim); cursor: pointer;
}
.ratio-toggle button.active { background: var(--accent); color: var(--accent-text); }

/* Image grid + cards */
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.img-card {
  background: var(--bg); border: 2px solid var(--border); border-radius: 12px;
  padding: 8px; cursor: pointer; transition: border-color 0.12s, background 0.12s;
}
.img-card:hover { border-color: var(--accent); }
.img-card.selected { border-color: var(--accent); background: var(--card-hover); box-shadow: 0 0 0 1px var(--accent); }
.img-card img { width: 100%; display: block; border-radius: 8px; background: #2a2b30; }
.img-meta { font-size: 11px; color: var(--text-dim); margin-top: 6px; display: flex; justify-content: space-between; gap: 6px; text-transform: capitalize; }
.img-meta .type-tag { color: var(--accent); font-weight: 700; }

/* Copy cards (primary text + headlines) */
.copy-card {
  background: var(--bg); border: 2px solid var(--border); border-radius: 12px;
  padding: 14px 44px 14px 16px; cursor: pointer; position: relative;
  transition: border-color 0.12s, background 0.12s; margin-bottom: 0;
}
#primary-list, #headline-list { display: grid; gap: 10px; }
.copy-card:hover { border-color: var(--accent); }
.copy-card.selected { border-color: var(--accent); background: var(--card-hover); }
.copy-card.static { cursor: default; border-color: var(--accent); background: var(--card-hover); padding: 14px 16px; }
.copy-card .check {
  position: absolute; top: 12px; right: 12px; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--border); background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; color: transparent;
}
.copy-card.selected .check { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.copy-card .text { font-size: 14px; line-height: 1.5; color: var(--text); white-space: pre-wrap; }
.copy-card.headline .text { font-weight: 700; font-size: 15px; }

/* CTA grid */
.cta-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.cta-opt {
  background: var(--bg); border: 2px solid var(--border); border-radius: 12px;
  padding: 12px 10px; text-align: center; font-size: 13px; font-weight: 700; cursor: pointer; color: var(--text);
}
.cta-opt.selected { border-color: var(--accent); background: var(--card-hover); color: var(--text); }
.cta-opt small { display: block; font-weight: 500; color: var(--text-dim); margin-top: 4px; font-size: 11px; }

/* UTM block */
.utm-block {
  background: var(--bg); border: 1px solid var(--border); color: var(--text-dim); border-radius: 12px;
  padding: 12px 14px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; word-break: break-all; line-height: 1.5;
}

/* Pick status (gate readout) */
.pick-status { font-size: 13px; color: var(--text-dim); line-height: 1.4; text-align: center; }
.pick-status .ok { color: var(--success); font-weight: 700; }
.pick-status .miss { color: var(--danger); font-weight: 700; }

/* Generate progress images */
.gen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px,1fr)); gap: 8px; margin-top: 10px; }
.gen-grid img { width: 100%; border-radius: 8px; border: 1px solid var(--border); }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.88);
  display: none; align-items: center; justify-content: center; padding: 24px; z-index: 200; cursor: zoom-out;
}
.lightbox.active { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }

/* Stack rows on narrow phones */
@media (max-width: 520px) {
  .mode-toggle { flex-direction: column; }
  .row { flex-direction: column; }
  .action-bar { flex-direction: column-reverse; }
  .step-rail li .lbl { display: none; }
  .step-rail li.active .lbl { display: inline; }
  .cta-grid { grid-template-columns: 1fr; }
}

/* ===== Step 4 visual ad preview (Facebook / Instagram feed ad cards) =====
   Rendered light/white on purpose — this is what the ad looks like in the
   real feed, so it should read as the actual creative, not a dark UI panel. */
.ad-preview-section { margin: 4px 0 18px; }
.ad-preview-label { font-size: 13px; color: var(--text-dim); margin-bottom: 12px; line-height: 1.4; }
.ad-preview-empty { font-size: 13px; color: var(--text-dim); padding: 14px; border: 1px dashed var(--border); border-radius: 12px; }
.ad-preview-more { font-size: 12px; color: var(--text-dim); margin-top: 10px; }
.ad-preview-wrap { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 680px) { .ad-preview-wrap { grid-template-columns: 1fr 1fr; } }

.ad-card {
  background: #fff; color: #1c1e21; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border);
  font-family: Helvetica, Arial, "Segoe UI", system-ui, sans-serif;
  max-width: 460px; width: 100%;
}
.ad-card-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; }
.ad-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto;
  background: #262262; color: #fff; font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.ad-card-id { min-width: 0; }
.ad-page { font-weight: 600; font-size: 14px; color: #050505; line-height: 1.2; }
.ad-sponsored { font-size: 12px; color: #65676b; line-height: 1.3; }
.ad-primary { padding: 0 12px 10px; font-size: 14px; color: #050505; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.ad-img { width: 100%; display: block; aspect-ratio: 1 / 1; object-fit: cover; background: #e4e6eb; }
.ad-footer { display: flex; align-items: center; gap: 10px; background: #f0f2f5; padding: 10px 12px; }
.ad-footer-txt { flex: 1 1 auto; min-width: 0; }
.ad-domain { font-size: 12px; color: #65676b; letter-spacing: .2px; }
.ad-headline { font-size: 15px; font-weight: 700; color: #1c1e21; line-height: 1.25; }
.ad-cta {
  flex: 0 0 auto; background: #e4e6eb; color: #1c1e21; border: none;
  border-radius: 6px; padding: 9px 14px; font-weight: 600; font-size: 13px;
  white-space: nowrap; cursor: default;
}
