/* Quiz Builder Frontend Styles */
.quiz-builder-container {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Quiz Header */
.quiz-header {
  text-align: center;
  margin-bottom: 3rem;
  padding: 2rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  color: white;
}

.quiz-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 1rem 0;
  line-height: 1.2;
}

.quiz-description {
  font-size: 1.125rem;
  margin: 0;
  opacity: 0.9;
  line-height: 1.5;
}

/* Quiz Steps */
.quiz-step {
  display: none;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid #e5e7eb;
}

.quiz-step.active {
  display: block;
  animation: slideIn 0.3s ease-out;
}

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

/* Step Header */
.step-header {
  text-align: center;
  margin-bottom: 2rem;
}

.step-header h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 0.5rem 0;
}

.step-header p {
  color: #6b7280;
  margin: 0;
  line-height: 1.5;
}

/* Progress Bar */
.quiz-progress {
  margin-bottom: 2rem;
}

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

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-text {
  text-align: center;
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 500;
}

/* Form Elements */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-weight: 500;
  color: #374151;
  font-size: 0.875rem;
}

.required {
  color: #ef4444;
}

.form-group input,
.form-group select {
  padding: 0.75rem 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.2s ease;
  background: #ffffff;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input:invalid {
  border-color: #ef4444;
}

/* Adicionando estilos para validação de formulário */
.form-group.has-error input,
.form-group.has-error select {
  border-color: #ef4444;
  background-color: #fef2f2;
}

.form-group.has-error label {
  color: #dc2626;
}

.field-help {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

.validation-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 4px solid #ef4444;
  color: #dc2626;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.alert-danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 4px solid #ef4444;
  color: #dc2626;
}

/* Question Content */
.question-content {
  margin-bottom: 2rem;
}

.question-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 1rem 0;
  line-height: 1.3;
}

.question-category {
  margin-bottom: 2rem;
}

.category-tag {
  display: inline-block;
  background: #f3f4f6;
  color: #6b7280;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
}

/* Answer Options */
.answers-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.answer-option {
  display: flex;
  align-items: center;
  padding: 1.25rem;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #ffffff;
  position: relative;
}

.answer-option:hover {
  border-color: #d1d5db;
  background: #f9fafb;
}

.answer-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.answer-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
}

.answer-letter {
  width: 32px;
  height: 32px;
  background: #f3f4f6;
  color: #6b7280;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.answer-text {
  font-size: 1rem;
  color: #374151;
  line-height: 1.4;
}

.answer-check {
  color: #10b981;
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* Selected Answer State */
.answer-option input[type="radio"]:checked + .answer-content .answer-letter {
  background: #3b82f6;
  color: #ffffff;
}

.answer-option input[type="radio"]:checked ~ .answer-check {
  opacity: 1;
}

.answer-option:has(input[type="radio"]:checked) {
  border-color: #3b82f6;
  background: #eff6ff;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  justify-content: center;
  min-width: 120px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Adicionando estados visuais para botões habilitados/desabilitados */
.btn-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  background: #9ca3af !important;
  color: #ffffff !important;
}

.btn-enabled {
  opacity: 1;
  cursor: pointer;
  animation: buttonPulse 0.3s ease-out;
}

@keyframes buttonPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
  }
}

.btn-primary {
  background: #3b82f6;
  color: #ffffff;
}

.btn-primary:hover:not(:disabled):not(.btn-disabled) {
  background: #2563eb;
  transform: translateY(-1px);
}

.btn-secondary {
  background: #f3f4f6;
  color: #374151;
}

.btn-secondary:hover:not(:disabled):not(.btn-disabled) {
  background: #e5e7eb;
}

.btn-success {
  background: #10b981;
  color: #ffffff;
}

.btn-success:hover:not(:disabled):not(.btn-disabled) {
  background: #059669;
  transform: translateY(-1px);
}

.btn-icon {
  font-size: 1.125rem;
}

/* Step Actions */
.step-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid #e5e7eb;
}

.step-actions .btn:only-child {
  margin-left: auto;
}

/* Loading Screen */
.quiz-loading {
  text-align: center;
  padding: 4rem 2rem;
}

.loading-content h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1f2937;
  margin: 1rem 0 0.5rem 0;
}

.loading-content p {
  color: #6b7280;
  margin: 0;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e5e7eb;
  border-top: 4px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

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

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

.results-header {
  margin-bottom: 2rem;
}

.results-icon {
  width: 80px;
  height: 80px;
  background: #d1fae5;
  color: #10b981;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.results-header h3 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 0.5rem 0;
}

.results-header p {
  color: #6b7280;
  margin: 0;
}

/* Adicionando estilos para confirmação de email */
.email-confirmation {
  background: #d1fae5;
  color: #065f46;
  padding: 1rem;
  border-radius: 8px;
  margin-top: 1rem;
  border-left: 4px solid #10b981;
  text-align: left;
  font-size: 0.875rem;
  line-height: 1.4;
}

.results-body {
  margin-bottom: 2rem;
}

.total-score {
  margin-bottom: 2rem;
}

.score-circle {
  width: 120px;
  height: 120px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  color: #ffffff;
}

.score-number {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.score-label {
  font-size: 0.875rem;
  opacity: 0.9;
}

.category-scores {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.category-score {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
}

.category-name {
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.5rem;
}

.category-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: #3b82f6;
}

.results-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Error Screen */
.quiz-error {
  text-align: center;
}

.error-icon {
  width: 80px;
  height: 80px;
  background: #fee2e2;
  color: #ef4444;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.error-content h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 0.5rem 0;
}

.error-message {
  color: #6b7280;
  margin: 0 0 2rem 0;
}

.error-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Responsive Design */
@media (max-width: 768px) {
  .quiz-builder-container {
    padding: 0 0.5rem;
    margin: 1rem auto;
  }

  .quiz-header {
    padding: 1.5rem;
    margin-bottom: 2rem;
  }

  .quiz-title {
    font-size: 1.5rem;
  }

  .quiz-step {
    padding: 1.5rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .question-title {
    font-size: 1.25rem;
  }

  .answer-option {
    padding: 1rem;
  }

  .step-actions {
    flex-direction: column-reverse;
    gap: 0.75rem;
  }

  .step-actions .btn {
    width: 100%;
  }

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

  .results-actions .btn {
    width: 100%;
  }

  .category-scores {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .quiz-header {
    padding: 1rem;
  }

  .quiz-step {
    padding: 1rem;
  }

  .answer-content {
    gap: 0.75rem;
  }

  .answer-letter {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }

  .score-circle {
    width: 100px;
    height: 100px;
  }

  .score-number {
    font-size: 1.5rem;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .quiz-step,
  .progress-fill,
  .answer-option,
  .btn,
  .loading-spinner,
  .btn-enabled {
    animation: none;
    transition: none;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .quiz-header {
    background: #000000;
    color: #ffffff;
  }

  .answer-option {
    border-width: 3px;
  }

  .answer-option:has(input[type="radio"]:checked) {
    border-color: #000000;
    background: #ffffff;
  }
}
