/* ===== Content Protection ===== */
/* .qbank-section user-select rules are merged into the main .qbank-section block below */

/* Hide content when printing */
@media print {
  body * {
    display: none !important;
    visibility: hidden !important;
  }
  body::after {
    content: 'Printing is not allowed. © SHOS Med Global';
    display: block !important;
    visibility: visible !important;
    font-size: 2rem;
    text-align: center;
    padding: 100px 20px;
    color: #333;
  }
}

/* Blur overlay when window loses focus (screenshot deterrent) */
.content-protected-blur .qbank-section {
  filter: blur(20px);
  pointer-events: none;
}

.screenshot-warning {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10, 25, 49, 0.95);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: #fff;
  font-size: 1.3rem;
  font-weight: 600;
  padding: 40px;
}

.content-protected-blur .screenshot-warning {
  display: flex;
}

/* Watermark overlay for explanation content */
.quiz-explanation,
.review-card {
  position: relative;
}
.quiz-explanation::after,
.review-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0.07;
  background-repeat: repeat;
  background-size: 300px 160px;
}

/* Screenshot flash overlay */
.qb-screenshot-flash {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #fff;
  z-index: 99999;
  display: none;
  pointer-events: none;
}
.qb-screenshot-flash.active {
  display: block;
}

/* Content protection notice for explanations */
.qb-protection-notice {
  font-size: 0.7rem;
  color: #9ca3af;
  margin-top: 8px;
  letter-spacing: 0.02em;
}

/* Sample Banner removed — QBank is fully free for all registered users */

/* ===== Question Bank Section ===== */
/* Note: user-select:none for .qbank-section is defined above in Content Protection */
.qbank-section {
  min-height: 100vh;
  padding: 20px 0 40px;
  background: var(--gray-50);
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* ===== Start Screen ===== */
.qbank-start {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
  padding-top: 8px;
}

.qbank-start-header {
  margin-bottom: 20px;
}

.qbank-start-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  color: var(--navy);
  margin-bottom: 6px;
}

.qbank-start-header h1 span {
  color: var(--accent);
}

.qbank-start-header p {
  color: var(--gray-500);
  font-size: 1.05rem;
  max-width: 520px;
  margin: 0 auto;
}

/* Subject Selection Grid */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.subject-card {
  cursor: pointer;
}

.subject-card input[type="checkbox"] {
  display: none;
}

.subject-card-inner {
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  text-align: center;
  transition: var(--transition);
  position: relative;
}

.subject-card-inner::after {
  content: '';
  position: absolute;
  top: 12px;
  right: 12px;
  width: 22px;
  height: 22px;
  border: 2px solid var(--gray-300);
  border-radius: 6px;
  transition: var(--transition);
}

.subject-card input:checked + .subject-card-inner {
  border-color: var(--accent);
  background: rgba(207, 91, 46, 0.03);
  box-shadow: 0 0 0 3px rgba(207, 91, 46, 0.1);
}

.subject-card input:checked + .subject-card-inner::after {
  background: var(--accent);
  border-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
  background-size: 14px;
  background-position: center;
  background-repeat: no-repeat;
}

.subject-card:hover .subject-card-inner {
  border-color: var(--gray-300);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.subject-card input:checked:hover + .subject-card-inner {
  border-color: var(--accent);
}

.subject-icon {
  font-size: 2.2rem;
  display: block;
  margin-bottom: 10px;
}

.subject-card-inner h3 {
  font-family: 'Inter', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
}

.subject-count {
  font-size: 0.85rem;
  color: var(--gray-400);
  font-weight: 500;
}

/* Overall Progress */
.overall-progress {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  border: 1px solid var(--gray-200);
  text-align: left;
}

.progress-stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.progress-label {
  font-weight: 700;
  color: var(--navy);
  font-size: 0.95rem;
}

.progress-numbers {
  font-weight: 600;
  color: var(--gray-500);
  font-size: 0.9rem;
}

.progress-bar-track {
  height: 10px;
  background: var(--gray-100);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #e8774a);
  border-radius: 8px;
  transition: width 0.6s ease;
}

.progress-detail-row {
  display: flex;
  gap: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

.progress-correct { color: var(--green); }
.progress-wrong { color: var(--red); }
.progress-remaining { color: var(--gray-400); }

/* Reset Section */
.reset-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-200);
  text-align: center;
}

.reset-note {
  font-size: 0.8rem;
  color: var(--gray-400);
  margin-top: 8px;
}

/* Start Options */
.start-options {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 28px;
  border: 1px solid var(--gray-200);
  text-align: left;
}

.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 0.95rem;
  color: var(--gray-600);
}

.option-row + .option-row {
  border-top: 1px solid var(--gray-100);
  margin-top: 8px;
  padding-top: 16px;
}

.option-row select {
  padding: 8px 14px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  color: var(--gray-700);
  background: var(--white);
  cursor: pointer;
}

.option-row select:focus {
  outline: none;
  border-color: var(--accent);
}

.option-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-right: 10px;
  accent-color: var(--accent);
  cursor: pointer;
}

.option-row label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 500;
}

.btn-lg {
  padding: 16px 48px;
  font-size: 1.1rem;
}

.start-note {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--gray-400);
}

/* ===== Quiz Screen ===== */
.qbank-quiz {
  max-width: 800px;
  margin: 0 auto;
}

/* Top Bar */
.quiz-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4px;
}

.quiz-progress {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-600);
}

.quiz-progress span:first-child {
  color: var(--accent);
  font-size: 1.1rem;
}

.quiz-subject-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(207, 91, 46, 0.08);
  color: var(--accent);
}

.quiz-score {
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  gap: 16px;
}

.score-correct {
  color: var(--green);
}

.score-wrong {
  color: var(--red);
}

/* Progress Bar */
.quiz-progress-bar {
  height: 4px;
  background: var(--gray-200);
  border-radius: 4px;
  margin-bottom: 24px;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.4s ease;
  width: 0%;
}

/* Question Card */
.quiz-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200);
  margin-bottom: 24px;
}

.quiz-topic {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gray-400);
  margin-bottom: 16px;
}

.quiz-question {
  font-size: 1.1rem;
  line-height: 1.75;
  color: var(--navy);
  font-weight: 500;
  margin-bottom: 28px;
}

/* Options */
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--gray-700);
  background: var(--white);
}

.quiz-option:hover:not(.disabled) {
  border-color: var(--gray-300);
  background: var(--gray-50);
}

.quiz-option .option-letter {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--gray-500);
  transition: var(--transition);
}

.quiz-option:hover:not(.disabled) .option-letter {
  background: var(--gray-200);
}

.quiz-option.selected {
  border-color: var(--accent);
  background: rgba(207, 91, 46, 0.03);
}

.quiz-option.selected .option-letter {
  background: var(--accent);
  color: var(--white);
}

/* After answering */
.quiz-option.correct {
  border-color: var(--green);
  background: rgba(45, 134, 89, 0.04);
}

.quiz-option.correct .option-letter {
  background: var(--green);
  color: var(--white);
}

.quiz-option.wrong {
  border-color: var(--red);
  background: rgba(220, 38, 38, 0.04);
}

.quiz-option.wrong .option-letter {
  background: var(--red);
  color: var(--white);
}

.quiz-option.disabled {
  cursor: default;
  opacity: 0.7;
}

.quiz-option.correct.disabled,
.quiz-option.wrong.disabled {
  opacity: 1;
}

/* Explanation */
.quiz-explanation {
  margin-top: 28px;
  padding: 28px;
  border-radius: var(--radius);
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.explanation-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 1.1rem;
  font-weight: 700;
}

.explanation-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--white);
}

.explanation-header.correct-header .explanation-icon {
  background: var(--green);
}

.explanation-header.correct-header #explanationTitle {
  color: var(--green);
}

.explanation-header.wrong-header .explanation-icon {
  background: var(--red);
}

.explanation-header.wrong-header #explanationTitle {
  color: var(--red);
}

.explanation-content {
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--gray-700);
  position: relative;
  overflow: hidden;
}

/* Watermark overlay (injected by JS) sits behind content */
.explanation-content > *:not(.qb-watermark-overlay) {
  position: relative;
  z-index: 1;
}

.review-explanation > *:not(.qb-watermark-overlay) {
  position: relative;
  z-index: 1;
}

.explanation-content h4 {
  font-size: 1rem;
  color: var(--navy);
  margin-top: 28px;
  margin-bottom: 14px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-200);
}

.explanation-content h4:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.explanation-content p {
  margin-bottom: 12px;
}

.explanation-content strong {
  color: var(--navy);
}

/* Explanation Tables */
.explanation-content .exp-table,
.review-explanation .exp-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.85rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--gray-200);
}

.explanation-content .exp-table th,
.review-explanation .exp-table th {
  background: var(--navy);
  color: var(--white);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.explanation-content .exp-table td,
.review-explanation .exp-table td {
  padding: 10px 14px;
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
}

.explanation-content .exp-table tr:nth-child(even) td,
.review-explanation .exp-table tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.02);
}

/* Explanation Diagrams */
.explanation-content .exp-diagram {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  margin: 16px 0;
  font-family: 'Inter', monospace;
  font-size: 0.9rem;
  line-height: 2;
  text-align: center;
}

.explanation-content .exp-diagram p {
  margin-bottom: 4px;
}

/* Key Concept Box */
.explanation-content .exp-key {
  background: rgba(207, 91, 46, 0.06);
  border-left: 4px solid var(--accent);
  padding: 14px 18px;
  margin-top: 24px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.9rem;
  color: var(--gray-700);
}

/* Key Educational Points list */
.explanation-content ul {
  margin-top: 8px;
  margin-bottom: 16px;
  padding-left: 20px;
}

.explanation-content li {
  margin-bottom: 6px;
}

/* Same spacing for review mode */
.review-explanation h4 {
  font-size: 1rem;
  color: var(--navy);
  margin-top: 28px;
  margin-bottom: 14px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-200);
}

.review-explanation h4:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.review-explanation .exp-key {
  background: rgba(207, 91, 46, 0.06);
  border-left: 4px solid var(--accent);
  padding: 14px 18px;
  margin-top: 24px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.9rem;
}

.review-explanation ul {
  margin-top: 8px;
  margin-bottom: 16px;
  padding-left: 20px;
}

.review-explanation li {
  margin-bottom: 6px;
}

/* Quiz Navigation */
.quiz-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.quiz-nav .btn {
  min-width: 140px;
}

/* ===== Results Screen ===== */
.qbank-results {
  max-width: 600px;
  margin: 0 auto;
}

.results-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200);
  text-align: center;
}

.results-card h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  color: var(--navy);
  margin-bottom: 32px;
}

/* Score Circle */
.results-score-circle {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 32px;
}

.results-score-circle svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score-bg {
  fill: none;
  stroke: var(--gray-200);
  stroke-width: 8;
}

.score-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 339.292;
  stroke-dashoffset: 339.292;
  transition: stroke-dashoffset 1s ease;
}

.score-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.score-percent {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--navy);
}

/* Stats */
.results-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--gray-100);
}

.stat-item {
  text-align: center;
}

.stat-num {
  display: block;
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.stat-correct .stat-num { color: var(--green); }
.stat-wrong .stat-num { color: var(--red); }
.stat-total .stat-num { color: var(--navy); }

.stat-label {
  font-size: 0.85rem;
  color: var(--gray-400);
  font-weight: 500;
}

/* Subject Breakdown */
.results-breakdown {
  text-align: left;
  margin-bottom: 32px;
}

.breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
}

.breakdown-row:last-child {
  border-bottom: none;
}

.breakdown-subject {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--navy);
  text-transform: capitalize;
}

.breakdown-bar {
  flex: 1;
  height: 8px;
  background: var(--gray-100);
  border-radius: 4px;
  margin: 0 16px;
  overflow: hidden;
}

.breakdown-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.6s ease;
}

.breakdown-score {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-500);
  min-width: 48px;
  text-align: right;
}

/* Results Actions */
.results-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== Review Screen ===== */
.qbank-review {
  max-width: 800px;
  margin: 0 auto;
}

.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.review-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  color: var(--navy);
}

.review-item {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}

.review-item-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.review-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--white);
}

.review-number.correct { background: var(--green); }
.review-number.wrong { background: var(--red); }

.review-item-header .review-topic {
  font-size: 0.8rem;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.review-question {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--navy);
  font-weight: 500;
  margin-bottom: 16px;
}

.review-answers {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.review-answer {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.review-answer.correct-answer {
  background: rgba(45, 134, 89, 0.06);
  color: var(--green);
  font-weight: 600;
}

.review-answer.wrong-answer {
  background: rgba(220, 38, 38, 0.06);
  color: var(--red);
  text-decoration: line-through;
  opacity: 0.7;
}

.review-answer.neutral {
  color: var(--gray-500);
}

.review-explanation {
  margin-top: 16px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--gray-700);
}

/* Start Buttons Row */
.start-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== Performance Screen ===== */
.qbank-performance {
  max-width: 900px;
  margin: 0 auto;
}

.perf-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.perf-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  color: var(--navy);
}

/* Stat Cards */
.perf-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.perf-stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
}

.perf-stat-number {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
}

.perf-stat-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: 4px;
}

.perf-stat-sub {
  font-size: 0.75rem;
  color: var(--gray-400);
}

.perf-score-good { color: var(--green) !important; }
.perf-score-mid { color: var(--gold, #f59e0b) !important; }
.perf-score-low { color: var(--red) !important; }

/* Subject Performance */
.perf-section {
  margin-bottom: 32px;
}

.perf-section h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--gray-100);
}

.perf-subject-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.perf-subject-row {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.perf-subject-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 130px;
  font-size: 0.95rem;
}

.perf-subject-stats {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.perf-mini-bar {
  flex: 1;
  height: 8px;
  background: var(--gray-100);
  border-radius: 4px;
  overflow: hidden;
  min-width: 80px;
}

.perf-mini-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.perf-subject-pct {
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 40px;
  text-align: right;
  color: var(--navy);
}

.perf-subject-detail {
  font-size: 0.8rem;
  color: var(--gray-400);
  min-width: 160px;
}

/* Test History Table */
.perf-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  background: var(--white);
}

.perf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.perf-table thead {
  background: var(--navy);
  color: var(--white);
}

.perf-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.perf-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

.perf-table tbody tr:hover {
  background: var(--gray-50);
}

.perf-table td small {
  color: var(--gray-400);
  font-size: 0.75rem;
}

.perf-empty {
  text-align: center;
  padding: 40px 20px !important;
  color: var(--gray-400);
  font-style: italic;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .qbank-start-header h1 {
    font-size: 1.8rem;
  }

  .subject-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .subject-card-inner {
    padding: 20px 14px;
  }

  .quiz-card {
    padding: 24px;
  }

  .quiz-topbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .results-card {
    padding: 32px 24px;
  }

  .results-stats {
    gap: 24px;
  }

  .review-item {
    padding: 24px;
  }

  .perf-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .perf-subject-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .perf-subject-stats {
    width: 100%;
    flex-wrap: wrap;
  }

  .perf-subject-detail {
    width: 100%;
    min-width: auto;
  }

  .perf-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .start-buttons {
    flex-direction: column;
    width: 100%;
  }

  .start-buttons .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .subject-grid {
    grid-template-columns: 1fr;
  }

  .quiz-nav {
    flex-direction: column;
  }

  .quiz-nav .btn {
    width: 100%;
  }

  .results-actions {
    flex-direction: column;
  }

  .results-actions .btn {
    width: 100%;
  }

  .perf-stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ===== Test History on Start Screen ===== */
.test-history-section {
  margin: 24px 0;
}

.test-history-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 12px;
}

.test-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}

.test-history-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 16px;
  transition: box-shadow 0.2s;
}

.test-history-row:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.th-name-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.th-name {
  font-weight: 500;
  color: var(--navy);
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.th-rename-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 4px;
  opacity: 0.4;
  transition: opacity 0.2s;
}

.th-rename-btn:hover {
  opacity: 1;
}

.th-inline-rename {
  width: 100%;
  padding: 3px 8px;
  border: 2px solid var(--accent);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: 'Inter', sans-serif;
  color: var(--navy);
  background: var(--white);
  outline: none;
  box-shadow: 0 0 0 3px rgba(207, 91, 46, 0.15);
}

.th-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.th-score {
  font-weight: 700;
  font-size: 1rem;
  min-width: 40px;
  text-align: right;
}

.th-score.score-good { color: var(--green, #16a34a); }
.th-score.score-mid { color: var(--gold, #f59e0b); }
.th-score.score-low { color: var(--red, #dc2626); }

.th-detail {
  color: #6b7280;
  font-size: 0.85rem;
  white-space: nowrap;
}

.th-subjects {
  color: #9ca3af;
  font-size: 0.8rem;
  white-space: nowrap;
}

.th-mode {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 50px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.th-mode-test {
  background: #1B2A4A;
  color: #fff;
}

.th-mode-review {
  background: #e8f5e9;
  color: #2d8659;
}

.th-review-btn {
  background: #CF5B2E;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 5px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.th-review-btn:hover {
  background: #b84e27;
}

@media (max-width: 600px) {
  .test-history-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .th-stats {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ===== Report Issue ===== */
.report-btn-wrap {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.report-btn {
  background: none;
  border: 1px solid var(--gray-300, #d1d5db);
  color: var(--gray-500, #6b7280);
  font-size: 0.78rem;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.report-btn:hover {
  border-color: #e8784a;
  color: #e8784a;
}

.report-thanks {
  font-size: 0.78rem;
  color: var(--accent, #2ba89e);
  font-weight: 500;
}

.report-form {
  background: var(--gray-50, #f9fafb);
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: 10px;
  padding: 16px;
  margin-top: 12px;
}

.report-form-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 10px;
  color: var(--gray-800, #1f2937);
}

.report-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.report-option {
  font-size: 0.85rem;
  color: var(--gray-600, #4b5563);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-option input[type="radio"] {
  accent-color: #e8784a;
}

.report-textarea {
  width: 100%;
  border: 1px solid var(--gray-300, #d1d5db);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.85rem;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 10px;
}

.report-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.report-cancel {
  font-size: 0.82rem !important;
  padding: 6px 14px !important;
}

.report-submit {
  font-size: 0.82rem !important;
  padding: 6px 14px !important;
}

/* ===== Text Highlighter ===== */

/* Allow text selection inside explanation areas */
#explanationContent,
.review-explanation {
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
  cursor: text;
}

mark.user-highlight {
  color: inherit;
  padding: 1px 0;
  border-radius: 2px;
  cursor: pointer;
  transition: opacity 0.15s;
}

mark.user-highlight[data-hl-color="yellow"] { background: #fef08a; }
mark.user-highlight[data-hl-color="green"] { background: #86efac; }
mark.user-highlight[data-hl-color="blue"] { background: #93c5fd; }
mark.user-highlight[data-hl-color="pink"] { background: #fda4af; }

mark.user-highlight:hover {
  opacity: 0.7;
}

/* Highlight color picker toolbar */
.qbank-hl-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 0.8rem;
  color: #6b7280;
  flex-wrap: wrap;
}

.qbank-hl-bar span.hl-label {
  font-weight: 600;
  margin-right: 4px;
}

.qbank-hl-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.qbank-hl-swatch:hover {
  transform: scale(1.2);
}

.qbank-hl-swatch.selected {
  border-color: #1B2A4A;
  box-shadow: 0 0 0 2px rgba(27,42,74,0.2);
}

/* ===== Test Mode: Mode Selector on Start Screen ===== */
.mode-selector-row {
  flex-direction: column;
  align-items: flex-start !important;
  gap: 10px;
}

.mode-selector-row > label {
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 4px;
}

.mode-toggle {
  display: flex;
  gap: 12px;
  width: 100%;
}

.mode-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 12px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  background: var(--white);
}

.mode-option:hover {
  border-color: var(--gray-300);
  background: var(--gray-50);
}

.mode-option input[type="radio"] {
  display: none;
}

.mode-option input[type="radio"]:checked ~ .mode-label {
  color: var(--accent);
}

.mode-option input[type="radio"]:checked ~ .mode-desc {
  color: var(--gray-600);
}

.mode-option:has(input:checked),
.mode-option-active {
  border-color: var(--accent);
  background: rgba(207, 91, 46, 0.03);
  box-shadow: 0 0 0 3px rgba(207, 91, 46, 0.1);
}

.mode-label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--gray-600);
  margin-bottom: 4px;
  transition: color 0.2s;
}

.mode-desc {
  font-size: 0.78rem;
  color: var(--gray-400);
  line-height: 1.3;
  transition: color 0.2s;
}

/* Test time info row */
.test-time-info {
  background: rgba(207, 91, 46, 0.05);
  border-radius: var(--radius);
  padding: 10px 16px !important;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: none !important;
  margin-top: 0 !important;
}

.time-info-icon {
  font-size: 1.1rem;
}

.time-info-text {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.9rem;
}

/* ===== Test Mode: Countdown Timer ===== */
.test-timer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 16px;
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  width: fit-content;
  margin-left: auto;
}

.timer-icon {
  font-size: 1.1rem;
}

.timer-display {
  font-family: 'Inter', monospace;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: 1px;
  min-width: 65px;
  text-align: center;
}

.test-timer.timer-danger {
  border-color: var(--red);
  background: rgba(220, 38, 38, 0.05);
}

.test-timer.timer-danger .timer-display {
  color: var(--red);
  animation: timerPulse 1s ease-in-out infinite;
}

@keyframes timerPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== Test Mode: Question Navigator ===== */
.question-navigator {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  justify-content: center;
}

.nav-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--gray-200);
  background: var(--white);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gray-400);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.nav-dot:hover {
  border-color: var(--gray-400);
  background: var(--gray-50);
}

.nav-dot-current {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(207, 91, 46, 0.15);
}

.nav-dot-answered {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
}

.nav-dot-current.nav-dot-answered {
  box-shadow: 0 0 0 3px rgba(207, 91, 46, 0.3);
}

/* ===== Test Mode: Finish Test Button ===== */
.btn-finish-test {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--navy);
  color: var(--white);
  transition: var(--transition);
  letter-spacing: 0.3px;
}

.btn-finish-test:hover {
  background: #162d50;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* ===== Test Mode: Timer Warning Modal ===== */
.timer-warning-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 25, 49, 0.7);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.timer-warning-content {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.timer-warning-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 16px;
}

.timer-warning-content h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  color: var(--red);
  margin-bottom: 8px;
}

.timer-warning-content p {
  color: var(--gray-500);
  font-size: 0.95rem;
  margin-bottom: 20px;
}

/* ===== Test Mode: Time stat in results ===== */
.stat-time .stat-num {
  color: var(--navy);
  font-size: 1.4rem;
}

/* ===== Review: Unanswered badge ===== */
.review-unanswered-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(220, 38, 38, 0.08);
  color: var(--red);
  margin-left: auto;
}

/* ===== Responsive: Test Mode ===== */
@media (max-width: 768px) {
  .mode-toggle {
    flex-direction: column;
  }

  .test-timer {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }

  .question-navigator {
    gap: 4px;
    padding: 10px 12px;
  }

  .nav-dot {
    width: 30px;
    height: 30px;
    font-size: 0.7rem;
  }

  .timer-warning-content {
    margin: 20px;
    padding: 28px 24px;
  }
}

@media (max-width: 480px) {
  .nav-dot {
    width: 28px;
    height: 28px;
    font-size: 0.65rem;
  }
}
