/* Project Beacon Approval Broker — minimal BU-palette UI. */

:root {
  --bu-red: #CC0000;
  --bu-red-dark: #A30000;
  --bu-black: #2D2926;
  --bg: #f6f7f7;
  --card-bg: #ffffff;
  --border: #e6e4e0;
  --muted: #6b6864;
  --text: #2D2926;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.04), 0 8px 24px rgba(45, 41, 38, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}
a { color: var(--bu-red); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--bu-black); }
code { background: #f0eee9; padding: 0 4px; border-radius: 3px; font-size: 0.92em; }

/* ---- app shell: dark top header + dark left nav rail ------------------ */

body.with-sidebar {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}
body.bare .content main { max-width: 560px; margin: 0 auto; }

/* Header: brand left, signed-in identity right, red keyline underneath. */
.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bu-black);
  color: #fff;
  padding: 10px 20px;
  /* Quiet grayscale seam — the red accent belongs to the sidebar keyline
   * alone; a second red line here read as visual noise. --muted sits
   * between the header's ink and the page's light background. */
  border-bottom: 1px solid var(--muted);
}
.topbar .brand-link { display: block; line-height: 0; }
.topbar .brand-logo { height: 40px; width: auto; display: block; }
.top-user { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.top-user-id { text-align: right; }
.top-user .who { display: block; color: #fff; font-weight: 500; }
.top-user .who-role { display: block; color: #b8b1ab; font-size: 12px; text-transform: capitalize; }
.top-user .logout {
  display: inline-block;
  padding: 6px 14px;
  background: var(--bu-red);
  color: #fff;
  border-radius: 3px;
  font-size: 13px;
}
.top-user .logout:hover { background: var(--bu-red-dark); color: #fff; text-decoration: none; }

.sidebar {
  background: var(--bu-black);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 8px 0 16px;
  position: sticky; top: 0;
  height: 100vh;
  border-right: 1px solid var(--muted);
}
.sidebar nav { display: flex; flex-direction: column; margin-top: 6px; flex: 1; }
.sidebar .nav-label {
  padding: 16px 20px 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8d8680;
}
.sidebar nav a {
  display: block;
  padding: 8px 20px;
  color: #e8e4e0;
  font-size: 14px;
  border-left: 3px solid transparent;
}
.sidebar nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.06); text-decoration: none; }
.sidebar nav a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-left-color: var(--bu-red);
  font-weight: 600;
}

.content { display: flex; flex-direction: column; min-height: 100%; }
main { width: 100%; max-width: 960px; margin: 24px auto 0; padding: 0 24px 24px; }

/* narrow screens: sidebar becomes a compact top block */
@media (max-width: 860px) {
  body.with-sidebar { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto;
    padding: 14px 0 0;
    border-right: 0;
    border-bottom: 1px solid var(--muted);
  }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; align-items: center; margin-top: 8px; }
  .sidebar .nav-label { width: 100%; padding: 8px 20px 2px; }
  .sidebar nav a { border-left: 0; border-bottom: 3px solid transparent; padding: 8px 12px; }
  .sidebar nav a.active { border-bottom-color: var(--bu-red); }
  /* header: let the identity block wrap under the brand on small screens */
  .topbar { flex-wrap: wrap; border-bottom: 0; }
  .topbar .brand-logo { height: 34px; }
  .top-user { margin-left: auto; }
  .top-user-id { text-align: left; }
}

@media (prefers-reduced-motion: no-preference) {
  .sidebar nav a { transition: background 120ms ease, color 120ms ease; }
}

/* card */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 24px 28px;
  margin: 0 0 20px;
  box-shadow: var(--shadow);
}
.card h1, .card h2 { margin-top: 0; }
.card h1 { font-size: 22px; }
.card h2 { font-size: 17px; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--border); }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; }
.error { color: var(--bu-red); font-weight: 500; }

/* login — mirrors the Listmonk (beacon.bu.edu) login page: the app's own
 * dark topbar carries the brand, then a centered white card with one solid
 * BU-Red "BU Login" button (same 15px/30px padding and 17px/600 label as
 * the Listmonk OIDC button re-skin in appearance-public.css). */
.login { max-width: 420px; margin: 80px auto 0; }
.login .button.sso {
  display: block;
  width: 100%;
  padding: 15px 30px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-align: center;
}
.login .button.sso:hover { background: var(--bu-black); border-color: var(--bu-black); text-decoration: none; }
.login details { margin-top: 18px; }
.login summary.hint { cursor: pointer; }
.login form label { display: block; margin: 14px 0; font-size: 14px; }
.login form input {
  display: block; width: 100%; margin-top: 4px;
  padding: 9px 12px; font-size: 15px;
  border: 1px solid #c6c2bd; border-radius: 4px;
  background: #fff;
}
.login form input:focus { outline: none; border-color: var(--bu-red); box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.15); }

/* forms */
form label { display: block; margin: 14px 0; font-size: 14px; font-weight: 500; }
form input, form textarea, form select {
  display: block; width: 100%; margin-top: 4px;
  padding: 9px 12px; font-size: 14px;
  border: 1px solid #c6c2bd; border-radius: 4px;
  background: #fff;
  font-family: inherit;
}
form input:focus, form textarea:focus, form select:focus { outline: none; border-color: var(--bu-red); box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.15); }
form textarea { resize: vertical; min-height: 80px; }

.button-row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.handoff-actions { justify-content: flex-start; }
.row-actions { display: flex; gap: 8px; align-items: center; }
.row-actions form { margin: 0; }

.button, button {
  display: inline-block;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid #c6c2bd;
  background: #fff;
  color: var(--text);
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}
.button:hover, button:hover { border-color: var(--bu-black); color: var(--bu-black); }
.button.primary, button.primary {
  background: var(--bu-red); color: #fff; border-color: var(--bu-red);
}
.button.primary:hover, button.primary:hover {
  background: var(--bu-red-dark); border-color: var(--bu-red-dark); color: #fff;
}
.button.danger, button.danger {
  background: #fff; color: var(--bu-red); border-color: var(--bu-red);
}
.button.danger:hover, button.danger:hover {
  background: var(--bu-red); color: #fff;
}

/* data tables */
table.data { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 14px; }
table.data th, table.data td {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.data th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); font-weight: 600; }
table.data tr:hover td { background: #faf9f7; }

/* tags */
.tag {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  margin: 0 4px 4px 0;
  background: #f0eee9;
  color: var(--bu-black);
  border-radius: 3px;
}

/* status pills */
.status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.status-pending          { background: #fff4d6; color: #8a5a00; }
.status-approved         { background: #e3f3df; color: #2f6b2c; }
.status-approve          { background: #e3f3df; color: #2f6b2c; }
.status-rejected,
.status-reject,
.status-dispatch_failed,
.status-status_rejected  { background: #fbe2dc; color: var(--bu-red-dark); }
.status-dispatched,
.status-status_approved  { background: #cfe6f3; color: #1a4a6b; }
.status-withdrawn        { background: #ededed; color: var(--muted); }
.status-login, .status-logout, .status-policy_set, .status-submitted, .status-decision_approve, .status-decision_reject {
  background: #f0eee9; color: var(--bu-black);
}

/* campaign meta */
.campaign-meta { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 12px 0 24px; }
.campaign-meta dt { color: var(--muted); font-size: 13px; }
.campaign-meta dd { margin: 0; font-size: 14px; }
.campaign-meta dd.note { font-style: italic; }

/* ---- create-list page ------------------------------------------------- */
/* Two decisions, two groups: what it's called, where members come from.
   The group label is the structural cue; keep everything else quiet. */

.field-group {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px 20px 20px;
  margin: 18px 0;
}
.field-group .group-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}
.field-group label { margin: 12px 0 0; }

.name-preview {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.name-preview code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: #f0eee9;
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--bu-black);
}

/* membership source: two radio cards; the chosen one gets the red keyline */
.source-option {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 12px 14px;
  margin: 10px 0 0;
  cursor: pointer;
  font-weight: 400;
}
.source-option:has(input:checked) {
  border-color: var(--bu-red);
  box-shadow: inset 3px 0 0 var(--bu-red);
}
.source-option:has(input:disabled) { opacity: 0.5; cursor: not-allowed; }
.source-option input[type="radio"] {
  width: auto; margin: 3px 0 0; accent-color: var(--bu-red);
}
.source-option strong { display: block; font-size: 14px; }
.source-option small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }

#entra-panel {
  margin: 14px 0 0 26px;
  padding-left: 14px;
  border-left: 2px solid var(--border);
}
.group-selected {
  margin: 8px 0 0;
  font-size: 13px;
  color: #2f6b2c;
}

/* typeahead */
.typeahead-results {
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
  box-shadow: var(--shadow);
  max-width: 30em;
  margin-top: 4px;
  overflow: hidden;
}
.typeahead-item {
  display: block; width: 100%; text-align: left;
  padding: 9px 12px;
  border: 0; border-radius: 0;
  background: none; cursor: pointer;
  font: inherit; font-size: 14px;
}
.typeahead-item + .typeahead-item { border-top: 1px solid var(--border); }
.typeahead-item:hover, .typeahead-item:focus-visible {
  background: #faf4f4;
  box-shadow: inset 3px 0 0 var(--bu-red);
  outline: none;
}

.created-note {
  border: 1px solid #cfe3cb;
  background: #f2f8f0;
  border-radius: 5px;
  padding: 12px 16px;
  margin: 0 0 18px;
}
.created-note p { margin: 4px 0; font-size: 14px; }
.created-note .ok { color: #2f6b2c; }

button:disabled, .button:disabled {
  opacity: 0.45; cursor: not-allowed;
}
button:disabled:hover { border-color: var(--bu-red); background: var(--bu-red); }

:focus-visible { outline: 2px solid var(--bu-red); outline-offset: 2px; }

/* campaign preview (sandboxed iframe) */
.preview-frame {
  width: 100%;
  height: 520px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
  margin-top: 6px;
}

/* public explainer page (/message-info) — BU letterhead treatment */
.public-info {
  max-width: 640px;
  margin: 48px auto;
  border-top: 4px solid var(--bu-red);
  padding-top: 28px;
}
.public-brand { margin-bottom: 18px; }
.public-brand img { display: block; height: 60px; width: auto; }
.public-info h1 { font-size: 24px; }
.public-info h2 { border-top: 0; padding-top: 4px; }
.public-foot {
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
