/* =====================================================
   GEONESEMS - Exam Interface Styles
   Student Exam View Components
   ===================================================== */

/* AI Proctor Avatar */
.ai-proctor {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 120px;
  height: 120px;
  background: var(--gradient-primary);
  border-radius: 50%;
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  transition: var(--transition-base);
  cursor: pointer;
}

.ai-proctor:hover {
  transform: scale(1.05);
}

.ai-proctor.speaking {
  animation: speakingGlow 2s ease-in-out infinite;
  box-shadow: 0 0 30px rgba(52, 152, 219, 0.6), var(--shadow-xl);
}

.ai-proctor-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  overflow: hidden; /* Ensure video stays within circle */
}

/* Keep video at full opacity always */
.ai-proctor-avatar video {
  opacity: 1 !important;
}

.proctor-message {
  position: fixed;
  bottom: 160px;
  right: 20px;
  max-width: 400px;
  background: white;
  padding: var(--spacing-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 998;
  animation: fadeIn 0.3s ease-out;
}

.proctor-message-text {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.proctor-actions {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
}

/* Exam Status Bar */
.exam-status-bar {
  position: sticky;
  top: 0;
  background: white;
  padding: var(--spacing-md) var(--spacing-xl);
  box-shadow: var(--shadow-md);
  z-index: 500;
  border-bottom: 3px solid var(--primary);
}

.status-bar-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.exam-part-indicator {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.exam-progress {
  flex: 1;
  margin: 0 var(--spacing-2xl);
}

.progress-bar {
  height: 10px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  transition: width 0.5s ease;
}

.exam-timer {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: var(--text-primary);
}

.exam-timer.warning {
  color: var(--warning);
  animation: pulse 1s ease-in-out infinite;
}

.exam-timer.danger {
  color: var(--danger);
  animation: pulse 0.5s ease-in-out infinite;
}

/* Question Display */
.question-container {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--spacing-2xl);
  box-shadow: var(--shadow-lg);
  margin-bottom: var(--spacing-xl);
  border-left: 5px solid var(--primary);
}

.question-number {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: var(--spacing-sm);
}

.question-text {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: var(--spacing-lg);
}

/* Audio Recording Interface */
.recording-interface {
  background: var(--surface-alt);
  border-radius: var(--radius-lg);
  padding: var(--spacing-2xl);
  text-align: center;
}

.recording-status {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--spacing-lg);
}

.recording-visualizer {
  height: 100px;
  background: white;
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: var(--spacing-md);
}

.visualizer-bar {
  width: 4px;
  height: 20px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  transition: height 0.1s ease;
}

.visualizer-bar.recording {
  animation: visualizerPulse 0.8s ease-in-out infinite;
}

@keyframes visualizerPulse {
  0%, 100% { height: 20px; }
  50% { height: 60px; }
}

/* Speaking glow animation for video avatar */
@keyframes speakingGlow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(52, 152, 219, 0.4), var(--shadow-xl);
  }
  50% {
    box-shadow: 0 0 40px rgba(52, 152, 219, 0.8), var(--shadow-xl);
  }
}

.recording-controls {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
}

.record-button {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: none;
  background: var(--danger);
  color: white;
  font-size: 2rem;
  cursor: pointer;
  transition: var(--transition-base);
  box-shadow: var(--shadow-md);
}

.record-button:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-lg);
}

.record-button.recording {
  background: var(--warning);
  animation: pulse 1.5s ease-in-out infinite;
}

.record-button.recorded {
  background: var(--success);
}

/* Part 3 Image Viewer */
.image-viewer-container {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-md);
}

.image-viewer {
  position: relative;
  width: 100%;
  height: 500px;
  background: var(--surface-alt);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.placeholder-icon {
  font-size: 4rem;
  margin-bottom: var(--spacing-md);
}

.placeholder-text {
  font-size: 1.25rem;
  font-weight: 600;
}

.task-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
  cursor: zoom-in;
  position: relative;
}

.task-image:hover {
  filter: brightness(1.05);
}

/* Magnifying Glass Overlay */
.magnifier-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 150px;
  height: 150px;
  border: 3px solid #4a90e2;
  border-radius: 50%;
  overflow: hidden;
  pointer-events: none;
  display: none;
  background: white;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  z-index: 100;
}

.magnifier-image {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.image-viewer:hover .magnifier-container {
  display: block;
}

.image-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--spacing-lg);
  padding-top: var(--spacing-lg);
  border-top: 2px solid var(--border);
}

.image-nav {
  display: flex;
  gap: var(--spacing-sm);
}

.image-zoom {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
}

.zoom-level {
  font-weight: 600;
  min-width: 60px;
  text-align: center;
}

/* Modal for Part 2 Statements */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease-out;
}

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

.modal-content {
  background: white;
  border-radius: var(--radius-xl);
  padding: var(--spacing-2xl);
  max-width: 600px;
  width: 90%;
  box-shadow: var(--shadow-xl);
  animation: slideIn 0.3s ease-out;
}

.modal-header {
  text-align: center;
  margin-bottom: var(--spacing-xl);
}

.modal-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: var(--spacing-sm);
}

.modal-body {
  text-align: center;
}

.statement-text {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.8;
  color: var(--text-primary);
  padding: var(--spacing-2xl);
  background: var(--surface-alt);
  border-radius: var(--radius-lg);
  margin-bottom: var(--spacing-xl);
}

/* Preparation Timer for Part 3 */
.prep-timer-overlay {
  position: fixed;
  top: 20px;
  right: 20px;
  width: auto;
  height: auto;
  background: rgba(102, 126, 234, 0.75);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  padding: 20px 30px;
  border-radius: 15px;
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.5);
  backdrop-filter: blur(8px);
  pointer-events: auto;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.prep-timer-overlay.show {
  display: flex;
  position: fixed;
  top: 20px;
  right: 20px;
  width: auto;
  height: auto;
  z-index: 3000;
}

.prep-timer-content {
  text-align: center;
  color: white;
}

.prep-timer-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.9;
}

.prep-timer-display {
  font-size: 2.5rem;
  font-weight: 900;
  font-family: 'Courier New', monospace;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  line-height: 1;
}

.prep-timer-message {
  font-size: 0.8rem;
  margin-top: 8px;
  opacity: 0.85;
}

/* Ice Breaker Screen */
.icebreaker-container {
  text-align: center;
  padding: var(--spacing-2xl);
}

.icebreaker-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: var(--spacing-xl);
}

.icebreaker-message {
  font-size: 1.25rem;
  line-height: 1.8;
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto var(--spacing-2xl);
}

/* Results Screen */
.results-container {
  max-width: 800px;
  margin: 0 auto;
}

.results-header {
  text-align: center;
  padding: var(--spacing-2xl);
  background: var(--gradient-primary);
  color: white;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.results-score {
  font-size: 4rem;
  font-weight: 900;
  margin: var(--spacing-lg) 0;
}

.results-grade {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: var(--spacing-md);
}

.results-body {
  background: white;
  padding: var(--spacing-2xl);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  text-align: center;
}

.results-thank-you {
  font-size: 1.25rem;
  color: var(--text-light);
  margin-top: var(--spacing-md);
  font-weight: 500;
}

.results-message-box {
  background: var(--surface-alt);
  padding: var(--spacing-2xl);
  border-radius: var(--radius-lg);
  margin: var(--spacing-2xl) 0;
  border-left: 5px solid var(--primary);
  text-align: left;
}

.results-message-box h3 {
  color: var(--primary);
  font-size: 1.5rem;
  margin-bottom: var(--spacing-lg);
  text-align: center;
}

.results-message-box p {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-base);
  margin-bottom: var(--spacing-md);
}

.results-wishes {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(147, 112, 219, 0.05));
  padding: var(--spacing-xl);
  border-radius: var(--radius-lg);
  margin: var(--spacing-xl) 0;
  border: 2px solid var(--primary);
}

.results-wishes h4 {
  color: var(--primary);
  font-size: 1.25rem;
  margin-bottom: var(--spacing-md);
}

.results-wishes p {
  color: var(--text-light);
  line-height: 1.6;
  font-size: 0.95rem;
}

.results-actions {
  margin-top: var(--spacing-2xl);
  display: flex;
  justify-content: center;
  gap: var(--spacing-lg);
}

.results-actions .btn {
  min-width: 200px;
  padding: var(--spacing-lg) var(--spacing-2xl);
  font-size: 1.1rem;
  font-weight: 600;
}

.criterion-score {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  background: var(--surface-alt);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--primary);
}

.criterion-name {
  font-weight: 600;
  font-size: 1.125rem;
}

.criterion-value {
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--primary);
}

/* Loading Spinner */
.loading-spinner {
  display: inline-block;
  width: 50px;
  height: 50px;
  border: 5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Responsive Adjustments */
@media (max-width: 768px) {
  .ai-proctor {
    width: 80px;
    height: 80px;
    bottom: 10px;
    right: 10px;
  }
  
  .ai-proctor-avatar {
    width: 60px;
    height: 60px;
    font-size: 2rem;
  }
  
  .proctor-message {
    max-width: calc(100% - 40px);
    bottom: 110px;
    right: 10px;
    left: 10px;
  }
  
  .status-bar-content {
    flex-direction: column;
    gap: var(--spacing-md);
  }
  
  .exam-progress {
    width: 100%;
    margin: 0;
  }
  
  .question-text {
    font-size: 1.25rem;
  }
  
  .image-viewer {
    height: 300px;
  }
  
  .prep-timer-display {
    font-size: 4rem;
  }
  
  .results-score {
    font-size: 3rem;
  }
}

/* Fullscreen Image Modal for Part 3 */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 4000;
  display: none;
  justify-content: center;
  align-items: center;
}

.image-modal.show {
  display: flex;
}

.image-modal-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 40px;
  color: white;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 4001;
  transition: color 0.3s;
}

.image-modal-close:hover {
  color: #ff4444;
}

#imageModalImg {
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
  cursor: default;
}

/* Make Part 3 images clickable */
#part3ImageViewer img {
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

#part3ImageViewer img:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.5);
}
