
/* Base styles */
body {
  font-family: 'Segoe UI', sans-serif;
  background-color: var(--bg);
  margin: 80px 20px 40px;
  color: var(--text);
}

:root {
  --bg: #f2f4f8;
  --text: #333;
  --card: #fff;
  --highlight: #18398A;
}

body.dark-mode {
  --bg: #121212;
  --text: #e0e0e0;
  --card: #1e1e1e;
  --highlight: #90caf9;
}

h1 {
  color: var(--highlight);
  text-align: center;
  margin-bottom: 40px;
}

/* Only the settings form should be capped/nicely framed */
#exam-settings {
  background: var(--card);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  margin-bottom: 30px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  overflow: visible;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  color: var(--text);
}

input[type="number"] {
  width: 80px;
  padding: 5px;
  margin-top: 5px;
}

button {
  background-color: #18398A;
  color: white;
  padding: 10px 18px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  margin-top: 10px;
}

button:hover {
  background-color: #2c4da5;
}

.question-block {
  background: var(--card);
  padding: 20px;
  border-radius: 10px;
  margin: 20px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.situation-container {
  background-color: #fbf8f8;
  padding: 18px 24px;
  border-radius: 12px;
  margin-bottom: 30px;
  scroll-margin-top: 120px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

body.dark-mode .situation-container {
  background-color: #2c2c2c;
}

.situation-container h3 {
  background-color: var(--card);
  display: inline-block;
  padding: 4px 10px;
  border: 2px solid #444;
  border-radius: 6px;
  font-size: 1.1rem;
  margin-bottom: 12px;
  color: var(--text);
}

.choice-box {
  display: block;
  padding: 12px;
  margin: 8px 0;
  border-radius: 8px;
  border: 2px solid #ccc;
  cursor: pointer;
  transition: background 0.3s, border-color 0.3s;
  background-color: #f9f9f9;
  color: var(--text);
}

body.dark-mode .choice-box {
  background-color: #2a2a2a;
  border-color: #555;
}

.choice-box:hover {
  background-color: #f0f0f0;
  border-color: #18398A;
}

.choice-box.selected {
  background-color: #dcefff;
  border-color: #18398A;
}

.correct {
  background-color: #c8f7c5 !important;
  border-color: #27ae60 !important;
}

.incorrect {
  background-color: #fdd !important;
  border-color: #e74c3c !important;
}

.correct-answer {
  font-style: italic;
  margin-top: 10px;
  color: #555;
}

/* Main layout */
#exam-layout {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-start;
  gap: 30px;
  max-width: 1400px;
  margin: auto;
  padding-bottom: 200px;
}

#exam-form {
  flex: 3;
  padding-right: 10px;
}

#sidebar-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 260px;
  width: 240px;
  background: var(--card);
  padding: 10px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Toggle button */
#toggle-sidebar {
  display: block;
  text-align: center;
  width: 100%;
  font-size: 0.9rem;
  background-color: #eee;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 6px;
  cursor: pointer;
  font-weight: bold;
  color: #333;
}

/* Sidebar collapse behavior */
#sidebar-controls.collapsed #sidebar-content {
  display: none;
}

#sidebar-controls #toggle-sidebar {
  background: #ccc;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  margin-bottom: 10px;
}

/* Tracker */
#situation-tracker-bar {
  background: var(--card);
  padding: 12px;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-height: 180px;
  overflow-y: auto;
}

.tracker-dot {
  padding: 4px 10px;
  border-radius: 10px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.3s, background-color 0.3s, border-color 0.3s;
  color: white;
}

.tracker-dot:hover {
  transform: scale(1.1);
}

.tracker-dot.incomplete {
  background-color: #e74c3c;
  border: 2px solid #e74c3c;
}

.tracker-dot.complete {
  background-color: #4caf50;
  border: 2px solid #4caf50;
}

.tracker-dot.partial {
  background-color: #3498db;
  border: 2px solid #3498db;
}

.tracker-dot.pulsing {
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(229, 57, 53, 0.7);
  }
  70% {
    transform: scale(1.08);
    box-shadow: 0 0 0 10px rgba(229, 57, 53, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(229, 57, 53, 0);
  }
}

/* Submit & score */
#fixed-submit {
  background: var(--card);
  padding: 10px 15px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  text-align: center;
  width: 100%;
}

#floating-score {
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 8px;
  color: var(--highlight);
}

#submit-btn {
  background-color: #18398A;
  color: white;
  font-weight: bold;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
}

#submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Scroll margin for anchor offset */
#exam-form > div {
  scroll-margin-top: 120px;
}

/* Desktop: floating sidebar bottom-right */
@media (min-width: 769px) {
  #sidebar-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    top: auto;
  }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  #exam-layout {
    flex-direction: column;
    padding: 0 10px 200px;
  }

  #sidebar-controls {
    position: fixed;
    bottom: 10px;
    top: auto;
    left: 50%;
    transform: translateX(-50%);
    max-width: 90vw;
    width: 90vw;
    background: var(--card);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 10px;
    border-radius: 12px;
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  #situation-tracker-bar {
    max-height: 140px;
    overflow-y: auto;
    padding: 8px;
    justify-content: center;
  }

  .tracker-dot {
    font-size: 0.8rem;
    padding: 3px 6px;
  }

  #submit-btn {
    font-size: 0.9rem;
    padding: 6px 10px;
  }
}

/* Smooth scroll when tracker dot is clicked */
html {
  scroll-behavior: smooth;
}

.highlight-answer {
  color: red;
  background-color: yellow;
  display: inline;
  padding: 0 2px; /* left/right padding */
  border-radius: 3px; /* optional, softer edges */
}

.answer-correct {
  background-color: #d1fad1;
  font-weight: bold;
}

#toggleTrackerBtn {
  background-color: #18398A;
  color: white;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: bold;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  margin-bottom: 8px;
}

.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 20px;
  margin-top: 8px;
}

.choice-box {
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out;
  background-color: #f9f9f9;
}

.choice-box:hover {
  background-color: #e0f3ff;
}

.choice-box.selected {
  background-color: #c7f0d9;
  border: 2px solid #4CAF50;
}

.choice-box.correct {
  background-color: #d4edda !important;
  border-color: #28a745;
}

.choice-box.incorrect {
  background-color: #f8d7da !important;
  border-color: #dc3545;
}

/* Tag control buttons */
.tag-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 4px;
}

.tag-btn {
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid #ccc;
  background-color: #f0f0f0;
  color: #000; /* visible text color */
  cursor: pointer;
}

.tag-btn:hover {
  background-color: #e0e0e0;
}

/* === Expand Exam: make the whole exam fill the lane ================== */

/* While expanded, remove the wrapper cap */
body.exam-expanded main {
  max-width: none !important;
  width: 100%;
}

/* Settings form wider when expanded */
body.exam-expanded #exam-settings {
  width: min(98vw, 1400px);
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

/* Live exam: uncap and center */
body.exam-expanded #exam-form {
  max-width: none !important;
  width: min(98vw, 1600px);
  margin-left: auto;
  margin-right: auto;
}

/* Ensure cards use the form’s full width */
body.exam-expanded #exam-form .situation-container,
body.exam-expanded #exam-form .question-block {
  width: 100%;
}

/* Keep right column hidden, left column flexible */
body.exam-expanded .right-column { display: none !important; }
body.exam-expanded .left-column  { flex: 1 1 100%; min-width: 0; }

/* Slightly more breathing room on wide screens */
body.exam-expanded .situation-container { padding-left: 24px; padding-right: 24px; }

/* Expand/Shrink button (already injected by JS) */
#expandExamBtn {
  background: #0b5;
  border: none;
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
}
#expandExamBtn:hover { filter: brightness(0.95); }
body.dark-mode #expandExamBtn { background: #16a34a; }

#img-zoom-overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; opacity: 0; background: rgba(0,0,0,0);
  z-index: 3000; -webkit-user-select: none; user-select: none;
  transition: opacity .15s ease, background-color .15s ease;
}
#img-zoom-overlay.show { pointer-events: auto; opacity: 1; background: rgba(0,0,0,.85); }

#img-zoom-overlay img {
  max-width: 92vw; max-height: 92vh;
  transform-origin: center; transform: scale(var(--scale,1));
  transition: transform .08s ease-out; cursor: zoom-out;
}

#exam-form .situation-container img { cursor: zoom-in; }

/* Hint pill */
#img-zoom-overlay .zoom-hint{
  position: absolute; top: 16px; left: 16px;
  background: #2563eb; color: #fff;
  font: 600 12px/1.2 system-ui, -apple-system, Segoe UI, Roboto, Inter, sans-serif;
  padding: 6px 10px; border-radius: 9999px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  pointer-events: none; opacity: 0; transform: translateY(-4px);
  transition: opacity .18s ease, transform .18s ease;
}
#img-zoom-overlay .zoom-hint.visible{ opacity: 1; transform: none; }

/* --- Keep choices inside their card (no horizontal spill) --- */
#exam-form .situation-container,
#exam-form .question-block,
#exam-form .choice-box {
  box-sizing: border-box;           /* include padding + border in width */
}

#exam-form .choice-box {
  width: 100%;
  max-width: 100%;
  margin: 8px 0;
  /* you can keep your existing padding/border/radius colors */
}

/* Prevent any sub-element from visually poking out of rounded corners */
#exam-form .situation-container,
#exam-form .question-block {
  overflow: hidden;                 /* clip to rounded edges */
}

/* Optional: tighten inner paddings a hair so borders never touch edges */
#exam-form .situation-container { padding-left: 20px; padding-right: 20px; }
#exam-form .question-block      { padding-left: 16px; padding-right: 16px; }

/* Situation images: centered, responsive, click affordance */
#exam-form .situation-container img {
  display: block;
  margin: 12px auto;       /* centers horizontally */
  max-width: 100%;
  height: auto;
  cursor: zoom-in;
}

/* Keep them inside rounded cards */
#exam-form .situation-container,
#exam-form .question-block {
  overflow: hidden;
  box-sizing: border-box;
}
/* Offsets are computed by JS */
:root{
  --ad-bottom-offset: 0px;
  --ad-right-offset: 0px;
}

/* Your floating controls */
#sidebar-controls{
  position: fixed;
  right: calc(var(--ad-right-offset, 0px) + 16px);
  bottom: calc(var(--ad-bottom-offset, 0px) + env(safe-area-inset-bottom, 0px) + 16px);
  z-index: 2147483646;            /* just below the absolute max used by some ads */
  pointer-events: auto;
  max-height: calc(100vh - 24px - var(--ad-bottom-offset, 0px));
}

/* Make the inside scroll instead of being cut off */
#sidebar-controls #sidebar-content{
  max-height: inherit;
  overflow: auto;
}



