/* common.css — shared base styles, typography, modals, header, footer */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: Arial, Verdana, Geneva, sans-serif;
  font-size: 14px;
  color: #222;
  background: #f0f0f0;
  overflow-x: hidden;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
.exam-header {
  background: #2c2c2c;
  color: #fff;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  flex-shrink: 0;
  z-index: 100;
}

.header-left .header-exam-name {
  color: #ffd700;
  font-weight: bold;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 4px 10px;
  cursor: pointer;
  border-radius: 3px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background 0.15s;
}
.header-btn:hover { background: rgba(255,255,255,0.12); }
.header-btn:focus-visible { outline: 2px solid #ffd700; }

.header-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: bold;
}
.inst-icon  { background: #1a73e8; color: #fff; }
.qp-icon    { background: #22a95a; color: #fff; }

.candidate-info {
  display: flex;
  align-items: center;
  gap: 8px;
  border-left: 1px solid rgba(255,255,255,0.25);
  padding-left: 10px;
}
.candidate-avatar {
  width: 34px;
  height: 34px;
  background: #555;
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.3);
}
.candidate-avatar svg,
.candidate-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.candidate-name {
  font-size: 13px;
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Footer ─────────────────────────────────────────────────────────────────── */
.exam-footer {
  background: #617B8C;
  color: #fff;
  text-align: center;
  font-size: 11px;
  height: 22px;
  line-height: 22px;
  padding: 0;
  flex-shrink: 0;
}

/* ── Modals ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-box {
  background: #fff;
  border-radius: 5px;
  max-width: 720px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

.modal-header {
  background: #1a73e8;
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 5px 5px 0 0;
  flex-shrink: 0;
}
.modal-header h2 { font-size: 15px; font-weight: bold; }

.modal-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
}
.modal-close:hover { color: #ffd700; }
.modal-close:focus-visible { outline: 2px solid #ffd700; }

.modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  font-size: 13px;
  line-height: 1.6;
}
.modal-body h4 { margin: 12px 0 6px; color: #1a73e8; }
.modal-body ul { padding-left: 20px; }
.modal-body ul li { margin-bottom: 5px; }
.modal-body kbd {
  background: #eee;
  border: 1px solid #bbb;
  border-radius: 3px;
  padding: 1px 5px;
  font-family: monospace;
  font-size: 12px;
}

.modal-footer {
  padding: 10px 16px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid #eee;
  flex-shrink: 0;
}

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn-primary {
  background: #1a73e8;
  color: #fff;
  border: none;
  padding: 8px 20px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s;
}
.btn-primary:hover  { background: #1557b0; }
.btn-primary:disabled { background: #aaa; cursor: not-allowed; }
.btn-primary:focus-visible { outline: 2px solid #ffd700; }

.btn-secondary {
  background: #fff;
  color: #333;
  border: 1px solid #bbb;
  padding: 8px 20px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 13px;
  transition: background 0.15s;
}
.btn-secondary:hover { background: #f5f5f5; }
.btn-secondary:focus-visible { outline: 2px solid #1a73e8; }

.btn-danger {
  background: #e05353;
  color: #fff;
  border: none;
  padding: 8px 20px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
}
.btn-danger:hover { background: #c94040; }

/* ── Summary table (submit modal) ───────────────────────────────────────────── */
.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 10px;
}
.summary-table th, .summary-table td {
  border: 1px solid #ddd;
  padding: 6px 10px;
  text-align: left;
}
.summary-table th { background: #1a73e8; color: #fff; }
.summary-table tr:nth-child(even) { background: #f8f8f8; }
.text-center { text-align: center !important; }
.summary-note {
  font-size: 12px;
  color: #555;
  background: #fffbe6;
  padding: 8px;
  border-left: 3px solid #f90;
}

/* ── Instruction screen legend ───────────────────────────────────────────────── */
.legend-static {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0;
  font-size: 13px;
}
.legend-static div { display: flex; align-items: center; gap: 8px; }

/* ── Inst table ─────────────────────────────────────────────────────────────── */
.inst-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 13px;
}
.inst-table th, .inst-table td {
  border: 1px solid #ddd;
  padding: 6px 10px;
}
.inst-table th { background: #e8f0fb; }

/* ── Palette shapes (real TCS iON sprite sheet) ─────────────────────────────── */
.legend-icon {
  background-image: url('../img/questions-sprite.png');
  background-repeat: no-repeat;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  font-weight: bold;
  text-align: center;
  flex-shrink: 0;
}

.icon-answered {
  background-position: -7px -55px;
  width: 29px;
  height: 26px;
  line-height: 22px;
}

.icon-not-answered {
  background-position: -42px -56px;
  width: 29px;
  height: 26px;
  line-height: 22px;
}

.icon-not-visited {
  background-position: -107px -56px;
  width: 29px;
  height: 26px;
  line-height: 21px;
  color: #000;
}

.icon-marked {
  background-position: -75px -54px;
  width: 29px;
  height: 26px;
  line-height: 18px;
}

.icon-answered-marked {
  background-position: -9px -87px;
  width: 29px;
  height: 26px;
  line-height: 15px;
}

/* Palette button sprite shapes */
.palette-btn {
  background-image: url('../img/questions-sprite.png');
  background-repeat: no-repeat;
  border: none;
  background-color: transparent;
  color: #fff;
  cursor: pointer;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  font-weight: bold;
  height: 43px;
  width: 49px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  padding: 0;
  text-align: center;
  line-height: 40px;
  box-sizing: border-box;
}

.btn-answered {
  background-position: -4px -5px;
  color: #fff;
}
.btn-answered:hover {
  background-position: -4px -126px;
}

.btn-not-answered {
  background-position: -57px -6px;
  color: #fff;
}
.btn-not-answered:hover {
  background-position: -57px -127px;
}

.btn-not-visited {
  background-position: -157px -4px;
  color: #474747;
}
.btn-not-visited:hover {
  background-position: -157px -4px;
}

.btn-marked {
  background-position: -108px -1px;
  color: #fff;
}
.btn-marked:hover {
  background-position: -108px -122px;
}

.btn-answered-marked {
  background-position: -66px -178px;
  color: #fff;
}
.btn-answered-marked:hover {
  background-position: -66px -178px;
}

/* Current question button: thin 2px outline, NO scale, NO size change */
.palette-btn.palette-btn-current {
  box-shadow: 0 0 0 2px #ffd700;
  z-index: 2;
}

/* ── Misc ────────────────────────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap;
}

/* Scrollbar thin */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f0f0f0; }
::-webkit-scrollbar-thumb { background: #bbb; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #999; }
