/* Quiz Page Styles */

h2 {
  margin-bottom: var(--space-10);
  color: var(--text-primary);
}

.input-toggle {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: var(--space-10);
}

.toggle-btn {
  padding: 14px 28px;
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--text-primary);
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.toggle-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.toggle-btn:hover {
  transform: translateY(-2px);
}

.input-section {
  margin-bottom: var(--space-8);
}

.input-group {
  margin-bottom: var(--space-6);
}

.input-group label {
  display: block;
  margin-bottom: var(--space-3);
  font-weight: 600;
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-group input[type="text"],
.input-group select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  background: var(--card);
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.input-group input:focus,
.input-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

[data-theme="dark"] .input-group input:focus,
[data-theme="dark"] .input-group select:focus {
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.file-upload-container {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--card);
  transition: all 0.3s ease;
  min-height: 120px;
}

.file-upload-container:hover {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.05);
}

.file-upload-display {
  padding: 30px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.upload-icon {
  font-size: 2.5rem;
  opacity: 0.7;
}

.upload-text {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.upload-main {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.upload-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

#studyMaterial {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-selected {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(79, 70, 229, 0.1);
}

.file-name {
  font-weight: 600;
  color: var(--primary);
}

.remove-file {
  background: #dc2626;
  color: white;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.generate-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  color: white;
  border: none;
  padding: 18px 32px;
  font-size: 1.125rem;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: var(--space-8) 0;
  box-shadow: 0 8px 16px rgba(79, 70, 229, 0.25);
  transition: all 0.3s ease;
}

.generate-btn .btn-icon {
  font-size: 1.5rem;
}

.generate-btn .btn-text {
  color: white;
  font-weight: 700;
}

.generate-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(79, 70, 229, 0.35);
}

.generate-btn:active {
  transform: translateY(-1px);
}

#loading {
  text-align: center;
  margin-top: var(--space-8);
  padding: var(--space-10);
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(124, 58, 237, 0.1) 100%);
  border-radius: 16px;
  border: 1px solid rgba(79, 70, 229, 0.2);
}

#loading p {
  color: var(--text-primary);
  font-size: 1.125rem;
  font-weight: 600;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(79, 70, 229, 0.2);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.loading-step {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  font-size: 14px;
  opacity: 0.5;
  transition: all 0.3s ease;
}

.loading-step.active {
  opacity: 1;
  background: rgba(79, 70, 229, 0.2);
  transform: scale(1.05);
}

.alert {
  padding: 15px 20px;
  border-radius: 12px;
  margin-top: 20px;
  text-align: center;
  font-weight: 500;
}

.alert-danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.alert-info {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.quiz-container {
  margin-top: 30px;
}

.progress-container {
  margin: 20px 0;
}

.timer-display {
  background: rgba(0, 0, 0, 0.05);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  color: #666;
  text-align: center;
  margin-bottom: 10px;
}

.progress-bar {
  background: #e5e7eb;
  height: 8px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  height: 100%;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  text-align: center;
  font-size: 14px;
  color: #666;
  margin: 0;
}

.quiz-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 0;
  padding: 15px;
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.nav-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.nav-btn:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.nav-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  opacity: 0.5;
}

#questionNumber {
  font-weight: 600;
  color: var(--text);
}

.question-card {
  background: var(--card);
  padding: 30px;
  border-radius: 16px;
  border: 1px solid var(--border);
  margin-bottom: 20px;
}

.question-card h3 {
  color: var(--text);
  margin-bottom: 20px;
  font-size: 1.2rem;
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.choice-label {
  display: flex;
  align-items: center;
  padding: 15px 20px;
  background: rgba(0, 0, 0, 0.02);
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.choice-label:hover {
  background: rgba(79, 70, 229, 0.05);
  border-color: var(--primary);
}

.choice-label.correct-answer {
  background: #d1fae5 !important;
  border-color: #10b981 !important;
  border-width: 3px;
  color: #000000 !important;
  font-weight: 600;
}

.choice-label.correct-answer .choice-text {
  color: #000000 !important;
}

.choice-label.incorrect-answer {
  background: #fee2e2 !important;
  border-color: #ef4444 !important;
  border-width: 3px;
  color: #000000 !important;
  font-weight: 600;
}

.choice-label.incorrect-answer .choice-text {
  color: #000000 !important;
}

.choice-label input[type="radio"]:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.choice-label input[type="radio"] {
  margin-right: 12px;
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.choice-text {
  flex: 1;
  font-size: 1rem;
  color: var(--text);
}

.result {
  margin-top: 15px;
  padding: 15px 20px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  text-align: center;
  display: none;
  border: 2px solid;
}

.result.correct {
  background: #d1fae5;
  color: #047857;
  border-color: #10b981;
  display: block;
}

.result.incorrect {
  background: #fee2e2;
  color: #dc2626;
  border-color: #ef4444;
  display: block;
}

.explanation {
  margin-top: 15px;
  padding: 18px;
  background: #f0f9ff;
  border-radius: 10px;
  border-left: 5px solid var(--primary);
  color: #1e40af;
  font-size: 1rem;
  line-height: 1.6;
}

.quiz-actions {
  text-align: center;
  margin: 20px 0;
}

.submit-btn,
.review-btn {
  padding: 12px 24px;
  margin: 5px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.submit-btn {
  background: var(--primary);
  color: white;
}

.review-btn {
  background: #6c757d;
  color: white;
}

.submit-btn:hover,
.review-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.final-score {
  margin-top: 20px;
  padding: 30px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 16px;
  text-align: center;
}

.final-score h3 {
  margin: 0 0 15px 0;
  font-size: 1.8rem;
}

#scoreDetails {
  margin: 20px 0;
  font-size: 1.1rem;
}

.score-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  justify-content: center;
}

.action-btn {
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  .input-row {
    grid-template-columns: 1fr;
  }
  
  .input-toggle {
    flex-direction: column;
  }
  
  .quiz-navigation {
    flex-direction: column;
    gap: 10px;
  }
  
  .score-actions {
    flex-direction: column;
  }
  
  .question-card {
    padding: 20px;
  }
}
