/* Flask student template: map legacy class names to Scorely / student-viva visuals */

.student-page .section {
  display: none;
}

.student-page .section.active {
  display: block;
}

.student-page .student-main {
  align-items: flex-start;
  padding-top: 24px;
}

.student-page .student-main:has(#login-section.active) {
  align-items: center;
  min-height: min(72vh, 680px);
}

.student-page .student-container {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
  z-index: 1;
}

.student-page .student-container > main {
  flex: 1 1 auto;
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
  padding: clamp(16px, 3vw, 28px) clamp(16px, 3vw, 24px) 48px;
}

.student-page #login-section.active .login-card,
.student-page #login-section.active .student-card {
  max-width: 560px;
  margin: 0 auto;
}

/* Live viva card */
.student-page #viva-section .viva-container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  background: linear-gradient(180deg, #f4f6fb 0%, #eef1f7 100%);
  border: 1px solid rgba(199, 213, 239, 0.95);
  border-radius: 16px;
  padding: 20px 22px 24px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 18px 44px rgba(23, 61, 112, 0.12);
}

.student-page #viva-section .viva-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.student-page #viva-section .progress-info {
  flex: 1 1 auto;
  min-width: 200px;
}

.student-page #viva-section #questionCounter {
  display: block;
  margin: 0 0 8px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--sp-text, #101c37);
}

.student-page #viva-section .progress-bar {
  height: 6px;
  border-radius: 999px;
  background: #d8e2f4;
  overflow: hidden;
  max-width: 280px;
}

.student-page #viva-section .progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--sp-brand, #11a592), var(--sp-accent, #2f7ef1));
  transition: width 0.35s ease;
}

.student-page #viva-section .viva-timer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25);
}

.student-page #viva-section .viva-timer.timer-warning {
  background: #b45309;
  animation: flask-timer-pulse 1s ease-in-out infinite;
}

.student-page #viva-section .viva-timer.timer-expired {
  background: #991b1b;
  animation: none;
}

@keyframes flask-timer-pulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.12);
  }
}

.student-page #viva-section .question-card {
  background: #e8ecf4;
  border: 1px solid #d5deef;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 18px;
}

.student-page #viva-section .question-card h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.45;
  color: var(--sp-text, #101c37);
}

.student-page #viva-section .answer-section label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 8px;
}

.student-page #viva-section #answerText {
  width: 100%;
  min-height: 140px;
  padding: 12px 14px;
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--sp-text, #101c37);
  border: 1px solid #c7d5ef;
  border-radius: 10px;
  resize: vertical;
  background: #fff;
}

.student-page #viva-section #answerText:focus {
  outline: none;
  border-color: var(--sp-accent, #2f7ef1);
  box-shadow: 0 0 0 3px rgba(47, 126, 241, 0.18);
}

.student-page #viva-section .voice-controls {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.student-page #viva-section .voice-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.35);
}

.student-page #viva-section .voice-btn.stop {
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
}

.student-page #viva-section .voice-btn:hover {
  filter: brightness(1.05);
}

.student-page #viva-section .viva-actions {
  margin-top: 20px;
}

.student-page #viva-section .viva-actions .btn-primary {
  width: 100%;
  max-width: 280px;
  padding: 12px 22px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: linear-gradient(105deg, var(--sp-accent, #2f7ef1) 0%, #2563eb 100%);
  box-shadow: 0 4px 14px rgba(47, 126, 241, 0.35);
}

.student-page #viva-section .viva-actions .btn-primary:hover {
  filter: brightness(1.05);
}

/* Feedback */
.student-page #feedback-section .feedback-container {
  max-width: 720px;
  margin: 0 auto;
  background: var(--sp-card, rgba(255, 255, 255, 0.92));
  border: 1px solid rgba(199, 213, 239, 0.95);
  border-radius: 16px;
  padding: 24px 22px 28px;
  box-shadow: 0 18px 44px rgba(23, 61, 112, 0.1);
}

.student-page #feedback-section .feedback-header {
  text-align: center;
  margin-bottom: 20px;
}

.student-page #feedback-section .feedback-header h2 {
  margin: 0 0 12px;
  font-size: 1.35rem;
  font-weight: 800;
  color: #0c3554;
}

.student-page #feedback-section .score-display {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--sp-accent, #2f7ef1);
}

.student-page #feedback-section .feedback-item {
  margin-bottom: 16px;
  padding: 14px;
  background: #f4f6fb;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.student-page #feedback-section .feedback-item h4 {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.student-page #feedback-section .feedback-item p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--sp-text, #101c37);
}

.student-page #feedback-section .feedback-actions .btn-primary {
  padding: 12px 22px;
  font: inherit;
  font-weight: 700;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: linear-gradient(105deg, var(--sp-accent, #2f7ef1) 0%, #2563eb 100%);
  box-shadow: 0 4px 14px rgba(47, 126, 241, 0.35);
}

/* Results */
.student-page #result-section .result-container {
  max-width: 800px;
  margin: 0 auto;
  background: var(--sp-card, rgba(255, 255, 255, 0.92));
  border: 1px solid rgba(199, 213, 239, 0.95);
  border-radius: 16px;
  padding: 28px 24px 32px;
  box-shadow: 0 18px 44px rgba(23, 61, 112, 0.1);
}

.student-page #result-section .result-header {
  text-align: center;
}

.student-page #result-section .result-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #0c3554;
}

.student-page #result-section .final-score {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(95deg, var(--sp-brand, #11a592), var(--sp-accent, #2f7ef1));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.student-page #result-section .result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}

.student-page #result-section .btn-secondary,
.student-page #result-section .btn-primary {
  padding: 11px 20px;
  font: inherit;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid #c7d5ef;
}

.student-page #result-section .btn-secondary {
  background: #fff;
  color: #334155;
}

.student-page #result-section .btn-primary {
  background: linear-gradient(105deg, var(--sp-accent, #2f7ef1) 0%, #2563eb 100%);
  color: #fff;
  border: none;
  box-shadow: 0 4px 14px rgba(47, 126, 241, 0.35);
}

/* Login card message */
.student-page #loginMessage.message {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
}

.student-page #loginMessage.message.success {
  color: #166534;
  background: #ecfdf3;
  border: 1px solid #bbf7d0;
}

.student-page #loginMessage.message.error {
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.student-page .already-taken {
  margin-top: 18px;
  padding: 16px;
  border-radius: 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  text-align: center;
}

.student-page .already-taken h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: #92400e;
}

/* Overlay spinner */
.student-page #evaluating-overlay {
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(6px);
}

.student-page #evaluating-overlay .overlay-text {
  color: #f8fafc;
  font-weight: 700;
}

.student-page #evaluating-overlay .overlay-subtext {
  color: #cbd5e1;
}

/* —— Pulled from legacy viva widgets (no global body / landing styles) —— */
.student-page #evaluating-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(5px);
}

.student-page .modern-spinner {
  width: 60px;
  height: 60px;
  border: 6px solid rgba(255, 255, 255, 0.1);
  border-top: 6px solid #3b82f6;
  border-radius: 50%;
  animation: flask-spin 1s cubic-bezier(0.55, 0.15, 0.45, 0.85) infinite;
  margin-bottom: 20px;
}

@keyframes flask-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.student-page .quality-badge {
  display: inline-block;
  padding: 8px 20px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 1rem;
  margin-top: 10px;
}

.student-page .quality-badge.excellent {
  background: #d4edda;
  color: #155724;
}

.student-page .quality-badge.good {
  background: #cce5ff;
  color: #004085;
}

.student-page .quality-badge.adequate {
  background: #fff3cd;
  color: #856404;
}

.student-page .quality-badge.poor {
  background: #f8d7da;
  color: #721c24;
}

.student-page .verdict-badge {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 1.05rem;
  font-weight: 700;
  margin-top: 12px;
}

.student-page .verdict-badge.excellent {
  background: #d4edda;
  color: #155724;
}

.student-page .verdict-badge.good {
  background: #cce5ff;
  color: #004085;
}

.student-page .verdict-badge.needs-improvement {
  background: #fff3cd;
  color: #856404;
}

.student-page .verdict-badge.poor {
  background: #f8d7da;
  color: #721c24;
}

.student-page .voice-status {
  margin-top: 8px;
  font-size: 0.86rem;
  color: #64748b;
}

.student-page .voice-status.listening {
  background: #ecfdf3;
  color: #166534;
  padding: 8px 12px;
  border-radius: 8px;
}

.student-page #submitAnswer.submit-final-pulse {
  animation: flask-final-pulse 1.2s ease-in-out infinite;
}

@keyframes flask-final-pulse {
  0%,
  100% {
    box-shadow: 0 4px 14px rgba(47, 126, 241, 0.35);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(47, 126, 241, 0.35), 0 8px 24px rgba(47, 126, 241, 0.5);
  }
}

/* Report cards (injected HTML from student.js) */
.student-page .viva-result-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
  padding: 22px;
  margin-bottom: 18px;
  border-left: 6px solid #cbd5e1;
  transition: transform 0.2s ease;
}

.student-page .viva-result-card:hover {
  transform: translateY(-2px);
}

.student-page .viva-result-card.excellent {
  border-left-color: #10b981;
}

.student-page .viva-result-card.good {
  border-left-color: #3b82f6;
}

.student-page .viva-result-card.poor {
  border-left-color: #f59e0b;
}

.student-page .viva-result-card.unattempted {
  border-left-color: #ef4444;
}

.student-page .q-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.student-page .q-title {
  font-size: 1rem;
  font-weight: 800;
  color: #1e293b;
  margin: 0;
}

.student-page .q-score-badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.85rem;
  background: #f1f5f9;
  color: #334155;
}

.student-page .qa-box {
  margin-bottom: 12px;
}

.student-page .qa-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 6px;
}

.student-page .student-ans {
  color: #334155;
  font-size: 0.92rem;
  padding: 10px;
  background: #f8fafc;
  border-radius: 8px;
}

.student-page .ideal-ans {
  color: #0f172a;
  font-size: 0.92rem;
  padding: 10px;
  background: #f0fdf4;
  border-radius: 8px;
  border: 1px solid #bbf7d0;
}

.student-page .feedback-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 16px;
}

@media (max-width: 640px) {
  .student-page .feedback-box {
    grid-template-columns: 1fr;
  }
}

.student-page .mistakes-panel {
  background: #fef2f2;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid #fecaca;
}

.student-page .suggestions-panel {
  background: #eff6ff;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid #bfdbfe;
}

.student-page .panel-title {
  display: flex;
  align-items: center;
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 0.88rem;
}

.student-page .mistakes-panel .panel-title {
  color: #b91c1c;
}

.student-page .suggestions-panel .panel-title {
  color: #1d4ed8;
}

/* Camera: picture-in-picture (same as legacy viva_style — bottom-right, does not push exam card) */
.student-page #viva-section .camera-widget {
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  left: auto;
  width: 240px;
  max-width: min(240px, calc(100vw - 32px));
  margin: 0;
  background: #0f172a;
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.45),
    0 0 0 2px rgba(99, 102, 241, 0.35);
  z-index: 999;
  font-family: inherit;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.student-page #viva-section .camera-widget:hover {
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.55),
    0 0 0 2px rgba(99, 102, 241, 0.6);
}

@media (max-width: 480px) {
  .student-page #viva-section .camera-widget {
    width: min(200px, calc(100vw - 24px));
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
  }
}

.student-page .camera-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: #1e293b;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.student-page .camera-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
  flex-shrink: 0;
  transition: background 0.4s;
}

.student-page .camera-dot.live {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
  animation: flask-live-pulse 1.8s infinite;
}

.student-page .camera-dot.error {
  background: #ef4444;
}

@keyframes flask-live-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.08);
  }
}

.student-page .camera-label {
  flex: 1;
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.student-page .camera-toggle-btn {
  background: none;
  border: none;
  color: #64748b;
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.2s;
}

.student-page .camera-toggle-btn:hover {
  color: #e2e8f0;
}

.student-page .camera-feed-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  background: #020617;
  overflow: hidden;
}

.student-page #cameraFeed {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scaleX(-1);
}

.student-page .camera-status-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(2, 6, 23, 0.85);
  color: #94a3b8;
  font-size: 12px;
  z-index: 2;
  transition: opacity 0.4s;
}

.student-page .camera-status-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.student-page .camera-blocked {
  padding: 12px 10px;
  text-align: center;
  color: #f87171;
  font-size: 11px;
  line-height: 1.5;
  max-width: 100%;
}

.student-page .camera-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: flask-spin 0.9s linear infinite;
}

.student-page .face-alert {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(239, 68, 68, 0.92);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
  white-space: nowrap;
  z-index: 3;
  animation: flask-alert-blink 1s infinite;
}

@keyframes flask-alert-blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.student-page .camera-info-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 12px;
  background: #1e293b;
}

.student-page .cam-student-name {
  color: #94a3b8;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.student-page .cam-face-status {
  font-size: 11px;
  font-weight: 700;
}

.student-page .cam-face-status.face-ok {
  color: #22c55e;
}

.student-page .cam-face-status.face-missing {
  color: #ef4444;
}

.student-page .camera-widget.minimized .camera-feed-wrapper,
.student-page .camera-widget.minimized .camera-info-bar {
  display: none;
}

.student-page .report-section {
  margin-bottom: 20px;
  padding: 18px;
  background: #f4f6fb;
  border-radius: 12px;
  text-align: left;
}

.student-page .report-section h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  color: #0c3554;
}

.student-page .question-analysis {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e2e8f0;
}
