/* Modern Quiz Interface Styles */

/* Reset and base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #333;
  background: #f5f5f5;
  min-height: 100vh;
}

/* Header */
.header {
  background: white;
  padding: 1.5rem 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.logo {
  height: 50px;
  width: auto;
}

.header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  color: #1f407a;
  margin: 0;
}

.header-link {
  font-size: 0.95rem;
  color: #1f407a;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
  margin-left: auto;
}

.header-link:hover {
  color: #163058;
  text-decoration: underline;
}

/* Quiz container */
.quiz-container {
  max-width: 900px;
  margin: 2rem auto;
  padding: 2rem;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.1);
}

/* Instructions */
.instructions {
  font-size: 1.05rem;
  color: #666;
  margin-bottom: 2rem;
  text-align: center;
}

/* Topic selection */
.topic-selection {
  display: flex;
  gap: 1rem;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.topic-checkbox {
  flex: 1;
  min-width: 250px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
}

.topic-checkbox:hover {
  border-color: #1f407a;
  background: #f8f9fa;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(31, 64, 122, 0.1);
}

.topic-checkbox input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #1f407a;
}

.topic-checkbox span {
  font-size: 1rem;
  font-weight: 500;
  color: #333;
}

/* Button styles */
.btn-container {
  text-align: center;
  margin: 2rem 0;
}

.btn {
  padding: 0.875rem 2rem;
  background: #1f407a;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(31, 64, 122, 0.2);
}

.btn:hover {
  background: #163058;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(31, 64, 122, 0.3);
}

.btn:active {
  transform: translateY(0);
}

/* ============================================================
   QUESTION AREA LAYOUT

   The JS engine uses absolute positioning with transparent spacer
   GIFs inside #Qimg and #Qlb1-4 to overlay numbered labels on
   the histology image. All five divs share the same absolute
   origin; the spacer GIF widths/heights push each label to its
   correct pixel position.

   Original page layout (absolute to body):
     #Qinterface  top: 675px   (question text + answers FIRST)
     #Qimg/labels  top: 950px   (image with labels BELOW answers)

   Modern layout: .question-area is the positioning context.
   #Qinterface is in normal flow (answers first).
   #Qimg and labels are absolute, pushed below via top offset.
   ============================================================ */

.question-area {
  position: relative;
  margin-top: 2rem;
}

/* Question interface: normal flow, comes first */
#Qinterface {
  position: relative;
  width: auto;
}

#Qinterface table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

#Qinterface td {
  padding: 0.75rem;
}

/* Question text */
#Qinterface .text {
  font-size: 1.1rem;
  line-height: 1.7;
  color: #333;
}

#Qinterface .title {
  font-size: 1.4rem;
  font-weight: 600;
  color: #1f407a;
  margin-bottom: 1rem;
  display: block;
}

/* Answer options */
#Qinterface input[type="radio"],
#Qinterface input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-right: 0.5rem;
  cursor: pointer;
  accent-color: #1f407a;
}

#Qinterface label {
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 6px;
  transition: background 0.2s;
  display: inline-block;
}

#Qinterface label:hover {
  background: #f8f9fa;
}

/* Navigation buttons in quiz */
#Qinterface input[type="button"],
#Qinterface button {
  padding: 0.625rem 1.5rem;
  background: #1f407a;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin: 0.25rem;
}

#Qinterface input[type="button"]:hover,
#Qinterface button:hover {
  background: #163058;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(31, 64, 122, 0.3);
}

/* Image + label stack.
   .image-stack is the positioning context.
   #Qimg is position:relative so it reserves vertical space in the flow.
   #Qlb1-4 are position:absolute so they overlay #Qimg exactly. */
.image-stack {
  position: relative;
  width: 628px;
  margin: 1rem auto 2rem;
}

#Qimg {
  position: relative;
  width: 628px;
}

#Qlb1, #Qlb2, #Qlb3, #Qlb4 {
  position: absolute;
  top: 0;
  left: 0;
  width: 628px;
  height: 450px;
  pointer-events: none; /* let clicks pass through to image below */
}

/* Pixel-perfect positioning fix for JS spacer GIF mechanism
   The JS engine uses transparent spacer GIFs with specific dimensions
   to position labels. Font-size and line-height must match the original
   to prevent vertical shifts. */
#Qimg, #Qlb1, #Qlb2, #Qlb3, #Qlb4 {
  font-size: 11px;
  line-height: 13px;
}

/* Histology images - NOT spacer GIFs */
#Qimg img[src$=".jpg"],
#Qimg img[src$=".png"] {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Feedback styling */
#Qinterface .correct {
  color: #28a745;
  font-weight: 600;
}

#Qinterface .incorrect {
  color: #dc3545;
  font-weight: 600;
}

/* Legacy class overrides */
.text {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
}

.mini {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.875rem;
  line-height: 1.4;
}

.inactive {
  color: #999;
}

a {
  text-decoration: none;
  color: #1f407a;
  font-weight: 500;
}

a:hover {
  color: #163058;
  text-decoration: underline;
}

/* Responsive design */
@media (max-width: 768px) {
  .quiz-container {
    margin: 1rem;
    padding: 1.5rem;
  }

  .header {
    padding: 1rem;
  }

  .header h1 {
    font-size: 1.4rem;
  }

  .topic-selection {
    flex-direction: column;
  }

  .topic-checkbox {
    min-width: 100%;
  }

  .image-stack,
  .image-stack > div {
    width: 100%;
  }
}

/* Footer */
.footer {
  background: white;
  padding: 2rem;
  margin-top: 3rem;
  text-align: center;
  border-top: 1px solid #e0e0e0;
  color: #666;
  font-size: 0.9rem;
  line-height: 1.6;
}

.footer p {
  margin: 0.5rem 0;
}

.footer a {
  color: #1f407a;
  text-decoration: none;
  font-weight: 500;
}

.footer a:hover {
  color: #163058;
  text-decoration: underline;
}
