:root {
  --bg: #0f1623;
  --card: #172033;
  --muted: #9aa7bd;
  --text: #e9eef7;
  --blue: #2b55d4;
  --blue-600: #254abb;
  --border: #2a344a;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.wrap {
  max-width: 1100px;
  margin: 48px auto;
  padding: 0 20px;
}

h1 {
  margin: 0 0 16px 0;
  font-size: 56px;
  line-height: 1.1;
}

/* Make the card span the available width */
.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25) inset, 0 0 1px rgba(255,255,255,.04);
  margin-bottom: 20px;

  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.col-2 { grid-column: span 2; }
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }

.label {
  color: var(--muted);
  font-size: 14px;
  margin: 4px 0 6px;
}

select,
input[type="number"] {
  width: 100%;
  height: 36px;
  background: #101725;
  color: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 8px;
}

/* ---- filter bar on one line ---- */
.controls-row{
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 18px;
  flex-wrap: nowrap;
  margin-bottom: 18px;
}

.control{
  flex: 0 0 210px;
}

.control select,
.control input[type="number"]{
  width: 100%;
}

.buttons-row{
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 6px;
}

@media (max-width: 1100px){
  .controls-row{
    flex-wrap: wrap;
  }
  .control{
    flex: 1 1 220px;
    max-width: 320px;
  }
}

#orgSel, #progSel, #levelSel, #eventSel {
  background-color: #101725 !important;
  color: #fff !important;
}
#orgSel option, #progSel option, #levelSel option, #eventSel option {
  background-color: #101725 !important;
  color: #fff !important;
}
#orgSel:focus, #progSel:focus, #levelSel:focus, #eventSel:focus {
  outline: none;
  border-color: var(--blue);
}

/* Buttons: perfectly centered + no underline anywhere */
.btn {
  display: inline-flex;           /* allow centering */
  align-items: center;            /* vertical center */
  justify-content: center;        /* horizontal center */
  line-height: 1;                 /* no baseline shift */
  text-decoration: none;          /* kill underline on <a> */
  height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #23304b;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}

.btn * {
  text-decoration: none !important;
}

.btn.primary {
  background: var(--blue);
  border-color: var(--blue-600);
}

.btn.primary:hover {
  background: var(--blue-600);
}

.btn.ghost {
  background: transparent;
}

.btn.exit-btn {
  background: #8b2f2f;
  color: #fff;
  border: 1px solid #a33a3a;
}
.btn.exit-btn:hover {
  background: #a33a3a;
}

/* pill styles */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: #111827;
}

.question-card #qText {
  font-size: 20px;
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.option {
  background: #0c1320;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  color: #b3c0d8;
}

.option.selected {
  border-color: var(--blue);
  color: #fff;
}

.row-bottom {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.status {
  min-width: 120px;
}

.status.ok { color: #1bd97a; }
.status.bad { color: #ff5577; }

.score {
  margin-left: auto;
}

@media (max-width: 900px) {
  .col-4, .col-3, .col-2 {
    grid-column: span 12;
  }
}

/* ====== Horizontal filter row + centered buttons ====== */
.controls-row{
  display:flex;
  flex-wrap:nowrap;
  gap:16px;
  justify-content:center;
  align-items:flex-end;
  margin-bottom:16px;
}

.control{
  min-width: 220px;
}

.control .label{
  color: var(--muted);
  font-size: 14px;
  margin: 4px 0 6px;
  text-align: left;
}

.buttons-row{
  display:flex;
  justify-content:center;
  gap:16px;
}

.buttons-row .btn{
  width: 220px;
}

.control select,
.control input[type="number"]{
  width:100%;
  height:36px;
  background:#101725;
  color:#fff;
  border:1px solid var(--border);
  border-radius:8px;
  padding:4px 8px;
}

#orgSel, #progSel, #levelSel, #eventSel { background-color:#101725!important; color:#fff!important; }
#orgSel option, #progSel option, #levelSel option, #eventSel option { background-color:#101725!important; color:#fff!important; }
#orgSel:focus, #progSel:focus, #levelSel:focus, #eventSel:focus { outline:none; border-color: var(--blue); }

@media (max-width: 1100px){
  .controls-row{ flex-wrap:wrap; }
  .control{ min-width: 260px; }
}

.wrap{
  max-width: 1320px;
}

.card{
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 20px 24px;
  overflow: hidden;
}

/* === FILTER ROW: exact 5 equal columns === */
.controls-row{
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  column-gap: 20px;
  row-gap: 12px;
  align-items: end;
}

.control{ min-width: 0; }
.control .label{ margin: 0 0 6px; }

.control select,
.control input[type="number"]{
  width: 100%;
  height: 36px;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #101725;
  color: #fff;
}

.control.count{ flex: initial; }

.buttons-row{
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 18px;
}

@media (max-width: 980px){
  .controls-row{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 560px){
  .controls-row{
    grid-template-columns: 1fr;
  }
}

.card, .card * { box-sizing: border-box; }

.card{
  padding: 28px 28px !important;
  overflow: hidden !important;
}

.controls-row{
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  column-gap: 16px !important;
  row-gap: 12px !important;
  align-items: end !important;
  padding: 0 8px !important;
}

.controls-row > .control{
  grid-column: auto !important;
  min-width: 0 !important;
}

.controls-row select,
.controls-row input[type="number"]{
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 36px !important;
  padding: 4px 8px !important;
  border-radius: 8px !important;
  border: 1px solid var(--border) !important;
  background: #101725 !important;
  color: #fff !important;
  box-shadow: none !important;
}

.buttons-row{
  display: flex !important;
  justify-content: center !important;
  gap: 16px !important;
  margin-top: 18px !important;
}

@media (max-width: 1100px){
  .controls-row{ grid-template-columns: repeat(4, minmax(0,1fr)) !important; }
}
@media (max-width: 900px){
  .controls-row{ grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
}
@media (max-width: 560px){
  .controls-row{ grid-template-columns: 1fr !important; }
}

/* =========================
   STUDY OPTIONS (clean, single source of truth)
   ========================= */
.study-options{
  display:flex;
  gap:14px;
  justify-content:center;
  flex-wrap:wrap;
}

/* Bullet-proof centering + no underlines */
.study-options a.btn,
.study-options button.btn{
  display:grid;                 /* grid makes centering trivial */
  place-items:center;           /* vertical + horizontal center */
  min-width:220px;
  height:56px;
  padding:0 22px;               /* no top/bottom padding to skew centering */
  line-height:1;                /* prevent baseline shifts */
  text-align:center;
  text-decoration:none;         /* no underline */
  border-radius:12px;
  font-weight:600;
  background:#23304b;
  color:#fff;
  border:1px solid var(--border);
  cursor:pointer;
}

/* Remove any underline added by nested elements or accidental <u> */
.study-options a.btn *,
.study-options button.btn *{
  text-decoration:none !important;
  line-height:1;
  margin:0;
}

.study-options a.btn:hover,
.study-options button.btn:hover{
  background:var(--blue-600);
}

.notice{
  margin-top:12px; padding:10px 12px;
  border:1px solid #a33a3a; background:#2b1c1c; color:#ffbdbd;
  border-radius:8px; text-align:center;
}

/* === Login page form fields === */
.login-card input[type="email"],
.login-card input[type="password"] {
  width: 100%;
  height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #101725;
  color: #fff;
  font-size: 16px;
  margin-bottom: 14px;
  box-sizing: border-box;
}

.login-card input[type="email"]:focus,
.login-card input[type="password"]:focus {
  outline: none;
  border-color: var(--blue);
}

/* --- Reporting page fixes --- */
.report-section h2,
.report-section h3,
.report-section h4,
.report-section h5,
.report-section h6,
.report-section p,
.report-section .stat,
.report-section table th,
.report-section table td {
    text-align: left !important;
}

/* Global left align for results dashboard */
.report-section,
.report-section * {
    text-align: left !important;
}

/* Stat cards: numbers and labels */
.report-section .stat,
.report-section .stat h3,
.report-section .stat p {
    text-align: left !important;
    justify-content: flex-start !important;
}

/* Green ring for the correct answer reveal */
.answer-option.is-correct {
  border-color: #19c37d !important;
  box-shadow: 0 0 0 2px #19c37d inset !important;
}

.hero-title{
  white-space: nowrap;          /* never wrap */
  font-weight: 800;
  line-height: 1.1;
  text-align: center;

  /* responsive size that shrinks to fit smaller viewports */
  font-size: clamp(22px, 5vw, 48px);
  /* optional safety to avoid overflow on very small screens */
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 18px;
}

/* Match styling for action buttons */
.admin-btn {
  display: inline-block;
  padding: 12px 20px;         /* more padding */
  margin: 6px 0;              /* space between buttons */
  font-size: 15px;            /* consistent font size */
  font-weight: 600;
  border-radius: 6px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

/* Primary blue style */
.admin-btn.primary {
  background-color: #2b55d4;   /* match your theme blue */
  color: #fff;
  border: none;
}

/* Normalize all .btn heights site-wide */
.btn, a.btn, button.btn { height:44px; padding:0 16px; line-height:1; display:inline-flex; align-items:center; justify-content:center; }

.admin-btn.primary:hover {
  background-color: #254abb;   /* darker hover */
}

.sortable-th {
  cursor: pointer;
  user-select: none;
}

.sortable-th::after {
  content: " ⇅";
  opacity: 0.35;
  font-size: 0.85em;
}

@media (min-width:980px){
  .controls-row{ grid-template-columns: repeat(6, minmax(0,1fr)); }

}