/* Shared small components: badges, alerts, pagination, modal, dropdown.
   (Companion to the per-module stylesheets listed in the objectives doc.) */

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 999px;
  border: 1px solid transparent;
}

.badge-green {
  color: var(--primary);
  background: rgba(0, 122, 61, 0.1);
  border-color: rgba(0, 122, 61, 0.3);
}

.badge-gold {
  color: #8a6607;
  background: rgba(201, 150, 10, 0.12);
  border-color: rgba(201, 150, 10, 0.35);
}

.badge-red {
  color: var(--danger);
  background: rgba(179, 0, 12, 0.08);
  border-color: rgba(179, 0, 12, 0.3);
}

.badge-muted {
  color: var(--muted);
  background: var(--surface-off);
  border-color: var(--border);
}

/* ---- Alerts / Django messages ---- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border);
  border-left-width: 3px;
  background: var(--surface);
  font-size: 14px;
  margin-bottom: 1rem;
}

.alert .alert-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding-top: 2px;
}

.alert-success { border-left-color: var(--primary-light); }
.alert-success .alert-tag { color: var(--primary); }

.alert-info { border-left-color: var(--gold); }
.alert-info .alert-tag { color: var(--gold); }

.alert-warning { border-left-color: var(--gold-light); }
.alert-warning .alert-tag { color: #8a6607; }

.alert-error { border-left-color: var(--danger); }
.alert-error .alert-tag { color: var(--danger); }

.alert .alert-close {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ---- Pagination ---- */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 12px;
  margin-top: 1.25rem;
}

.pagination a,
.pagination .page-current,
.pagination .page-gap {
  min-width: 34px;
  padding: 0.4rem 0.6rem;
  text-align: center;
  border-radius: var(--radius-btn);
  text-decoration: none;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: color 0.15s, border-color 0.15s;
}

.pagination a:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.pagination .page-current {
  color: var(--surface);
  background: var(--primary);
  border-color: var(--primary);
}

.pagination .page-gap {
  border: none;
  background: none;
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(8, 12, 8, 0.75);
  backdrop-filter: blur(3px);
  padding: 1.5rem;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  width: min(560px, 100%);
  background: var(--surface);
  border-radius: var(--radius-card);
  border-top: 3px solid var(--primary);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  animation: modalin 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes modalin {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: 0.05em;
}

.modal-body {
  padding: 1.4rem;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.4rem;
  background: var(--surface-off);
}

/* ---- Dropdown ---- */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  z-index: 950;
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.dropdown.open .dropdown-menu {
  display: block;
}

.dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.6rem 1rem;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s;
}

.dropdown-item:hover {
  background: rgba(0, 122, 61, 0.07);
  color: var(--primary);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
}

/* ---- step list --------------------------------------------------------
   Numbered routes ("RSVP, onboard, qualify, register") appear on both the
   red and blue registration pages. Defined once so the two sides look like
   one product.

   Uses --primary / --muted / --text from variables.css. An earlier version
   referenced --accent and --text-muted, which this app does not define, so
   every rule silently fell back to a hardcoded colour. */
.step-list {
  list-style: none;
  counter-reset: step;
  margin: 1.1rem 0 0;
  padding: 0;
}
.step-list > li {
  counter-increment: step;
  position: relative;
  padding-left: 2.25rem;
  margin-bottom: 0.85rem;
  color: var(--muted);
  line-height: 1.55;
}
.step-list > li:last-child { margin-bottom: 0; }
.step-list > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.05rem;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--primary);
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1;
}
.step-list > li strong { color: var(--text); font-weight: 600; }

/* Red dashboards carry the danger accent, set on <body> by base.html. */
[data-side="red"] .step-list > li::before {
  border-color: var(--danger);
  color: var(--danger);
}

/* ---- key dates --------------------------------------------------------
   A small timeline, not a data table: no rules between rows, the date in
   mono so the column aligns, and only the next one ahead emphasised. Rows
   already past recede rather than disappear. */
.key-dates { width: 100%; border-collapse: collapse; }
.key-dates td {
  border: 0;
  padding: 0.45rem 0;
  vertical-align: baseline;
}
.key-dates td:first-child { padding-right: 1.25rem; }
.key-dates .kd-when {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  white-space: nowrap;
  color: var(--muted);
}
.key-dates .kd-what { color: var(--muted); }
.key-dates tr.is-next .kd-what { color: var(--text); font-weight: 600; }
.key-dates tr.is-next .kd-when { color: var(--primary); font-weight: 700; }
.key-dates tr.is-past .kd-what,
.key-dates tr.is-past .kd-when { opacity: 0.45; }
.key-dates .kd-tag {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-left: 0.5rem;
}
[data-side="red"] .key-dates tr.is-next .kd-when,
[data-side="red"] .key-dates .kd-tag { color: var(--danger); }

/* ---- side choice ------------------------------------------------------
   Two buttons that mean "blue" and "red", shown to somebody with no team.
   Side by side and equal weight, because the choice is genuinely even --
   stacking them or making one primary implies a recommendation. */
.side-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}
.side-choice .btn { flex: 1 1 12rem; }

/* ---- person rows ------------------------------------------------------
   The recruiting list and the consent register are lists of people, not
   spreadsheets: the name leads, the detail under it is secondary, and the
   action sits right. */
.person-sub {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.15rem;
}
.table td .person-sub { line-height: 1.4; }

/* ---- empty states -----------------------------------------------------
   A panel with nothing in it should say so plainly and point somewhere,
   rather than looking like a page that failed to load. */
.empty-state {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.empty-state p { margin: 0 0 0.75rem; }
.empty-state p:last-child { margin-bottom: 0; }

/* ---- job grid ---------------------------------------------------------
   The notification console's cards are actions, so each one keeps its
   button pinned to the bottom and the cards stay the same height. */
.job-card { display: flex; flex-direction: column; }
.job-card .card-title { margin-bottom: 0.5rem; }
.job-card form { margin-top: auto; padding-top: 0.9rem; }

/* ---- notification body ------------------------------------------------
   Notifications are written as plain text with paragraphs, bullets and
   "Label: value" rows, and used to render inside one <p>, where HTML
   collapses the newlines into a single run-on sentence. These give the
   parsed blocks the shape they were written with. */
.note-body { color: var(--muted); }
.note-body .note-text { margin: 0 0 0.6rem; line-height: 1.55; }
.note-body .note-text:last-child { margin-bottom: 0; }
.note-list { margin: 0 0 0.6rem 1.1rem; padding: 0; }
.note-list li { margin-bottom: 0.25rem; line-height: 1.5; }
.note-fields {
  display: grid;
  grid-template-columns: minmax(7rem, auto) 1fr;
  gap: 0.25rem 1rem;
  margin: 0 0 0.6rem;
}
.note-fields dt {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.note-fields dd { margin: 0; color: var(--text); }

/* ---- FAQ --------------------------------------------------------------
   A reading page, so the question leads and the answer sits under it with
   room to breathe. Two columns of contents at desktop width, one on a
   phone. */
.faq-toc {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  columns: 2;
  column-gap: 2rem;
}
.faq-toc li { margin-bottom: 0.35rem; break-inside: avoid; }
@media (max-width: 640px) { .faq-toc { columns: 1; } }

.faq-list { margin: 0.5rem 0 0; }
.faq-list dt {
  font-weight: 600;
  color: var(--text);
  margin-top: 1.1rem;
  line-height: 1.4;
}
.faq-list dt:first-child { margin-top: 0; }
.faq-list dd {
  margin: 0.35rem 0 0;
  color: var(--muted);
  line-height: 1.6;
}

/* ---- phase divider ----------------------------------------------------
   Separates the two halves of a merged dashboard. A rule with a label, so
   a long page still reads as two sections rather than one scroll. */
.phase-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2.25rem 0 1.5rem;
}
.phase-divider::before,
.phase-divider::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--border);
}
.phase-divider span {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

/* ---- filter bar -------------------------------------------------------
   The organiser screens narrow by several things at once, so the controls
   wrap on one line and the summary underneath says what is in force and
   offers the matching export. */
.filter-bar { margin-bottom: 1.5rem; }
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}
/* The global `select { width: 100% }` makes every control claim a whole
   row, which turned a one-line filter bar into a seven-row stack. */
.filter-row select,
.filter-row input[type="search"],
.filter-row input[type="text"] {
  width: auto;
  flex: 0 1 auto;
  min-width: 8.5rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  font-family: var(--font-body);
  font-size: 0.8rem;
  background: var(--surface);
  color: var(--text);
}
.filter-row .filter-search { flex: 2 1 16rem; }
.filter-row .filter-inst { flex: 1 1 10rem; }
.filter-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}
.filter-summary code {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--primary);
}

/* ---- column picker ----------------------------------------------------
   Ticking which columns to export. A grid rather than a list, because
   sixteen stacked checkboxes is a scroll, not a choice. */
.column-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.4rem 1rem;
  margin: 0.75rem 0 0;
}
.column-picker label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
}
.column-picker input[type="checkbox"] { accent-color: var(--primary); }

/* ---- check strip ------------------------------------------------------
   The four checks an application image goes through: Pulled, Scanned,
   Deployed, Healthy. The team was shown these four names in the briefing
   and the Image Submission Guide, so they are named, not numbered, and
   the ones still ahead stay visible rather than being hidden -- a team
   stuck at Deployed needs to see what it has not reached yet. */
.check-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.9rem 0 0.6rem;
}
.check {
  flex: 1 1 7rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--surface-off);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  color: var(--muted);
}
.check.is-done {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--text-inverse);
}

/* ---- code block -------------------------------------------------------
   A scan report or a log excerpt, as it came back. Wraps rather than
   scrolling sideways, because the useful part of a Trivy line or a stack
   trace is usually past the right-hand edge. */
.code-block {
  margin: 0.75rem 0 0;
  padding: 0.75rem 0.85rem;
  max-height: 22rem;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-off);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
