/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 40px;
  color: white;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

header p {
  font-size: 1.1rem;
  opacity: 0.9;
}

/* Main content */
main {
  flex: 1;
  background: white;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

/* Quiz sections */
.quiz-section {
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Setup form */
.setup-form h2 {
  text-align: center;
  margin-bottom: 30px;
  color: #4a5568;
  font-size: 1.8rem;
}

.form-group {
  margin-bottom: 25px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #2d3748;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Buttons */
button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  margin-top: 10px;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Quiz taking interface */
.quiz-header {
  margin-bottom: 30px;
}

.quiz-header h2 {
  text-align: center;
  margin-bottom: 20px;
  color: #4a5568;
}

.progress-bar {
  background: #e2e8f0;
  border-radius: 20px;
  height: 8px;
  position: relative;
  margin-bottom: 10px;
}

.progress-fill {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  height: 100%;
  border-radius: 20px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  text-align: center;
  display: block;
  font-weight: 600;
  color: #4a5568;
}

/* Question container */
.question-container {
  margin-bottom: 30px;
}

.question {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 25px;
  color: #2d3748;
  line-height: 1.6;
}

.options {
  display: grid;
  gap: 15px;
}

.option {
  background: #f7fafc;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 15px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1rem;
}

.option:hover {
  border-color: #667eea;
  background: #edf2f7;
}

.option.selected {
  border-color: #667eea;
  background: #e6fffa;
}

.option.correct {
  border-color: #48bb78;
  background: #f0fff4;
}

.option.incorrect {
  border-color: #f56565;
  background: #fff5f5;
}

/* Quiz actions */
.quiz-actions {
  display: flex;
  gap: 15px;
}

.quiz-actions button {
  flex: 1;
  margin-top: 0;
}

/* Results */
.results-container {
  text-align: center;
}

.results-container h2 {
  margin-bottom: 30px;
  color: #4a5568;
  font-size: 2rem;
}

.score-display {
  margin-bottom: 30px;
}

.score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 15px;
  color: white;
  font-size: 1.5rem;
  font-weight: bold;
}

.score-percentage {
  font-size: 1.2rem;
  font-weight: 600;
  color: #4a5568;
}

.results-summary {
  margin-bottom: 30px;
}

.results-summary p {
  margin-bottom: 10px;
  font-size: 1.1rem;
  color: #4a5568;
}

/* Detailed results */
.detailed-results {
  text-align: left;
  margin-bottom: 30px;
}

.result-item {
  background: #f7fafc;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 15px;
  border-left: 4px solid #e2e8f0;
}

.result-item.correct {
  border-left-color: #48bb78;
  background: #f0fff4;
}

.result-item.incorrect {
  border-left-color: #f56565;
  background: #fff5f5;
}

.result-item h4 {
  margin-bottom: 10px;
  color: #2d3748;
}

.result-item p {
  margin-bottom: 8px;
  color: #4a5568;
}

.result-item .explanation {
  font-style: italic;
  color: #718096;
}

/* Loading and error states */
.loading-section,
.error-section {
  text-align: center;
  padding: 40px;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #e2e8f0;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

.error-icon {
  font-size: 3rem;
  margin-bottom: 20px;
}

/* Footer */
footer {
  text-align: center;
  color: white;
  opacity: 0.8;
  font-size: 0.9rem;
}

/* Responsive design */
@media (max-width: 768px) {
  .container {
    padding: 10px;
  }

  main {
    padding: 20px;
  }

  header h1 {
    font-size: 2rem;
  }

  .quiz-actions {
    flex-direction: column;
  }

  .score-circle {
    width: 100px;
    height: 100px;
    font-size: 1.2rem;
  }
}
