/*
 * FTC Robot Inspection Checklist — styles
 * Colors/metrics pulled from the live FTC Live v7.5.0 page via computed styles.
 * Design tokens are defined as CSS variables so alternate themes are easy to try.
 */

:root {
  --page-bg: #f9f9f9;
  --text: #212529;
  --navbar-bg: #274555;          /* dark navy header */
  --navbar-fg: #ffffff;
  --version-bar-bg: #223c49;     /* thin bar above the header */
  --accent-line: #ff7761;        /* coral rule under the header */

  --category-bg: #ee7c36;        /* orange category header rows */
  --category-fg: #ffffff;

  --cell-border: #c6c6c6;
  --check-color: #212529;        /* black ✓ */
  --highlight-bg: #00ffff;       /* "Highlight Missing" cyan */

  --link: #007bff;               /* rule links / nav */
  --btn-primary: #007bff;        /* Scan QR, Save Comment */
  --btn-secondary: #6c757d;      /* QR Help, Previous Event Comments */
  --btn-info: #17a2b8;           /* Mark In Progress, Highlight Missing */
  --btn-info-active: #117a8b;
  --btn-pass: #32cd32;           /* Pass */
  --btn-incomplete: #f0e442;     /* Incomplete (dark text) */

  --radius: 4px;
  --font: -apple-system, "system-ui", "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ----- Header ------------------------------------------------------------ */
.version-bar {
  background: var(--version-bar-bg);
  color: #cfd8de;
  text-align: center;
  font-size: 13px;
  font-style: italic;
  padding: 4px 0;
}
.version-bar b { font-style: normal; font-weight: 700; }

.navbar {
  background: var(--navbar-bg);
  color: var(--navbar-fg);
  border-bottom: 4px solid var(--accent-line);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 28px;
}
.brand {
  display: inline-flex;
  align-items: center;
  background: #fff;
  padding: 10px 14px;
  border-radius: 2px;
}
.brand img { height: 52px; width: auto; display: block; }

.navbar .nav-links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 22px;
  color: #cfd8de;
  font-size: 15px;
}
.navbar .nav-links a,
.navbar .nav-links span { color: #cfd8de; cursor: pointer; }
.navbar .nav-links a:hover { color: #fff; text-decoration: none; }

/* ----- Page body --------------------------------------------------------- */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 24px 60px;
}
.back-link { display: inline-block; margin-bottom: 6px; }

h1 { font-size: 34px; margin: 6px 0 4px; }

.team-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}
.team-line .team-num { font-size: 30px; font-weight: 700; margin-right: 6px; }
.team-line .spacer { flex: 1; }

/* ----- Buttons ----------------------------------------------------------- */
.btn {
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  padding: 8px 14px;
  cursor: pointer;
  line-height: 1.2;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--btn-primary); }
.btn-secondary { background: var(--btn-secondary); }
.btn-info { background: var(--btn-info); }
.btn-info.active { background: var(--btn-info-active); box-shadow: inset 0 0 0 2px rgba(255,255,255,.5); }
.btn-sm { font-size: 14px; padding: 4px 8px; }
.btn-pass { background: var(--btn-pass); font-size: 18px; padding: 8px 22px; }
.btn-incomplete { background: var(--btn-incomplete); color: var(--text); font-size: 18px; padding: 8px 22px; }

.status-badge {
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius);
  font-size: 14px;
}
.status-badge.none { background: #e9ecef; color: #495057; }
.status-badge.inprogress { background: #cfeefc; color: #0c5460; }
.status-badge.passed { background: #d4edda; color: #155724; }
.status-badge.incomplete { background: #fff3cd; color: #856404; }

/* ----- Checklist table --------------------------------------------------- */
table.formTable {
  width: 100%;
  border-collapse: collapse;
  margin-top: 4px;
}
table.formTable td,
table.formTable th {
  border: 1px solid var(--cell-border);
  padding: 8px 10px;
  vertical-align: middle;
}

/* category header row */
tr.category td {
  background: var(--category-bg);
  color: var(--category-fg);
  font-weight: 700;
  text-align: center;
  font-size: 16px;
}

/* checkbox column */
.cbItem {
  width: 40px;
  min-width: 40px;
  max-width: 100px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  font-size: 20px;
  padding: 0;
}
tr.category .cbItem { font-size: 16px; }
.cbItem.checked::after { content: "\2713"; color: var(--check-color); }
.cbItem.highlight { background: var(--highlight-bg); }

/* ----- conditional section (gate question) ------------------------------- */
tr.gate-row td { background: #fff8e1; border-top: 2px solid #f0c33c; }
tr.gate-row .item-text { font-weight: 600; }
.gate-badge {
  display: inline-block;
  background: #f0a500;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 1px 7px;
  border-radius: 10px;
  margin-right: 8px;
  vertical-align: middle;
}
.gate-hint { display: block; font-weight: 400; font-size: 12.5px; color: #8a6d00; margin-top: 3px; }
.cbItem.gateCheck { cursor: pointer; }

/* items skipped because their section gate is not applicable */
tr.skipped td { background: #f4f4f4; color: #9a9a9a; }
tr.skipped .item-text { text-decoration: line-through; text-decoration-color: #c4c4c4; }
tr.skipped td.rule a { color: #a9b7d0; pointer-events: none; }
tr.skipped .cbItem.na { cursor: default; color: #b5b5b5; font-size: 18px; }
tr.skipped .item-text select { pointer-events: none; opacity: 0.5; }

/* rule column */
td.rule {
  width: 110px;
  text-align: center;
  white-space: normal;
}
td.rule a { color: var(--link); }

.item-text { line-height: 1.35; }
.inspector-note {
  margin-top: 6px;
  padding: 5px 9px;
  background: #eef4fb;
  border-left: 3px solid #6c8cba;
  border-radius: 3px;
  font-size: 13px;
  color: #3a4a5e;
}
.inspector-note-label {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.03em;
  color: #4a6285;
  margin-right: 5px;
}
tr.skipped .inspector-note { background: #f0f0f0; border-left-color: #c4c4c4; color: #9a9a9a; }
tr.skipped .inspector-note-label { color: #a9a9a9; }

/* ----- "What's new" showcase panel --------------------------------------- */
.changes-panel {
  margin: 4px 0 22px;
  border: 1px solid #cdd8e6;
  border-left: 4px solid #2f6db0;
  border-radius: 6px;
  background: #f7fafd;
  padding: 6px 18px 16px;
}
.changes-panel > summary {
  cursor: pointer;
  font-size: 17px;
  font-weight: 700;
  color: #234;
  padding: 10px 2px;
  list-style: none;
}
.changes-panel > summary::-webkit-details-marker { display: none; }
.changes-panel > summary::before { content: "\25B8"; margin-right: 8px; color: #2f6db0; }
.changes-panel[open] > summary::before { content: "\25BE"; }
.cp-badge {
  display: inline-block;
  background: #2f6db0;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 10px;
  margin-right: 8px;
  vertical-align: middle;
}
.cp-intro { margin: 2px 0 14px; color: #445; font-size: 14px; }
.cp-change { padding: 12px 0; border-top: 1px solid #e2eaf3; }
.cp-change h4 { margin: 0 0 4px; font-size: 15px; color: #223; }
.cp-change > p { margin: 0 0 10px; font-size: 13.5px; color: #556; }

/* before / after chips */
.cp-ba { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; }
.cp-before, .cp-after {
  flex: 1 1 280px;
  padding: 9px 11px 9px 12px;
  border-radius: 4px;
  font-size: 13.5px;
  line-height: 1.4;
}
.cp-before { background: #f3f0f0; border: 1px solid #ddd0d0; color: #6b5b5b; }
.cp-after { background: #eef7ee; border: 1px solid #cfe4cf; color: #2f4a2f; }
.cp-tag {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.cp-before .cp-tag { color: #a06868; }
.cp-after .cp-tag { color: #4a8a4a; }

/* single-question demo (notes) */
.cp-demo-q { font-size: 14px; color: #223; margin-bottom: 2px; }

/* conditional-skip mini demo table */
.cp-skip-demo { border-collapse: collapse; width: 100%; }
.cp-skip-demo td { border: 1px solid #dbe2ea; padding: 8px 10px; font-size: 13.5px; }
.cp-skip-demo .cbItem { width: 40px; text-align: center; cursor: pointer; user-select: none; font-size: 18px; }
.cp-skip-demo tr.gate-row td { background: #fff8e1; border-top: 2px solid #f0c33c; }

/* link (on the checklist page) to the separate What's-new page */
.whats-new-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 2px 0 8px;
  padding: 7px 14px;
  background: #eef4fb;
  border: 1px solid #cdd8e6;
  border-left: 4px solid #2f6db0;
  border-radius: 6px;
  color: #23405f;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
}
.whats-new-link:hover { background: #e2edf8; }

/* before/after rendered as real checklist rows (What's-new page, change #1) */
.cp-row-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 10px 0 3px;
  color: #667;
}
.cp-row-label.before { color: #a06868; }
.cp-row-label.after { color: #4a8a4a; }
.cp-rowdemo { margin: 0 0 4px; }

/* ----- change-explanation carousel (What's-new page) --------------------- */
.changecard-deck .cp-change {
  border: 1px solid #cdd8e6;
  border-left: 4px solid #2f6db0;
  border-radius: 6px;
  background: #f7fafd;
  padding: 18px 22px 22px;
  min-height: 230px;
}
.changecard-deck .cp-change h4 { margin-top: 0; font-size: 17px; }

.card-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0 0;
}
.card-progress { font-size: 14px; color: #555; }
.card-nav .btn[disabled] { opacity: 0.45; cursor: default; }
.item-text select {
  margin-left: 6px;
  font-family: inherit;
  font-size: 15px;
  padding: 2px 4px;
}

/* ----- Comments + footer ------------------------------------------------- */
.comments-section { margin-top: 26px; }
.comments-section h3 { margin: 0 0 8px; font-size: 22px; }
textarea#comment {
  width: 100%;
  min-height: 110px;
  font-family: inherit;
  font-size: 15px;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: var(--radius);
  resize: vertical;
}
.comment-help { font-size: 13px; color: #555; margin: 6px 0 10px; }
.comment-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.decision-bar {
  display: flex;
  justify-content: center;
  gap: 26px;
  margin-top: 40px;
}

.saved-comments { margin-top: 14px; font-size: 14px; }
.saved-comments .entry {
  border-left: 3px solid var(--btn-info);
  padding: 4px 10px;
  margin: 6px 0;
  background: #f1f5f7;
}

/* small toast */
#toast {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  background: #323232; color: #fff;
  padding: 10px 18px; border-radius: 4px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
  z-index: 50;
}
#toast.show { opacity: .95; }

/* ----- QR scanner modal -------------------------------------------------- */
.qr-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;               /* toggled via inline style */
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.qr-dialog {
  background: #fff;
  border-radius: 8px;
  width: min(440px, 92vw);
  padding: 18px 20px 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.qr-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.qr-dialog-head h3 { margin: 0; font-size: 20px; }
.qr-close {
  border: none;
  background: none;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  color: #666;
}
.qr-video-wrap {
  margin: 12px 0;
  background: #000;
  border-radius: 6px;
  overflow: hidden;
  min-height: 4px;
}
#qrVideo { width: 100%; max-height: 260px; object-fit: cover; }

.qr-status { min-height: 20px; font-size: 14px; margin: 4px 0 12px; }
.qr-status.error { color: #b00020; }
.qr-status.warn { color: #8a6d00; }

.qr-actions { display: flex; gap: 10px; margin-bottom: 14px; }
.qr-actions .btn { flex: 1; }

.qr-manual { border-top: 1px solid #e2e2e2; padding-top: 12px; }
.qr-manual label { display: block; font-size: 13px; color: #555; margin-bottom: 6px; }
.qr-manual-row { display: flex; gap: 8px; margin-bottom: 10px; }
.qr-manual-row input {
  flex: 1;
  font-family: inherit;
  font-size: 14px;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: var(--radius);
}
