/* ============================================================
   Quiz LogicDev — Estilos Principais
   Design inspirado na identidade visual do LogicDev
   Paleta: Roxo (#2e0294, #7c3aed, #a78bfa) + Dark (#0f0f1a)
   ============================================================ */

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --purple-deep: #2e0294;
  --purple-main: #7c3aed;
  --purple-mid: #8b5cf6;
  --purple-light: #a78bfa;
  --purple-pale: #c4b5fd;
  --bg-dark: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-card2: #16213e;
  --border: rgba(139, 92, 246, 0.25);
  --border-hover: rgba(139, 92, 246, 0.6);
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  --transition: 0.3s ease;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family:
    "Inter",
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Background animado */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(
      ellipse 80% 50% at 20% 20%,
      rgba(46, 2, 148, 0.18) 0%,
      transparent 60%
    ),
    radial-gradient(
      ellipse 60% 40% at 80% 80%,
      rgba(124, 58, 237, 0.12) 0%,
      transparent 60%
    );
  pointer-events: none;
  z-index: 0;
}

/* ---------- Layout Wrapper ---------- */
.app-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Header ---------- */
.site-header {
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  background: rgba(15, 15, 26, 0.8);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--purple-deep), var(--purple-main));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.logo-text {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.3px;
}

.logo-text span {
  color: var(--purple-light);
}

.header-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--purple-light);
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.5px;
}

/* ---------- Main Content ---------- */
.main-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

/* ---------- Card Base ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 48px 44px;
  width: 100%;
  max-width: 580px;
  box-shadow: var(--shadow);
  animation: fadeInUp 0.5s ease;
}

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

/* ---------- Tela Inicial ---------- */
.welcome-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--purple-deep), var(--purple-main));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 28px;
  box-shadow: 0 8px 32px rgba(124, 58, 237, 0.4);
}

.card-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 8px;
  line-height: 1.3;
}

.card-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 36px;
  line-height: 1.6;
}

/* ---------- Formulário ---------- */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  padding: 13px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--purple-mid);
  background: rgba(139, 92, 246, 0.06);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input.error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.field-error {
  font-size: 12px;
  color: var(--error);
  margin-top: 6px;
  display: none;
}

.field-error.visible {
  display: block;
}

/* ---------- Botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--purple-main), var(--purple-deep));
  color: #fff;
  width: 100%;
  margin-top: 8px;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(124, 58, 237, 0.5);
  filter: brightness(1.1);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: rgba(139, 92, 246, 0.12);
  color: var(--purple-light);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(139, 92, 246, 0.22);
  border-color: var(--border-hover);
}

/* ---------- Tela de Perguntas ---------- */
.quiz-screen {
  max-width: 680px;
}

/* Cabeçalho do quiz */
.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.question-counter {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.question-counter strong {
  color: var(--purple-light);
  font-size: 16px;
}

.score-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--purple-light);
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid var(--border);
  padding: 5px 14px;
  border-radius: 999px;
}

/* Barra de progresso */
.progress-container {
  margin-bottom: 32px;
}

.progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple-main), var(--purple-light));
  border-radius: 999px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Enunciado */
.question-text {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 28px;
  padding: 20px 22px;
  background: rgba(139, 92, 246, 0.05);
  border-left: 3px solid var(--purple-main);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Alternativas */
.alternatives-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}

.alternative-btn {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  width: 100%;
  font-family: inherit;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}

.alternative-btn:hover:not(:disabled) {
  background: rgba(139, 92, 246, 0.1);
  border-color: var(--border-hover);
  transform: translateX(4px);
}

.alternative-btn:disabled {
  cursor: default;
}

.alternative-btn.selected {
  background: rgba(139, 92, 246, 0.15);
  border-color: var(--purple-mid);
}

.alternative-btn.correct {
  background: var(--success-bg);
  border-color: var(--success);
}

.alternative-btn.wrong {
  background: var(--error-bg);
  border-color: var(--error);
}

.alt-letter {
  width: 30px;
  height: 30px;
  min-width: 30px;
  background: rgba(139, 92, 246, 0.2);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--purple-light);
  transition: var(--transition);
}

.alternative-btn.correct .alt-letter {
  background: rgba(16, 185, 129, 0.3);
  color: var(--success);
}

.alternative-btn.wrong .alt-letter {
  background: rgba(239, 68, 68, 0.3);
  color: var(--error);
}

.alt-text {
  flex: 1;
}

/* Feedback inline */
.feedback-box {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 20px;
  display: none;
  align-items: center;
  gap: 10px;
}

.feedback-box.visible {
  display: flex;
}
.feedback-box.correct-fb {
  background: var(--success-bg);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.feedback-box.wrong-fb {
  background: var(--error-bg);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ---------- Tela de Resultado ---------- */
.result-screen {
  max-width: 560px;
}

.result-score-circle {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple-deep), var(--purple-main));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 32px;
  box-shadow:
    0 0 50px rgba(124, 58, 237, 0.4),
    0 0 100px rgba(124, 58, 237, 0.15);
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 40px rgba(124, 58, 237, 0.4);
  }
  50% {
    box-shadow: 0 0 70px rgba(124, 58, 237, 0.6);
  }
}

.result-score-number {
  font-size: 42px;
  font-weight: 900;
  color: #fff;
  line-height: 1;
}

.result-score-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 4px;
}

.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 28px;
}

.stat-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 12px;
  text-align: center;
}

.stat-number {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-item.acertos .stat-number {
  color: var(--success);
}
.stat-item.erros .stat-number {
  color: var(--error);
}
.stat-item.total .stat-number {
  color: var(--purple-light);
}

.result-message {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid var(--border);
  border-left: 4px solid var(--purple-main);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 16px 20px;
  font-size: 14px;
  color: var(--purple-pale);
  line-height: 1.6;
  margin-bottom: 28px;
}

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

/* ---------- Loading Spinner ---------- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

.spinner.visible {
  display: block;
}

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

/* ---------- Toast Notification ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: var(--shadow);
  z-index: 999;
  transform: translateY(80px);
  opacity: 0;
  transition: var(--transition);
  max-width: 320px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  border-color: rgba(16, 185, 129, 0.4);
}
.toast.error {
  border-color: rgba(239, 68, 68, 0.4);
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 20px 24px;
  text-align: center;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.site-footer a {
  color: var(--purple-light);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* ---------- Utilitários ---------- */
.hidden {
  display: none !important;
}
.text-center {
  text-align: center;
}

/* ---------- Responsividade ---------- */
@media (max-width: 640px) {
  .card {
    padding: 32px 22px;
    border-radius: var(--radius-lg);
  }
  .card-title {
    font-size: 22px;
  }
  .quiz-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .result-stats {
    grid-template-columns: 1fr 1fr;
  }
  .result-stats .stat-item:last-child {
    grid-column: 1 / -1;
  }
  .site-header {
    padding: 14px 16px;
  }
  .header-badge {
    display: none;
  }
}

@media (max-width: 400px) {
  .card {
    padding: 24px 16px;
  }
  .question-text {
    font-size: 15px;
  }
  .alternative-btn {
    padding: 13px 14px;
    font-size: 13px;
  }
}
