/* === Truly Free Testing — Stylesheet === */

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: #1a1a1a;
  background: #fff;
  min-height: 100vh;
}

a {
  color: #2563eb;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Layout */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  border-bottom: 1px solid #e5e7eb;
  padding: 16px 0;
  margin-bottom: 32px;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header h1 {
  font-size: 1.1rem;
  font-weight: 600;
}

.site-header h1 a {
  color: #1a1a1a;
}

.site-header h1 a:hover {
  text-decoration: none;
}

.site-header nav a {
  margin-left: 20px;
  font-size: 0.9rem;
  color: #6b7280;
}

.site-header nav a:hover {
  color: #1a1a1a;
}

/* Hero (index page) */
.hero {
  text-align: center;
  padding: 48px 0 32px;
}

.hero h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.hero p {
  color: #6b7280;
  font-size: 1.1rem;
}

/* Exam Cards */
.exam-list {
  display: grid;
  gap: 16px;
  margin: 32px 0;
}

.exam-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 24px;
  display: block;
  color: #1a1a1a;
  transition: border-color 0.15s;
}

.exam-card:hover {
  border-color: #2563eb;
  text-decoration: none;
}

.exam-card h3, .exam-card h4 {
  font-size: 1.2rem;
  margin-bottom: 4px;
}

.exam-card p {
  color: #6b7280;
  font-size: 0.9rem;
}

/* Section Titles (exam categories on index) */
.exam-section {
  margin-bottom: 16px;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  padding-top: 16px;
}

/* Select Page */
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.page-subtitle {
  color: #6b7280;
  margin-bottom: 32px;
}

.test-list {
  display: grid;
  gap: 16px;
  margin-bottom: 48px;
}

.test-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 24px;
}

.test-card h3 {
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.test-card .test-info {
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 16px;
}

.test-card .test-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  text-align: center;
  line-height: 1.4;
  text-decoration: none;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-secondary {
  background: #f3f4f6;
  color: #1a1a1a;
  border: 1px solid #e5e7eb;
}

.btn-secondary:hover {
  background: #e5e7eb;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Test Page */
.test-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 8px;
}

.test-header .test-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.test-header .test-meta {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 0.85rem;
  color: #6b7280;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #1a1a1a;
}

.timer.warning {
  color: #f59e0b;
}

.timer.danger {
  color: #dc2626;
}

/* Question */
.question-area {
  margin-bottom: 32px;
}

.question-number {
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 8px;
}

.question-text {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 20px;
  line-height: 1.5;
}

.choices {
  list-style: none;
  display: grid;
  gap: 10px;
}

.choice-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1.4;
  transition: border-color 0.1s;
}

.choice-btn:hover {
  border-color: #2563eb;
  background: #f8fafc;
}

.choice-btn.selected {
  border-color: #2563eb;
  background: #eff6ff;
}

.choice-btn.correct {
  border-color: #16a34a;
  background: #f0fdf4;
}

.choice-btn.incorrect {
  border-color: #dc2626;
  background: #fef2f2;
}

.choice-btn.disabled {
  pointer-events: none;
}

.choice-label {
  font-weight: 600;
  margin-right: 8px;
}

/* Explanation */
.explanation {
  margin-top: 16px;
  padding: 16px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.explanation strong {
  display: block;
  margin-bottom: 4px;
}

.explanation.correct-msg {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.explanation.incorrect-msg {
  border-color: #fecaca;
  background: #fef2f2;
}

/* Navigation */
.test-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-top: 1px solid #e5e7eb;
  margin-top: 24px;
}

.test-nav .btn {
  min-width: 100px;
}

/* Question Grid */
.question-grid-toggle {
  font-size: 0.85rem;
  color: #2563eb;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px 0;
}

.question-grid-toggle:hover {
  text-decoration: underline;
}

.question-grid {
  display: none;
  margin: 16px 0;
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f9fafb;
}

.question-grid.open {
  display: block;
}

.question-grid-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.q-dot {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  background: #fff;
}

.q-dot:hover {
  border-color: #2563eb;
}

.q-dot.answered {
  background: #dbeafe;
  border-color: #93c5fd;
}

.q-dot.current {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.q-dot.correct-dot {
  background: #bbf7d0;
  border-color: #16a34a;
}

.q-dot.incorrect-dot {
  background: #fecaca;
  border-color: #dc2626;
}

/* Results Page */
.results-summary {
  text-align: center;
  padding: 48px 0 32px;
}

.results-score {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.results-percentage {
  font-size: 1.3rem;
  color: #6b7280;
  margin-bottom: 12px;
}

.results-verdict {
  font-size: 1.1rem;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 20px;
  display: inline-block;
}

.results-verdict.pass {
  background: #f0fdf4;
  color: #16a34a;
}

.results-verdict.fail {
  background: #fef2f2;
  color: #dc2626;
}

.results-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 24px 0 32px;
  flex-wrap: wrap;
}

/* Review Section */
.review-section {
  border-top: 1px solid #e5e7eb;
  padding-top: 32px;
}

.review-section h2 {
  font-size: 1.3rem;
  margin-bottom: 24px;
}

.review-question {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}

.review-question .question-number {
  font-weight: 600;
  color: #1a1a1a;
}

.review-question .question-text {
  font-size: 1rem;
  margin-bottom: 12px;
}

.review-choices {
  list-style: none;
  margin-bottom: 12px;
}

.review-choices li {
  padding: 6px 10px;
  margin-bottom: 4px;
  border-radius: 4px;
  font-size: 0.9rem;
}

.review-choices li.user-correct {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.review-choices li.user-incorrect {
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.review-choices li.correct-answer {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.review-explanation {
  font-size: 0.85rem;
  color: #4b5563;
  padding: 12px;
  background: #f9fafb;
  border-radius: 4px;
}

/* Footer */
.site-footer {
  border-top: 1px solid #e5e7eb;
  padding: 24px 0;
  margin-top: 64px;
  text-align: center;
  font-size: 0.8rem;
  color: #9ca3af;
}

/* Confirmation modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 8px;
  padding: 32px;
  max-width: 400px;
  width: 90%;
  text-align: center;
}

.modal h3 {
  margin-bottom: 8px;
}

.modal p {
  color: #6b7280;
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.modal .modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* Practice mode score banner */
.practice-complete {
  text-align: center;
  padding: 32px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin: 24px 0;
}

.practice-complete h2 {
  margin-bottom: 8px;
}

.practice-complete .score {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 16px;
}

/* Utility */
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }

/* Responsive */
@media (max-width: 600px) {
  .hero h2 {
    font-size: 1.5rem;
  }
  
  .test-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .results-score {
    font-size: 2.2rem;
  }
  
  .test-card .test-actions {
    flex-direction: column;
  }
  
  .test-card .test-actions .btn {
    width: 100%;
  }
  
  .modal {
    margin: 0 16px;
  }
}
