/* ============================================================
   Adfactors GEO — Component styles
   ============================================================ */

#root { min-height: 100vh; }

/* ---------- App shell ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }

.view-fade { animation: viewIn var(--dur) var(--ease-out) both; }
/* transform-only rise: base state stays visible even if the animation is
   paused (offscreen iframes pause CSS animations) — never hide via opacity */
@keyframes viewIn { from { transform: translateY(9px); } to { transform: none; } }

/* ---------- Top bar (agency) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: var(--s-5);
  padding: 0 var(--s-7); height: 64px;
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar .spacer { flex: 1; }
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.brand .glyph {
  width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-deep));
  color: #fff; box-shadow: 0 4px 12px -4px rgba(194,118,26,.5);
}
.brand .glyph svg { width: 15px; height: 15px; }
.brand .word { font-weight: 800; letter-spacing: -.01em; font-size: 15px; white-space: nowrap; }
.brand .word .geo { color: var(--accent-ink); }

.nav { display: flex; align-items: center; gap: 2px; }
.nav a, .nav button {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px; border-radius: var(--r-ctrl);
  color: var(--muted); font-weight: 600; font-size: 13.5px;
  background: none; border: none; cursor: pointer; white-space: nowrap;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.nav a:hover, .nav button:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { color: var(--accent-ink); background: var(--accent-wash); }

.env-badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); white-space: nowrap;
}
.env-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--grade-a); box-shadow: 0 0 0 3px rgba(31,175,94,.18); }

/* ---------- Layout containers ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: var(--s-8) var(--s-7) var(--s-10); }
.page-head { display: flex; align-items: flex-end; gap: var(--s-5); margin-bottom: var(--s-7); }
.page-head .titles { flex: 1; min-width: 0; }
.page-title { font-family: var(--font-display); font-weight: 500; font-size: 34px; line-height: 1.08; letter-spacing: -.01em; margin: 0; }
.page-sub { color: var(--muted); margin: 7px 0 0; font-size: 14.5px; }
.head-actions { display: flex; align-items: center; gap: var(--s-3); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: var(--r-ctrl);
  font-weight: 700; font-size: 13.5px; letter-spacing: .005em;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast), background var(--dur-fast), border-color var(--dur-fast), opacity var(--dur-fast);
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #3d2a0a; box-shadow: 0 8px 20px -10px rgba(194,118,26,.55); }
.btn-primary:hover { box-shadow: 0 12px 26px -10px rgba(194,118,26,.7); filter: saturate(106%) brightness(1.03); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { border-color: var(--accent-2); color: var(--accent-ink); }
.btn-soft { background: var(--accent-wash); color: var(--accent-ink); }
.btn-soft:hover { background: #f6e7cd; }
.btn-link { background: none; height: auto; padding: 4px 2px; color: var(--accent-ink); }
.btn-link:hover { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 3px; }
.btn-danger { background: var(--surface); color: var(--danger-ink); border-color: #f0c4cf; }
.btn-danger:hover { background: var(--danger-wash); border-color: var(--danger); }
.btn-block { width: 100%; }
.btn-lg { height: 50px; padding: 0 24px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn .spin { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-primary .spin { border-color: rgba(61,42,10,.3); border-top-color: #3d2a0a; }
.btn-ghost .spin { border-color: rgba(15,42,46,.2); border-top-color: var(--accent-ink); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-sm); }
.card-pad { padding: var(--s-6); }
.card-h { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-5); }
.card-h h3 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -.005em; }
.card-h .spacer { flex: 1; }
.eyebrow { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin: 0 0 6px; }

/* ---------- Pills / chips ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--line); white-space: nowrap;
}
.pill svg { width: 13px; height: 13px; opacity: .8; }
.chip-method { font-family: var(--font-mono); font-size: 11px; letter-spacing: .02em; padding: 5px 10px; border-radius: 7px; background: var(--accent-wash); color: var(--accent-ink); border: none; white-space: nowrap; }

/* ---------- Status badge ---------- */
.status { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px 4px 9px; border-radius: var(--r-pill); font-size: 12px; font-weight: 700; border: 1px solid transparent; white-space: nowrap; }
.status .sdot { width: 7px; height: 7px; border-radius: 50%; }
.status-draft     { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.status-draft .sdot { background: var(--faint); }
.status-review    { background: var(--amber-wash); color: var(--amber-ink); border-color: #f0dca6; }
.status-review .sdot { background: var(--amber); }
.status-changes   { background: var(--danger-wash); color: var(--danger-ink); border-color: #f0c4cf; }
.status-changes .sdot { background: var(--danger); }
.status-approved  { background: var(--success-wash); color: var(--success-ink); border-color: #b8e6c9; }
.status-approved .sdot { background: var(--success); }
.status-published { background: var(--accent-wash); color: var(--accent-ink); border-color: #f2e2c8; }
.status-published .sdot { background: var(--accent-2); }

/* ---------- Grade badge ---------- */
.grade-badge { display: inline-grid; place-items: center; font-family: var(--font-display); font-weight: 600; border-radius: 12px; line-height: 1; }
.score-chip { display: inline-flex; align-items: baseline; gap: 7px; padding: 5px 10px 5px 12px; border-radius: var(--r-pill); font-weight: 800; }
.score-chip .num { font-size: 15px; }
.score-chip .gr { font-family: var(--font-display); font-weight: 600; font-size: 12px; opacity: .85; }

/* ---------- Dashboard summary strip ---------- */
.summary-strip { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-bottom: var(--s-6); }
.stat-card { flex: 1; min-width: 150px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card-sm); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.stat-card .k { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.stat-card .l { font-size: 12.5px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 7px; }

/* ---------- Table ---------- */
.table-card { overflow: hidden; }
.t-toolbar { display: flex; align-items: center; gap: var(--s-3); padding: 14px 18px; border-bottom: 1px solid var(--line); }
.t-toolbar .count { font-size: 13px; color: var(--muted); }
.t-toolbar .spacer { flex: 1; }
table.content-table { width: 100%; border-collapse: collapse; }
.content-table th { text-align: left; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); font-weight: 700; padding: 12px 18px; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; white-space: nowrap; }
.content-table th .arr { opacity: .5; font-size: 10px; margin-left: 3px; }
.content-table td { padding: 15px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.content-table tbody tr { cursor: pointer; transition: background var(--dur-fast); }
.content-table tbody tr:hover { background: var(--bg-tint); }
.content-table tbody tr:hover .row-title { color: var(--accent-ink); }
.content-table tbody tr:last-child td { border-bottom: none; }
.row-title { font-weight: 700; font-size: 14px; transition: color var(--dur-fast); }
.row-meta { font-size: 12px; color: var(--faint); margin-top: 3px; font-family: var(--font-mono); }
.cell-client { font-weight: 600; font-size: 13px; }
.cell-type { color: var(--muted); font-size: 13px; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: var(--s-10) var(--s-6); }
.empty .ico { width: 56px; height: 56px; border-radius: 16px; background: var(--accent-wash); color: var(--accent-ink); display: grid; place-items: center; margin: 0 auto var(--s-5); }
.empty h3 { font-family: var(--font-display); font-weight: 500; font-size: 22px; margin: 0 0 6px; }
.empty p { color: var(--muted); margin: 0 auto var(--s-5); max-width: 360px; }

/* ---------- Forms ---------- */
.field { margin-bottom: var(--s-5); }
.field > label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink); margin-bottom: 7px; }
.field .hint { font-size: 12px; color: var(--faint); margin-top: 6px; }
.control {
  width: 100%; height: 44px; padding: 0 14px; border-radius: var(--r-ctrl);
  background: var(--surface); border: 1px solid var(--line-2); color: var(--ink);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
textarea.control { height: auto; padding: 12px 14px; min-height: 120px; resize: vertical; line-height: 1.55; }
.control::placeholder { color: var(--faint); }
.control:focus { outline: none; border-color: var(--accent-2); box-shadow: var(--shadow-focus); }
.control.err { border-color: var(--danger); }
select.control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%234d6266' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; cursor: pointer; }
.field-err { color: var(--danger-ink); font-size: 12px; margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.select-row { display: flex; gap: var(--s-3); align-items: flex-end; }
.select-row .field { flex: 1; margin-bottom: 0; }

/* ---------- Tabs (input-mode) ---------- */
.tabs { display: inline-flex; gap: 3px; padding: 4px; background: var(--surface-2); border-radius: 12px; border: 1px solid var(--line); }
.tabs button { padding: 8px 15px; border: none; background: none; border-radius: 9px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; transition: all var(--dur-fast); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tabs button:hover { color: var(--ink); }
.tabs button.active { background: var(--surface); color: var(--accent-ink); box-shadow: var(--shadow-sm); }

/* ---------- Dropzone ---------- */
.dropzone { border: 1.5px dashed var(--line-2); border-radius: var(--r-card-sm); padding: var(--s-8); text-align: center; background: var(--surface-2); cursor: pointer; transition: all var(--dur-fast); }
.dropzone:hover, .dropzone.drag { border-color: var(--accent-2); background: var(--accent-wash); }
.dropzone .ico { width: 46px; height: 46px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--accent-ink); display: grid; place-items: center; margin: 0 auto var(--s-3); }
.dropzone h4 { margin: 0 0 4px; font-size: 14.5px; }
.dropzone p { margin: 0; color: var(--faint); font-size: 12.5px; }
.dropzone .file { margin-top: 14px; display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-pill); font-size: 12.5px; font-weight: 600; }

/* ---------- Loading overlay (audit) ---------- */
.audit-loading { display: flex; flex-direction: column; align-items: center; gap: var(--s-5); padding: var(--s-9) 0; }
.geo-spinner { width: 54px; height: 54px; position: relative; }
.geo-spinner svg { width: 100%; height: 100%; animation: spin 1.1s linear infinite; }
.loading-status { font-family: var(--font-mono); font-size: 13px; color: var(--muted); min-height: 18px; transition: opacity var(--dur); }

/* ---------- Inline error region ---------- */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--r-ctrl); font-size: 13px; }
.alert-error { background: var(--danger-wash); color: var(--danger-ink); border: 1px solid #f0c4cf; }
.alert svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--ink); color: #fff; border-radius: var(--r-pill); font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lg); animation: toastIn var(--dur) var(--ease-out) both; }
.toast svg { width: 16px; height: 16px; color: var(--accent-3); }
@keyframes toastIn { from { transform: translateY(14px) scale(.96); } to { transform: none; } }

/* keyframes shared by viz */
@keyframes barGrow { from { width: 0 !important; } }
