/* ============================================
   Questionário de Análise Combinatória
   Estilos Principais
   ============================================ */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --secondary: #7c3aed;
  --success: #16a34a;
  --success-light: #dcfce7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --white: #ffffff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
  color: var(--gray-800);
  min-height: 100vh;
  line-height: 1.6;
}

/* ============ HEADER ============ */
header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: var(--white);
  padding: 1.5rem 2rem;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-title .icon {
  font-size: 2rem;
}

.header-title h1 {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.2;
}

.header-title p {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-top: 0.1rem;
}

.header-nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  border-radius: 99px;
  border: 1px solid rgba(255,255,255,0.35);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.header-nav a:hover {
  background: rgba(255,255,255,0.2);
  color: var(--white);
}

/* ============ MAIN CONTAINER ============ */
main {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1.5rem 3rem;
}

/* ============ CARDS ============ */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.card-title .badge {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  font-weight: 600;
}

/* ============ IDENTIFICAÇÃO DO ALUNO ============ */
#secao-identificacao {
  border-top: 4px solid var(--primary);
}

#secao-identificacao .intro-text {
  color: var(--gray-600);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--gray-800);
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--gray-50);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  background: var(--white);
}

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

/* ============ INFO BAR ============ */
.info-bar {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.info-badge {
  background: var(--gray-100);
  border-radius: 99px;
  padding: 0.4rem 1rem;
  font-size: 0.82rem;
  color: var(--gray-600);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.info-badge.topic-pfc { background: #e0f2fe; color: #0369a1; }
.info-badge.topic-arr { background: #f0fdf4; color: #15803d; }
.info-badge.topic-per { background: #fdf4ff; color: #7e22ce; }

/* ============ PROGRESS BAR ============ */
.progress-container {
  background: var(--gray-100);
  border-radius: 99px;
  height: 10px;
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.progress-bar {
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
  width: 0%;
}

.progress-text {
  font-size: 0.82rem;
  color: var(--gray-500);
  text-align: right;
}

/* ============ TIMER ============ */
.timer-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  padding: 0.5rem 1rem;
  background: var(--primary-light);
  border-radius: 99px;
}

/* ============ QUESTÕES ============ */
.questao-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  border-left: 4px solid var(--gray-200);
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
}

.questao-card:hover {
  box-shadow: var(--shadow-md);
}

.questao-card.respondida {
  border-left-color: var(--primary);
}

.questao-card.questao-facil { border-left-color: #22c55e; }
.questao-card.questao-intermediario { border-left-color: #f59e0b; }

.questao-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.questao-numero {
  background: var(--primary);
  color: var(--white);
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.questao-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  font-weight: 600;
}

.tag-topico-pfc { background: #e0f2fe; color: #0369a1; }
.tag-topico-arr { background: #f0fdf4; color: #15803d; }
.tag-topico-per { background: #fdf4ff; color: #7e22ce; }
.tag-facil { background: #dcfce7; color: #15803d; }
.tag-intermediario { background: #fef3c7; color: #b45309; }

.questao-enunciado {
  font-size: 0.95rem;
  color: var(--gray-800);
  line-height: 1.65;
  margin-bottom: 1.25rem;
  font-weight: 500;
}

/* ============ OPÇÕES ============ */
.opcoes-lista {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.opcao-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.opcao-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--gray-200);
  background: var(--gray-50);
  width: 100%;
  transition: all 0.2s;
  font-size: 0.9rem;
  color: var(--gray-700);
}

.opcao-label:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
}

.opcao-item input[type="radio"] {
  display: none;
}

.opcao-item input[type="radio"]:checked + .opcao-label {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
  font-weight: 600;
}

.opcao-letra {
  background: var(--gray-200);
  color: var(--gray-600);
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 0.05rem;
}

.opcao-item input[type="radio"]:checked + .opcao-label .opcao-letra {
  background: var(--primary);
  color: var(--white);
}

/* ============ BOTÕES ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--white);
  box-shadow: var(--shadow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  opacity: 0.95;
}

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

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover {
  background: var(--primary-light);
}

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

.btn-success:hover { background: #15803d; }

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.05rem;
}

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

/* ============ RESULTADO ============ */
#secao-resultado {
  display: none;
  text-align: center;
}

.resultado-score {
  font-size: 4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin: 1rem 0;
}

.resultado-label {
  font-size: 1.1rem;
  color: var(--gray-500);
}

.resultado-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}

.stat-box {
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.stat-box .stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gray-800);
}

.stat-box .stat-label {
  font-size: 0.78rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}

.stat-box.acertos .stat-value { color: var(--success); }
.stat-box.erros .stat-value { color: var(--danger); }

.resultado-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

/* ============ LOADING / OVERLAY ============ */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  align-items: center;
  justify-content: center;
}

.overlay.active {
  display: flex;
}

.overlay-content {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  max-width: 400px;
  width: 90%;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

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

/* ============ ALERTA/TOAST ============ */
.alert {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.alert-danger {
  background: var(--danger-light);
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.alert-success {
  background: var(--success-light);
  color: #166534;
  border: 1px solid #86efac;
}

.alert-warning {
  background: var(--warning-light);
  color: #78350f;
  border: 1px solid #fcd34d;
}

/* ============ QUESTÕES NÃO RESPONDIDAS ============ */
.questao-pendente {
  border-left-color: var(--danger) !important;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* ============ STICKY BOTTOM BAR ============ */
.sticky-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  padding: 1rem 1.5rem;
  z-index: 50;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}

.sticky-bar-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.sticky-counter {
  font-size: 0.9rem;
  color: var(--gray-600);
}

.sticky-counter strong {
  color: var(--primary);
  font-size: 1.1rem;
}

/* ============ SEÇÃO QUESTIONÁRIO ============ */
#secao-questionario { display: none; }

/* ============ RESPONSIVO ============ */
@media (max-width: 640px) {
  header { padding: 1rem; }
  .header-inner { flex-direction: column; text-align: center; }
  .header-title h1 { font-size: 1.1rem; }
  main { padding: 0 1rem 5rem; margin: 1rem auto; }
  .card { padding: 1.25rem; }
  .form-row { grid-template-columns: 1fr; }
  .resultado-stats { grid-template-columns: 1fr; }
  .questao-card { padding: 1.25rem; }
  .sticky-bar-inner { flex-direction: column; gap: 0.5rem; }
  .btn-lg { width: 100%; }
}
