/* Teacher portal styles — follows SOLace design system from main-pages.css */

/* ── Page shell ──────────────────────────────────────────────────────────── */

.teacher-page {
  padding-top: 80px;      /* clear fixed header */
  min-height: 100vh;
  background: #f8f9fa;
}

.teacher-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
}

/* ── Page headings ───────────────────────────────────────────────────────── */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-header h1 {
  font-size: 2rem;
  color: #2c3e50;
}

.page-header p {
  color: #6c757d;
  margin-top: 0.25rem;
  font-size: 1rem;
}

/* ── Auth card (login page) ──────────────────────────────────────────────── */

.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 80px);
  padding: 2rem;
}

.auth-card {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
  padding: 2.5rem;
  width: 100%;
  max-width: 460px;
}

.auth-card h2 {
  font-size: 1.6rem;
  color: #2c3e50;
  margin-bottom: 0.5rem;
}

.auth-card .auth-subtitle {
  color: #6c757d;
  margin-bottom: 1.75rem;
  font-size: 0.95rem;
}

/* ── Tabs ────────────────────────────────────────────────────────────────── */

.tab-bar {
  display: flex;
  border-bottom: 2px solid #e9ecef;
  margin-bottom: 1.75rem;
  gap: 0;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: #6c757d;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: -2px;
  padding: 0.75rem 1.25rem;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: #4a6fa5;
}

.tab-btn.active {
  border-bottom-color: #4a6fa5;
  color: #4a6fa5;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ── Form controls ───────────────────────────────────────────────────────── */

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  color: #333;
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  padding: 0.7rem 0.9rem;
  transition: border-color 0.2s ease;
  width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #4a6fa5;
  outline: none;
  box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.15);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-hint {
  color: #6c757d;
  font-size: 0.8rem;
  margin-top: 0.3rem;
}

/* Password strength indicator */
.pw-strength {
  height: 4px;
  background: #e9ecef;
  border-radius: 2px;
  margin-top: 0.4rem;
  overflow: hidden;
}

.pw-strength-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease, background 0.3s ease;
  width: 0;
}

.pw-strength-bar.weak   { background: #dc3545; width: 33%; }
.pw-strength-bar.medium { background: #ffc107; width: 66%; }
.pw-strength-bar.strong { background: #28a745; width: 100%; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn-block {
  display: block;
  width: 100%;
  text-align: center;
}

.btn-secondary {
  background: #e9ecef;
  border: none;
  border-radius: 8px;
  color: #333;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background: #dee2e6;
  transform: translateY(-1px);
}

.btn-danger {
  background: #dc3545;
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  transition: all 0.3s ease;
}

.btn-danger:hover {
  background: #c82333;
  transform: translateY(-1px);
}

.btn-icon {
  background: none;
  border: none;
  border-radius: 8px;
  color: #4a6fa5;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.4rem 0.75rem;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: #f0f5fa;
}

.btn-sm {
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
}

.btn-google {
  align-items: center;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  color: #333;
  cursor: pointer;
  display: flex;
  font-size: 1rem;
  font-weight: 500;
  gap: 0.75rem;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  transition: all 0.3s ease;
  width: 100%;
}

.btn-google:hover {
  background: #f8f9fa;
  border-color: #aaa;
}

/* ── Divider ─────────────────────────────────────────────────────────────── */

.divider {
  align-items: center;
  color: #6c757d;
  display: flex;
  font-size: 0.85rem;
  gap: 1rem;
  margin: 1.25rem 0;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e9ecef;
}

/* ── Alert / notice banners ─────────────────────────────────────────────── */

.alert {
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
  padding: 0.85rem 1rem;
}

.alert-error {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
}

.alert-success {
  background: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
}

.alert-info {
  background: #d1ecf1;
  border: 1px solid #bee5eb;
  color: #0c5460;
}

.alert-warning {
  background: #fff3cd;
  border: 1px solid #ffeeba;
  color: #856404;
}

/* ── Class cards (dashboard) ─────────────────────────────────────────────── */

.classes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.class-card {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  padding: 1.75rem;
  transition: all 0.3s ease;
}

.class-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  border-color: #4a6fa5;
}

.class-card.archived {
  opacity: 0.6;
}

.class-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.class-name {
  font-size: 1.15rem;
  font-weight: 600;
  color: #2c3e50;
}

.badge {
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-active   { background: #d4edda; color: #155724; }
.badge-archived { background: #e2e3e5; color: #383d41; }

.class-meta {
  color: #6c757d;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.join-code-display {
  background: #f0f5fa;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  padding: 0.5rem 1rem;
  text-align: center;
  color: #4a6fa5;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: #6c757d;
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-size: 1.25rem;
  color: #333;
  margin-bottom: 0.5rem;
}

/* ── Modal ───────────────────────────────────────────────────────────────── */

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

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

.modal {
  background: white;
  border-radius: 15px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
}

.modal-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-header h3 {
  font-size: 1.25rem;
  color: #2c3e50;
}

.modal-close {
  background: none;
  border: none;
  border-radius: 6px;
  color: #6c757d;
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  transition: all 0.2s;
}

.modal-close:hover {
  background: #f0f0f0;
  color: #333;
}

.modal-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.modal-lg {
  max-width: 820px;
}

/* ── Student insights modal ──────────────────────────────────────────────── */

.insights-seat-header {
  margin-bottom: 1.25rem;
}

.insights-seat-header h4 {
  font-size: 1.1rem;
  color: #2c3e50;
}

.insights-seat-header p {
  color: #6c757d;
  font-size: 0.9rem;
}

.attempt-card {
  background: #fafcff;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.attempt-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.attempt-card-header h5 {
  font-size: 1rem;
  color: #2c3e50;
}

.attempt-card-meta {
  color: #6c757d;
  font-size: 0.85rem;
}

.attempt-card-score {
  font-weight: 700;
  color: #4a6fa5;
  font-size: 1.1rem;
}

.question-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.question-chip {
  align-items: center;
  border-radius: 6px;
  color: white;
  cursor: default;
  display: flex;
  font-size: 0.8rem;
  font-weight: 600;
  height: 2rem;
  justify-content: center;
  width: 2rem;
}

.question-chip.correct   { background: #28a745; cursor: pointer; }
.question-chip.incorrect { background: #dc3545; cursor: pointer; }

.question-detail {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  margin-top: 0.75rem;
  padding: 1rem;
  font-size: 0.9rem;
}

.question-detail-text {
  color: #2c3e50;
  margin-bottom: 0.5rem;
}

.question-options {
  list-style: none;
  margin-bottom: 0.5rem;
}

.question-options li {
  color: #333;
  padding: 0.25rem 0;
}

.question-options li.option-correct {
  color: #155724;
  font-weight: 600;
}

.question-explanation {
  color: #6c757d;
  font-style: italic;
}

.missing-image-note {
  color: #6c757d;
  font-size: 0.8rem;
  font-style: italic;
}

.question-detail-text img,
.question-options img,
.question-option-image {
  max-width: 100%;
  height: auto;
}

.question-option-image {
  display: block;
  margin-top: 0.25rem;
  max-height: 150px;
}

/* ── Class detail — three-tab layout ────────────────────────────────────── */

.class-detail-header {
  background: white;
  border-bottom: 1px solid #e9ecef;
  padding: 1.5rem 2rem 0;
  position: sticky;
  top: 70px;
  z-index: 100;
}

.class-detail-title {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.class-detail-title h1 {
  font-size: 1.5rem;
  color: #2c3e50;
}

.class-tabs {
  display: flex;
  gap: 0;
  border-bottom: none;
}

.class-tab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: #6c757d;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: -1px;
  padding: 0.75rem 1.25rem;
  transition: all 0.2s ease;
}

.class-tab-btn:hover { color: #4a6fa5; }

.class-tab-btn.active {
  border-bottom-color: #4a6fa5;
  color: #4a6fa5;
}

.class-tab-content {
  padding: 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

/* ── Roster table ────────────────────────────────────────────────────────── */

.roster-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.seat-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.seat-table th {
  background: #f0f5fa;
  color: #4a6fa5;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.85rem 1rem;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.seat-table td {
  border-top: 1px solid #f0f0f0;
  color: #333;
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
}

.seat-table tr:hover td {
  background: #fafcff;
}

/* ── Kiosk mode overlay ──────────────────────────────────────────────────── */

.kiosk-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: white;
  z-index: 3000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

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

.kiosk-overlay h2 {
  font-size: 1.75rem;
  color: #2c3e50;
  margin-bottom: 0.5rem;
}

.kiosk-overlay p {
  color: #6c757d;
  margin-bottom: 2rem;
  font-size: 1.05rem;
}

.kiosk-result {
  display: none;
  background: #d4edda;
  border-radius: 12px;
  color: #155724;
  font-size: 1.25rem;
  font-weight: 600;
  padding: 1.25rem 2rem;
  margin-bottom: 2rem;
}

.kiosk-result.visible {
  display: block;
}

/* ── Progress table ──────────────────────────────────────────────────────── */

.progress-controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  align-items: center;
}

.sort-select {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
}

.score-bar-cell {
  min-width: 120px;
}

.score-bar {
  background: #e9ecef;
  border-radius: 6px;
  height: 8px;
  overflow: hidden;
  margin-top: 4px;
}

.score-bar-fill {
  background: linear-gradient(90deg, #4a6fa5, #28a745);
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
}

.score-pct {
  font-weight: 600;
  color: #333;
}

/* ── Settings section ────────────────────────────────────────────────────── */

.settings-section {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  padding: 1.5rem;
}

.settings-section h3 {
  font-size: 1rem;
  color: #2c3e50;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #f0f0f0;
}

.code-display-row {
  align-items: center;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.code-big {
  background: #f0f5fa;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  padding: 0.5rem 1.25rem;
  color: #4a6fa5;
}

/* ── Loading spinner ─────────────────────────────────────────────────────── */

.spinner {
  border: 3px solid #e9ecef;
  border-top-color: #4a6fa5;
  border-radius: 50%;
  height: 32px;
  width: 32px;
  animation: spin 0.8s linear infinite;
  margin: 2rem auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── TOTP / 2FA section ──────────────────────────────────────────────────── */

.totp-qr {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  margin-bottom: 1rem;
}

.totp-qr img {
  max-width: 200px;
}

/* ── Printable seat sheet (shown only when printing) ─────────────────────── */

@media print {
  header, footer, .teacher-page > *:not(.print-area) { display: none !important; }
  .print-area { display: block !important; }
}

.print-area {
  display: none;
}

.print-sheet {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.print-sheet table {
  border-collapse: collapse;
  width: 100%;
}

.print-sheet td, .print-sheet th {
  border: 1px solid #333;
  padding: 0.75rem 1rem;
}

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

@media (max-width: 768px) {
  .teacher-container { padding: 1.5rem 1rem; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .classes-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 1.75rem; }
  .modal { padding: 1.5rem; }
  .class-detail-header { padding: 1rem 1rem 0; }
  .class-tab-content { padding: 1.25rem 1rem; }
  .roster-actions, .progress-controls { flex-direction: column; }
  .code-display-row { flex-direction: column; }
}
