/* ============================================
   GOOGLE ADS SETUP / ONBOARDING (/app/google-ads/{account-id}/setup/)
   ============================================ */

#setup-page {
  min-height: 60vh;
  background: var(--color-bg);
}

/* .app-breadcrumb itself is defined globally in style.css (shared,
   identical markup/classes with the other Google Ads pages). */

/* ---- Centered content column ---- */

.setup-content {
  max-width: 600px;
  margin-inline: auto;
  padding-block: var(--space-10) var(--space-20);
}

/* ---- Card shell shared by the step panels and the loading/processing
   states (.setup-card is combined with .setup-step or .app-loading) ---- */

.setup-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-primary);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  padding: var(--space-8);
}

.setup-card h2 {
  font-size: var(--text-2xl);
  color: var(--color-dark);
  margin-bottom: var(--space-2);
}

.setup-card > p.text-muted {
  font-size: var(--text-sm);
  margin-bottom: var(--space-6);
}

/* ---- Loading / processing states ---- */
/* JS toggles visibility on #setup-loading / #setup-processing via the
   `hidden` DOM property (element.hidden = true/false), which just sets the
   HTML `hidden` attribute. Without the [hidden] rule below, `display: flex`
   on .app-loading -- an author-stylesheet rule -- would override the
   browser's built-in `[hidden] { display: none }` default (author styles
   always win over user-agent defaults, regardless of selector specificity),
   so the element would never actually disappear. */

.app-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  min-height: 240px;
  text-align: center;
}

.app-loading[hidden] {
  display: none;
}

.setup-loading-text {
  color: var(--color-text-muted);
  font-size: var(--text-base);
}

.setup-loading-subtitle {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  transition: opacity 0.3s ease;
  min-height: 1.4em;
}

/* ---- Error state ---- */

.app-error-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.setup-error-content {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.setup-error-content svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.app-retry-btn {
  background: transparent;
  color: var(--color-danger);
  border: none;
  padding: var(--space-2) var(--space-1);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  white-space: nowrap;
  transition: color var(--transition-fast);
}

.app-retry-btn:hover {
  text-decoration: underline;
}

/* ---- Re-analyze button (settings mode only) ---- */

#reanalyze-container {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.btn-reanalyze {
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 6px;
  transition: color 0.15s ease, background-color 0.15s ease;
  font-family: inherit;
}

.btn-reanalyze:hover {
  color: var(--color-primary);
  background-color: var(--color-primary-light, #EBF2FF);
}

/* ---- Step indicator: circle + line stepper ---- */

.setup-stepper {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-6);
  margin-bottom: var(--space-8);
}

.setup-stepper__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.setup-stepper__circle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-border);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.setup-stepper__step.active .setup-stepper__circle {
  background: var(--color-primary);
  color: var(--color-surface);
}

.setup-stepper__step.completed .setup-stepper__circle {
  background: var(--color-primary);
  color: transparent;
}

.setup-stepper__step.completed .setup-stepper__circle::after {
  content: '\2713';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-surface);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
}

.setup-stepper__label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

.setup-stepper__step.active .setup-stepper__label {
  color: var(--color-primary);
  font-weight: var(--weight-semibold);
}

/* A completed step (Business Context, once the user is on Campaign Review)
   is clickable to jump back to it -- see the click/keydown handler in
   page-gads-setup.js. The active step is never clickable (there's nowhere
   to jump forward to without going through Continue's validation), so it
   gets no pointer cursor or hover treatment. */
.setup-stepper__step.completed {
  cursor: pointer;
}

.setup-stepper__step.completed:hover .setup-stepper__circle,
.setup-stepper__step.completed:focus-visible .setup-stepper__circle {
  background: var(--color-primary-hover);
}

.setup-stepper__step.completed:hover .setup-stepper__label,
.setup-stepper__step.completed:focus-visible .setup-stepper__label {
  color: var(--color-primary);
  text-decoration: underline;
}

.setup-stepper__step.completed:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

.setup-stepper__line {
  width: 64px;
  height: 2px;
  margin-top: 13px; /* vertically centers the line on the 28px circles */
  background: var(--color-border);
  transition: background-color var(--transition-fast);
}

.setup-stepper__line.completed {
  background: var(--color-primary);
}

/* ---- Step panels: fade + rise transition instead of instant
   display:none/block. JS toggles the `active` class; display itself is
   still flipped by JS (inline style) after the transition finishes on the
   way out, and before it starts on the way in. ---- */

.setup-step {
  display: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.setup-step.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* ---- Form fields ---- */

.setup-card .form-label {
  text-transform: none;
  letter-spacing: normal;
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  color: var(--color-text);
  margin-bottom: 4px;
}

.setup-card .form-textarea {
  font-size: 15px;
  background: var(--color-surface);
  resize: vertical;
}

.setup-card .form-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(26, 107, 255, 0.1);
}

/* Step 1's two fields raise .form-textarea's shared 120px floor -- their
   1000/600 character limits reward a few sentences, not one line, and
   alpha testers (2026-07-22) asked whether they should write more, which
   means the old single-line-height default was signaling the opposite. */
#business-description {
  min-height: 170px;
}

#account-goal {
  min-height: 130px;
}

.setup-card .form-hint {
  text-align: right;
  transition: color var(--transition-fast);
}

.form-hint--warning {
  color: var(--color-warning);
}

.form-hint--danger {
  color: var(--color-danger);
}

/* ---- Step 2 banners: deep-link filter state + unconfirmed-campaigns
   summary. Both reuse the shared .alert/.alert--info/.alert--warning
   classes (see style.css) for their color and left-border treatment --
   .alert--warning's border-color already references var(--color-warning)
   directly, satisfying "use the warning token, not a hardcoded hex" for
   this banner. JS (updateFilterBanner()/updateUnconfirmedSummary() in
   page-gads-setup.js) sets textContent/innerHTML and toggles [hidden]. ---- */

.setup-filter-banner,
.setup-unconfirmed-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.setup-filter-banner[hidden],
.setup-unconfirmed-summary[hidden] {
  display: none;
}

.setup-filter-banner__clear {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--color-primary);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.setup-filter-banner__clear:hover {
  text-decoration: underline;
}

/* ---- Campaign cards (Step 2) ---- */

#campaign-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.campaign-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.campaign-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-2);
}

.campaign-card__name {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  margin-bottom: 0;
}

.campaign-card__context {
  margin-bottom: var(--space-3);
}

.campaign-card__context .text-muted {
  font-size: 13px;
  font-style: italic;
}

.campaign-card .form-group {
  margin-bottom: 0;
}

.setup-card .campaign-purpose-input {
  font-size: 13px;
  border-width: 1px;
}

/* ---- Campaign card pills: "Needs review" (confirmation state) and
   "Excluded" (analysis state), plus the pre-existing confidence badge.
   Grouped in one wrapper so they stay together on the right of the header
   regardless of how many are present. ---- */

.campaign-card__pills {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.campaign-card__pill {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

/* Outlined, not the solid .badge--warning pastel used elsewhere in this
   app -- keeps this pill visually lighter-weight than a status badge.
   References --color-warning directly rather than a hardcoded hex. */
.campaign-card__pill--warning {
  color: var(--color-warning);
  background: transparent;
  border: 1px solid var(--color-warning);
}

.campaign-card__pill--excluded {
  color: var(--color-text-muted);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
}

/* ---- Confirmation state (system-driven, "Needs review"): row-level
   treatment so an unconfirmed card is scannable without reading its pill.
   Only overrides border-left -- the shared 1px border on the other three
   sides (from .campaign-card) is untouched. Independent of, and can be
   combined with, the excluded/muted treatment below. ---- */

.campaign-card--unconfirmed {
  border-left: 3px solid var(--color-warning);
  padding-left: calc(var(--space-4) - 3px);
}

/* ---- Analysis state (user-driven, exclusion toggle): muted, not hidden --
   the textarea and toggle both stay fully interactive. A deliberate "set
   aside" cue, visually distinct from the confirmation-state border above
   so the two never read as the same thing when a card carries both. ---- */

.campaign-card--excluded {
  opacity: 0.65;
  background: var(--color-bg);
}

.campaign-card--excluded:hover,
.campaign-card--excluded:focus-within {
  opacity: 0.9;
}

/* ---- Highlight state (passive, informational only): applied to any
   campaign whose id appears in the ?highlight= URL query param, e.g. from
   the new-campaign alert's link (see buildAlertHref() in alerts.js and the
   highlight parsing in page-gads-setup.js). Never gates, disables, or
   reorders anything -- the card stays fully editable and confirmable
   exactly like any other. Uses the same --color-primary-light tint the
   .badge--info pill and table-row hover states use elsewhere in this
   theme, just as a persistent row background instead of a hover-only one. ---- */
.campaign-card--highlighted {
  background: var(--color-primary-light);
}

/* ---- Campaign card footer: suggest-purpose (left) + exclude toggle
   (right), only rendered in settings mode -- see campaignCardHTML() in
   page-gads-setup.js. First-time onboarding cards never get this footer at
   all, so the first-time flow's card layout is unchanged. ---- */

.campaign-card__footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.campaign-card__suggest {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.campaign-card__suggest-btn {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--color-primary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  font-family: inherit;
}

.campaign-card__suggest-btn:hover {
  text-decoration: underline;
}

.campaign-card__suggest-btn:disabled {
  color: var(--color-text-muted);
  cursor: not-allowed;
  text-decoration: none;
}

/* JS toggles this via .hidden -- needs its own [hidden] override since the
   inline-flex rule below is an author rule that would otherwise beat the
   browser's built-in [hidden] default. */
.campaign-card__suggest-loading {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.campaign-card__suggest-loading[hidden] {
  display: none;
}

.campaign-card__suggest-message {
  margin: 0;
  flex-basis: 100%;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.campaign-card__suggest-message[hidden] {
  display: none;
}

/* insufficient_data reads as a normal outcome via the muted color above;
   a genuine fetch failure gets this danger variant instead. */
.campaign-card__suggest-message--error {
  color: var(--color-danger);
}

.campaign-card__exclude-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
}

.campaign-card__exclude-toggle {
  white-space: nowrap;
}

.campaign-card__exclude-error {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--color-danger);
}

.campaign-card__exclude-error[hidden] {
  display: none;
}

/* ---- Setup actions (button row) ---- */

.setup-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-4);
  margin-top: var(--space-6);
}

.setup-actions .btn {
  min-height: 44px;
}

/* #btn-back reads as a ghost/text button rather than a full secondary
   button -- overridden by id since the element keeps its existing
   `btn btn--secondary` classes (JS looks it up by id only, so the classes
   are free to be visually neutralized here without touching the markup). */
#btn-back {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
}

#btn-back:hover {
  background: transparent;
  color: var(--color-text-muted);
  text-decoration: underline;
}

/* ---- Responsive ---- */

@media (max-width: 640px) {
  .setup-content {
    padding-block: var(--space-6) var(--space-12);
  }

  .setup-card {
    padding: var(--space-5);
  }

  .setup-actions {
    flex-direction: column-reverse;
  }

  .setup-actions .btn {
    width: 100%;
  }

  .campaign-card__header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }

  .campaign-card__footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .setup-stepper__circle {
    width: 24px;
    height: 24px;
    font-size: var(--text-xs);
  }

  .setup-stepper__line {
    width: 40px;
    margin-top: 11px;
  }

  .setup-stepper__label {
    font-size: 10px;
  }
}
