/* ==========================================================================
   VARIÁVEIS GLOBAIS E CORES BASE
   ========================================================================== */
:root {
  --bg-gradient: linear-gradient(135deg, #0b1120 0%, #0f172a 100%);
  --card-bg: rgba(30, 41, 59, 0.7);
  --card-border: rgba(255, 255, 255, 0.08);
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #10b981;
  --danger: #ef4444;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

/* ==========================================================================
   RESET E TIPOGRAFIA
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg-gradient);
  color: var(--text-main);
  font-family: "Inter", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3,
h4 {
  font-family: "Montserrat", sans-serif;
}

/* ==========================================================================
   ESTRUTURA PRINCIPAL E COMPONENTES COMUNS (GLASSMORPHISM)
   ========================================================================== */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.content-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
  flex-grow: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* CABEÇALHOS GERAIS */
.main-header {
  padding: 3rem 1.5rem;
  text-align: center;
}

.title-highlight {
  background: linear-gradient(90deg, #38bdf8, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
  font-size: 2.8rem;
  letter-spacing: -1px;
  margin-bottom: 1rem;
}

/* ==========================================================================
   BOTÕES (BUTTONS)
   ========================================================================== */
.btn {
  padding: 1rem 2rem;
  border-radius: 12px;
  font-weight: 600;
  font-family: "Inter", sans-serif;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn:active:not(:disabled) {
  transform: scale(0.96);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none !important;
}

/* Variantes de Botões */
.btn-main {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}
.btn-main:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}

.btn-success-action {
  background: linear-gradient(90deg, #10b981, #059669);
  color: white;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}
.btn-success-action:hover:not(:disabled) {
  background: linear-gradient(90deg, #059669, #047857);
}

.btn-error {
  background: var(--danger);
  color: white;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}
.btn-error:hover:not(:disabled) {
  background: #dc2626;
}

.btn-danger-outline {
  background: transparent;
  border: 2px solid var(--danger);
  color: #f87171;
}
.btn-danger-outline:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.1);
}

.btn-outline {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--card-border);
}
.btn-outline:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   DASHBOARD (ECRÃ INICIAL) E MÓDULOS
   ========================================================================== */
.dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.module-section {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 2rem;
  text-align: left;
}

.module-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.module-icon {
  background: rgba(56, 189, 248, 0.1);
  padding: 0.8rem;
  border-radius: 12px;
  color: #38bdf8;
}

.module-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: #f8fafc;
}
.module-desc {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

/* Grid de Casos Clínicos */
.cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.2rem;
}

.case-card {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--card-border);
  border-left: 4px solid #10b981;
  text-decoration: none;
  color: var(--text-main);
  transition: all 0.3s ease;
  cursor: pointer;
}

.case-card:hover {
  transform: translateY(-4px);
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.case-card.locked {
  border-left-color: #475569;
  opacity: 0.6;
  cursor: not-allowed;
}
.case-card.locked:hover {
  transform: none;
  background: rgba(30, 41, 59, 0.6);
  border-color: var(--card-border);
  box-shadow: none;
}

.case-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #10b981;
  margin-bottom: 0.5rem;
}
.case-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.case-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ==========================================================================
   QUIZ E PERGUNTAS (OPÇÕES, BARRA DE PROGRESSO)
   ========================================================================== */
.quiz-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--card-border);
  padding: 1rem 1.5rem;
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  transform: translateY(-100%);
  transition: transform 0.4s ease;
}

.quiz-header.active {
  transform: translateY(0);
  display: flex;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #3b82f6);
  border-radius: 10px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-fill.danger {
  background: var(--danger) !important;
}
.quiz-header-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.question-text {
  font-size: 1.25rem;
  line-height: 1.6;
  font-weight: 500;
  margin-bottom: 2rem;
}

.options-grid {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.option-btn {
  width: 100%;
  text-align: left;
  padding: 1.2rem 1.5rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  color: var(--text-main);
  font-size: 1rem;
  font-family: "Inter", sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.option-letter {
  background: rgba(255, 255, 255, 0.1);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
  transition: all 0.2s;
}

.option-btn:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateX(4px);
}
.option-btn:hover:not(:disabled) .option-letter {
  background: var(--primary);
}
.option-btn.selected {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}
.option-btn.selected .option-letter {
  background: var(--primary);
}
.option-btn.correct {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--success);
}
.option-btn.correct .option-letter {
  background: var(--success);
}
.option-btn.incorrect {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--danger);
  opacity: 0.8;
}
.option-btn.incorrect .option-letter {
  background: var(--danger);
}

/* Badges e Feedback */
.difficulty-badge {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1.5rem;
}
.badge-fácil {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-médio {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-difícil {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.feedback-box {
  margin-top: 1.5rem;
  padding: 1.2rem;
  border-radius: 12px;
  border-left: 4px solid;
}
.feedback-box.correct {
  background: rgba(16, 185, 129, 0.1);
  border-color: var(--success);
}
.feedback-box.incorrect {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--danger);
}
.feedback-title {
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.feedback-text {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #cbd5e1;
}

/* ==========================================================================
   RESULTADOS, ESTATÍSTICAS E GABARITO (REVISÃO)
   ========================================================================== */
.stats-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-box {
  padding: 1rem;
  text-align: center;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  transition: transform 0.3s ease;
}
.stat-box:hover {
  transform: translateY(-5px);
}
.stat-box .num {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 0.2rem;
}
.stat-box .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.score-circle {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: conic-gradient(
    var(--success) var(--score-deg, 0deg),
    rgba(255, 255, 255, 0.05) 0deg
  );
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 2rem;
  position: relative;
}
.score-circle::before {
  content: "";
  position: absolute;
  width: 130px;
  height: 130px;
  background: #0f172a;
  border-radius: 50%;
}
.score-number {
  position: relative;
  font-size: 2.5rem;
  font-weight: 800;
  font-family: "Montserrat", sans-serif;
}

.review-area {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 0.5rem;
}
.review-area::-webkit-scrollbar {
  width: 6px;
}
.review-area::-webkit-scrollbar-track {
  background: transparent;
}
.review-area::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

.filter-input {
  flex: 1;
  min-width: 200px;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: rgba(15, 23, 42, 0.8);
  color: white;
  font-family: "Inter", sans-serif;
  transition: all 0.3s;
}
.filter-input:focus {
  border-color: var(--primary);
  outline: none;
}
.filter-select {
  padding: 0.8rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: rgba(15, 23, 42, 0.8);
  color: white;
  font-family: "Inter", sans-serif;
  transition: all 0.3s;
  cursor: pointer;
}
.filter-select:focus {
  border-color: var(--primary);
  outline: none;
}
.filter-select option {
  background: #0f172a;
  color: white;
}

/* ==========================================================================
   ESTILOS ESPECÍFICOS: DESAFIOS CLÍNICOS E MODAIS
   ========================================================================== */
.scenario-box {
  background: rgba(56, 189, 248, 0.05);
  border-left: 4px solid var(--primary);
  padding: 1.5rem;
  border-radius: 0 12px 12px 0;
  margin-bottom: 2rem;
}

.steps-indicator {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
}
.step-dot {
  width: 40px;
  height: 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  transition: background 0.3s;
}
.step-dot.active {
  background: var(--primary);
}
.step-dot.completed {
  background: var(--success);
}

/* Modais de Feedback (Desafios Práticos) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 1rem;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #1e293b;
  width: 100%;
  max-width: 500px;
  border-radius: 16px;
  padding: 2rem;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-align: center;
  border: 2px solid;
}
.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}

.modal-content.error {
  border-color: var(--danger);
  box-shadow: 0 10px 40px rgba(239, 68, 68, 0.2);
}
.modal-content.success {
  border-color: var(--success);
  box-shadow: 0 10px 40px rgba(16, 185, 129, 0.2);
}

.modal-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}
.modal-icon.error {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}
.modal-icon.success {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success);
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
}
.modal-text {
  color: #cbd5e1;
  font-size: 1.05rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

/* ==========================================================================
   RESPONSIVIDADE (MOBILE)
   ========================================================================== */
@media (max-width: 600px) {
  .title-highlight {
    font-size: 2rem;
  }
  .stats-container {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }
  .question-text {
    font-size: 1.1rem;
  }
  .content-wrapper {
    padding: 1rem;
  }
  .glass-card {
    padding: 1.5rem !important;
  }
  .btn {
    width: 100%;
    justify-content: center;
  }
  .filter-select {
    width: 100%;
  }
  .module-section {
    padding: 1.5rem;
  }
}

/* Modal Warning (Confirmação de Saída) */
.modal-content.warning {
  border-color: #fbbf24;
  box-shadow: 0 10px 40px rgba(245, 158, 11, 0.2);
}
.modal-icon.warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}
