/* ═══════════════════════════════════════════════════════
   TestLab — Results Page Styling
   Follows the same design system as student.css / shared.css
   ═══════════════════════════════════════════════════════ */

/* ── Language Selector (reuse student toolbar styles) ── */

.tl-student-toolbar .tl-lang-selector {
  position: static;
}

.tl-lang-selector {
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--tl-radius-lg);
  padding: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.tl-lang-btn {
  font-family: var(--tl-font);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 4px 10px;
  border: none;
  border-radius: calc(var(--tl-radius-lg) - 2px);
  background: transparent;
  color: var(--tl-text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
}

.tl-lang-btn:hover {
  background: rgba(79, 70, 229, 0.08);
  color: var(--tl-primary);
}

.tl-lang-btn.active {
  background: var(--tl-primary);
  color: white;
  box-shadow: 0 1px 4px rgba(79, 70, 229, 0.3);
}

[data-theme="dark"] .tl-lang-selector {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(255, 255, 255, 0.1);
}

/* ── Toolbar ──────────────────────────────────────── */

.tl-student-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--tl-space-sm);
  padding: var(--tl-space-sm) var(--tl-space-md);
  position: fixed;
  top: 0;
  right: 0;
  z-index: 100;
}

.tl-theme-toggle {
  width: 32px;
  height: 32px;
  border: 1px solid var(--tl-border);
  border-radius: var(--tl-radius-lg);
  background: var(--tl-bg-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.2s ease;
}

.tl-theme-toggle svg { width: 16px; height: 16px; }
.icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: block; }

/* ── Screen Layout ─────────────────────────────────── */

.results-screen {
  min-height: 100vh;
  padding: var(--tl-space-2xl) var(--tl-space-md);
  max-width: 640px;
  margin: 0 auto;
}

/* ── Login Screen ──────────────────────────────────── */

.results-logo {
  text-align: center;
  margin-bottom: var(--tl-space-md);
}

.results-logo svg {
  width: 48px;
  height: 48px;
  color: var(--tl-primary);
}

.results-title {
  text-align: center;
  font-size: var(--tl-text-2xl);
  font-weight: 700;
  color: var(--tl-text-primary);
  margin-bottom: var(--tl-space-xs);
}

.results-subtitle {
  text-align: center;
  color: var(--tl-text-secondary);
  margin-bottom: var(--tl-space-xl);
}

.results-card {
  padding: var(--tl-space-xl);
}

.results-field {
  margin-bottom: var(--tl-space-md);
}

.results-field label {
  display: block;
  font-weight: 600;
  font-size: var(--tl-text-sm);
  margin-bottom: 4px;
  color: var(--tl-text-primary);
}

.results-field select,
.results-field input {
  width: 100%;
}

.pin-input {
  text-align: center;
  font-size: 1.5rem;
  letter-spacing: 0.5em;
  font-family: var(--tl-font-mono);
}

.results-hint {
  font-size: var(--tl-text-xs);
  color: var(--tl-text-muted);
  margin-top: 4px;
}

.results-login-btn {
  width: 100%;
  margin-top: var(--tl-space-md);
}

.results-error {
  color: var(--tl-red, #ef4444);
  font-size: var(--tl-text-sm);
  text-align: center;
  min-height: 1.4em;
  margin-top: var(--tl-space-sm);
}

/* ── Test List Screen ──────────────────────────────── */

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--tl-space-xl);
  padding-top: var(--tl-space-md);
}

.results-header-info {
  display: flex;
  align-items: center;
  gap: var(--tl-space-sm);
}

.results-student-name {
  font-size: var(--tl-text-xl);
  font-weight: 700;
  color: var(--tl-text-primary);
  margin: 0;
}

.test-list {
  display: flex;
  flex-direction: column;
  gap: var(--tl-space-sm);
}

.test-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--tl-space-md) var(--tl-space-lg);
  background: var(--tl-bg-card);
  border: 1px solid var(--tl-border);
  border-radius: var(--tl-radius-lg);
  cursor: pointer;
  transition: all var(--tl-transition);
}

.test-card:hover {
  border-color: var(--tl-primary-light);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.08);
}

.test-card-locked {
  opacity: 0.7;
  cursor: default;
}

.test-card-locked:hover {
  border-color: var(--tl-border);
  box-shadow: none;
}

.test-card-info {
  flex: 1;
  min-width: 0;
}

.test-card-title {
  font-size: var(--tl-text-base);
  font-weight: 600;
  color: var(--tl-text-primary);
  margin: 0 0 4px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.test-card-meta {
  display: flex;
  align-items: center;
  gap: var(--tl-space-sm);
  font-size: var(--tl-text-sm);
}

.test-card-date {
  color: var(--tl-text-muted);
}

.test-card-arrow {
  color: var(--tl-text-muted);
  flex-shrink: 0;
  margin-left: var(--tl-space-sm);
}

.test-card-lock {
  flex-shrink: 0;
  margin-left: var(--tl-space-sm);
}

.no-results {
  text-align: center;
  padding: var(--tl-space-2xl) var(--tl-space-md);
  color: var(--tl-text-muted);
}

.no-results svg {
  margin-bottom: var(--tl-space-md);
  opacity: 0.5;
}

/* ── Detail Screen ─────────────────────────────────── */

.results-back-btn {
  margin-bottom: var(--tl-space-lg);
}

.detail-header {
  margin-bottom: var(--tl-space-xl);
}

.detail-test-title {
  font-size: var(--tl-text-xl);
  font-weight: 700;
  color: var(--tl-text-primary);
  margin: 0 0 4px 0;
}

.detail-date {
  color: var(--tl-text-muted);
  font-size: var(--tl-text-sm);
  margin: 0;
}

.detail-summary {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--tl-space-md);
  margin-bottom: var(--tl-space-xl);
}

.summary-card {
  text-align: center;
  padding: var(--tl-space-lg) var(--tl-space-md);
  background: var(--tl-bg-card);
  border: 1px solid var(--tl-border);
  border-radius: var(--tl-radius-lg);
}

.summary-label {
  display: block;
  font-size: var(--tl-text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tl-text-muted);
  margin-bottom: 4px;
}

.summary-value {
  font-size: var(--tl-text-xl);
  font-weight: 700;
  font-family: var(--tl-font-mono);
  color: var(--tl-text-primary);
}

.summary-value.grade-1 { color: #22c55e; }
.summary-value.grade-2 { color: #84cc16; }
.summary-value.grade-3 { color: #eab308; }
.summary-value.grade-4 { color: #f97316; }
.summary-value.grade-5 { color: #ef4444; }

/* ── Question Result Cards ─────────────────────────── */

.detail-questions {
  display: flex;
  flex-direction: column;
  gap: var(--tl-space-md);
}

.question-result-card {
  padding: var(--tl-space-lg);
  background: var(--tl-bg-card);
  border: 1px solid var(--tl-border);
  border-radius: var(--tl-radius-lg);
  border-left: 4px solid var(--tl-border);
}

.question-result-card.qr-correct {
  border-left-color: #22c55e;
}

.question-result-card.qr-incorrect {
  border-left-color: #ef4444;
}

.question-result-card.qr-partial {
  border-left-color: #eab308;
}

.qr-header {
  display: flex;
  align-items: center;
  gap: var(--tl-space-sm);
  margin-bottom: var(--tl-space-sm);
}

.qr-num {
  font-weight: 700;
  font-size: var(--tl-text-sm);
  color: var(--tl-text-primary);
}

.qr-points {
  margin-left: auto;
  font-family: var(--tl-font-mono);
  font-weight: 600;
  font-size: var(--tl-text-sm);
  color: var(--tl-text-secondary);
}

.qr-text {
  color: var(--tl-text-primary);
  margin-bottom: var(--tl-space-md);
  line-height: 1.5;
}

.qr-answer-label,
.qr-note-label {
  font-size: var(--tl-text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tl-text-muted);
  margin-bottom: 2px;
}

.qr-answer-value {
  padding: var(--tl-space-sm) var(--tl-space-md);
  background: var(--tl-bg, #f8fafc);
  border-radius: var(--tl-radius-md);
  font-size: var(--tl-text-sm);
  color: var(--tl-text-primary);
  margin-bottom: var(--tl-space-sm);
  word-break: break-word;
  /* Multi-line answers (matching, true-false-correct, table-fill,
     briefing-form) are formatted with embedded newlines — preserve them
     while still allowing soft-wrap on long lines. */
  white-space: pre-line;
}

.qr-note-label {
  margin-top: var(--tl-space-sm);
}

.qr-note-value {
  padding: var(--tl-space-sm) var(--tl-space-md);
  background: rgba(79, 70, 229, 0.05);
  border-left: 3px solid var(--tl-primary);
  border-radius: 0 var(--tl-radius-md) var(--tl-radius-md) 0;
  font-size: var(--tl-text-sm);
  color: var(--tl-text-secondary);
  font-style: italic;
}

/* ── Disclaimer ────────────────────────────────────── */

.tl-disclaimer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--tl-space-sm);
  padding: var(--tl-space-lg);
  font-size: var(--tl-text-xs);
  color: var(--tl-text-muted);
}

.tl-disclaimer-logo {
  height: 16px;
  opacity: 0.4;
}

/* ── Mobile Responsive ─────────────────────────────── */

@media (max-width: 480px) {
  .results-screen {
    padding: var(--tl-space-xl) var(--tl-space-sm);
  }

  .results-card {
    padding: var(--tl-space-md);
  }

  .detail-summary {
    grid-template-columns: 1fr;
    gap: var(--tl-space-sm);
  }

  .summary-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--tl-space-md);
  }

  .summary-label {
    margin-bottom: 0;
  }
}

/* ── Release Status Banner (teacher) ────────────────── */

.release-status-banner {
  font-weight: 500;
}

/* ── Teacher tl-btn-warning style ─────────────────── */

.tl-btn-warning {
  background: #f59e0b;
  color: white;
  border-color: #f59e0b;
}

.tl-btn-warning:hover {
  background: #d97706;
  border-color: #d97706;
}
