/* Portal — used by page administrators, mostly on a phone. Mobile-first
   with large touch targets. Deliberately separate from style.css: that one
   is dense and built for operators, this one is for everyone else. */

:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --line: #e3e8ef;
  --text: #1a2233;
  --muted: #6b7688;
  --accent: #1877f2;        /* Facebook blue — signals the login it connects to */
  --accent-dark: #145dbf;
  --ok: #16a34a;
  --bad: #dc2626;
  --warn: #d97706;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 24px 18px 60px;
}
.wrap.wide { max-width: 760px; }

/* ── Header ─────────────────────────────────────────────── */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.top .who { font-size: 13px; color: var(--muted); }
.top a { color: var(--muted); font-size: 13px; text-decoration: none; }
.top a:hover { color: var(--text); }
/* The brand is a link home, so it needs to win over the generic `.top a`
   rule above — otherwise it renders as small muted text like "Sign out". */
.top a.brand { font-weight: 700; font-size: 15px; color: var(--text); }

/* ── Footer ─────────────────────────────────────────────── */

/* App Review requires the privacy policy and data deletion instructions to
   be reachable from wherever a person actually lands. A page admin only
   ever sees the portal, so without this footer those pages are unreachable
   for them without typing a URL. */
.portal-footer {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 18px 40px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.portal-footer a { color: var(--muted); text-decoration: none; margin: 0 10px; }
.portal-footer a:hover { color: var(--text); text-decoration: underline; }
.portal-footer .copy { display: block; margin-top: 12px; opacity: .7; font-size: 12px; }

/* ── Card ───────────────────────────────────────────────── */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px 22px;
  margin-bottom: 16px;
}

h1 { font-size: 22px; margin: 0 0 6px; line-height: 1.3; }
h2 { font-size: 16px; margin: 0 0 12px; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 20px; }

.org-name {
  display: inline-block;
  background: #e7f0fe;
  color: var(--accent-dark);
  font-weight: 600;
  font-size: 14px;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

/* ── Form ───────────────────────────────────────────────── */

label { display: block; font-size: 14px; font-weight: 500; margin: 0 0 6px; }
.field { margin-bottom: 16px; }

input[type=text], input[type=email], input[type=password] {
  width: 100%;
  font: inherit;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; }

button {
  font: inherit;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  padding: 14px 20px;
  cursor: pointer;
  width: 100%;
  background: var(--accent);
  color: #fff;
  transition: background .15s;
}
button:hover:not(:disabled) { background: var(--accent-dark); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.secondary { background: #eef1f6; color: var(--text); }
button.secondary:hover:not(:disabled) { background: #e3e8ef; }
button.small { width: auto; padding: 8px 14px; font-size: 14px; }
button.link { width: auto; background: none; color: var(--accent); padding: 4px; font-weight: 500; }

/* Facebook wala button Facebook ke rang me hi rehta hai — wahi to Facebook
   kholta hai. Confirm wala button niche alag rang ka hai, warna dono ek
   jaise dikhte the aur samajh nahi aata tha kaun sa dabana hai. */
.fb-btn { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 16px; }

/* "Connect selected Pages" — apna confirm action, isliye hara. */
#connect-btn { background: var(--ok); }
#connect-btn:hover:not(:disabled) { background: #128a3d; }
.fb-btn svg { flex: none; }

/* ── Messages ───────────────────────────────────────────── */

.msg { font-size: 14px; margin: 14px 0 0; padding: 12px 14px; border-radius: 10px; display: none; }
.msg.show { display: block; }
.msg.err { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; white-space: pre-wrap; }
.msg.ok  { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.msg.warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ── Steps ──────────────────────────────────────────────── */

.steps { list-style: none; margin: 0 0 20px; padding: 0; counter-reset: s; }
.steps li {
  position: relative;
  padding: 0 0 18px 42px;
  counter-increment: s;
  border-left: 2px solid var(--line);
  margin-left: 13px;
}
.steps li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps li::before {
  content: counter(s);
  position: absolute; left: -14px; top: -2px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--line); color: var(--muted);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
}
.steps li.done::before { content: '✓'; background: var(--ok); color: #fff; }
.steps li.active::before { background: var(--accent); color: #fff; }
.steps li b { display: block; font-size: 15px; }
.steps li span { font-size: 13px; color: var(--muted); }

/* ── Page list ──────────────────────────────────────────── */

.page-list { list-style: none; margin: 0; padding: 0; }
.page-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border: 1px solid var(--line);
  border-radius: 12px; margin-bottom: 10px;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.page-item:hover { border-color: var(--accent); }
.page-item.selected { border-color: var(--accent); background: #f0f6ff; }
.page-item.disabled { opacity: .55; cursor: not-allowed; background: #fafbfc; }
.page-item input[type=checkbox] { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }

.avatar {
  flex: none; width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 15px;
}
.avatar.grey { background: #cbd5e1; color: #64748b; }

.page-info { flex: 1; min-width: 0; }
.page-name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-meta { font-size: 12.5px; color: var(--muted); }

.tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 5px; }
.tag.ok { background: #dcfce7; color: #166534; }
.tag.bad { background: #fee2e2; color: #991b1b; }
.tag.warn { background: #fef3c7; color: #92400e; }

.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 14px; }

/* ── Misc ───────────────────────────────────────────────── */

.center { text-align: center; }
.muted { color: var(--muted); font-size: 13px; }
.divider { height: 1px; background: var(--line); margin: 20px 0; }
a { color: var(--accent); }

.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
  vertical-align: -3px; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }
