/* Estilos Gerais */
:root {
  --color-primary: #5e3e94;
  --color-highlight: #f39c12;
  --color-background: #f5f5f5;
  --color-text: #333333;
  --color-neutral: #6c757d;
}

body {
  background-color: var(--color-background);
  color: var(--color-text);
  font-family: 'Inter', sans-serif;
}

h1,
h2,
h3,
.button,
.mode-btn {
  font-family: 'Poppins', sans-serif;
  color: var(--color-primary);
}

body,
p,
label,
select,
input,
td,
th {
  font-family: 'Inter', sans-serif;
}

.mode-btn.active {
  background: var(--color-primary);
  color: white;
}

/* Telas */
#home-screen,
#question-container,
#config-screen,
#result-screen {
  background: white;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

#config-screen,
#result-screen {
  display: none;
}

/* Botões */
.btn {
  display: inline-block;
  margin: 10px 5px;
  padding: 12px 24px;
  font-size: 16px;
  cursor: pointer;
  border: none;
  border-radius: 4px;
  transition:
    background-color 0.3s ease,
    transform 0.2s ease;
}

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

.btn-primary:hover {
  background-color: #482f74;
  transform: translateY(-2px);
}

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

.btn-secondary:hover {
  background-color: #5a6268;
  transform: translateY(-2px);
}

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

.btn-highlight:hover {
  background-color: #d27c0c;
  transform: translateY(-2px);
}

/* classe .button não utilizada — bloco removido */

/* Timer */
#timer {
  font-size: 1.8em;
  font-weight: bold;
  color: #d9534f;
  text-align: center;
  margin: 15px 0;
}

/* Opções de Questão */
.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 25px 0;
}

.option {
  padding: 15px;
  border: 2px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.option:hover,
.selected {
  border-color: var(--color-primary);
}

.option:hover {
  background-color: #f0f7ff;
}

.selected {
  background-color: #e6f2ff;
}

.correct {
  border-color: #27ae60;
  background-color: #d4edda;
}

.incorrect {
  border-color: #e74c3c;
  background-color: #f8d7da;
}

/* Controles */
.controls {
  display: flex;
  justify-content: space-between;
  margin-top: 30px;
}

/* Modos */
.mode-selector {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 30px 0;
}

.mode-btn {
  padding: 15px 30px;
  font-size: 18px;
  border: 2px solid var(--color-primary);
  background: white;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.3s;
}

.mode-btn.active {
  background: var(--color-primary);
  color: white;
}

.option.correct {
  border-color: #27ae60;
  background-color: #d4edda;
}

.option.incorrect {
  border-color: #e74c3c;
  background-color: #f8d7da;
}

.status-icon {
  margin-right: 8px;
  font-weight: bold;
}

/* Relatório */
.report-section {
  margin: 25px 0;
  border-left: 4px solid;
  padding-left: 15px;
}

.strength {
  color: #27ae60;
  border-color: #27ae60;
}
.weakness {
  color: #e74c3c;
  border-color: #e74c3c;
}
.average {
  color: #f39c12;
  border-color: #f39c12;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 15px 0;
}

th,
td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

th {
  background-color: #e6f2f8;
}
.correct-answer {
  color: #27ae60;
  font-weight: bold;
}
.user-incorrect {
  color: #e74c3c;
  position: relative;
  padding-left: 25px;
}
.status-icon {
  position: absolute;
  left: 5px;
  font-size: 1.2em;
}
.explanation-box {
  background: #f8f9fa;
  padding: 15px;
  border-left: 3px solid var(--color-primary);
  margin: 15px 0;
  border-radius: 4px;
}
.question-status {
  margin-top: 10px;
  font-weight: bold;
}

/* Dificuldade */
.dificuldade {
  font-size: 0.8em;
  padding: 3px 8px;
  border-radius: 12px;
  margin-left: 10px;
  display: inline-block;
}
.facil {
  background: #27ae60;
  color: white;
}
.moderada {
  background: #f39c12;
  color: white;
}
.dificil {
  background: #e74c3c;
  color: white;
}
.muito_dificil {
  background: #8e44ad;
  color: white;
}

/* Progresso */
.progress-container {
  margin: 20px 0;
}
.progress-bar {
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
}
.progress {
  height: 100%;
  background: var(--color-primary);
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s;
}
.progress-text {
  text-align: center;
  margin-top: 5px;
  font-size: 0.9em;
  color: #666;
}

/* Responsivo */
@media (max-width: 768px) {
  .mode-selector,
  .controls,
  .quick-stats {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  .button {
    width: 100%;
  }

  .stat-box {
    font-size: 14px;
    padding: 15px;
  }

  h1,
  h2,
  h3 {
    font-size: 1.4em;
  }

  .report-section {
    padding: 15px;
  }

  table th,
  table td {
    font-size: 13px;
    padding: 8px;
  }
}
.explanation-box.correct {
  border-left: 3px solid #27ae60;
}
.explanation-box.incorrect {
  border-left: 3px solid #e74c3c;
}

.explanation-text {
  color: #333;
}
.correct-status {
  color: #27ae60 !important;
}
.incorrect-status {
  color: #e74c3c !important;
}

/* Relatório Completo */
#full-report-screen {
  display: none;
  background: white;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  margin: 20px 0;
}

.report-header {
  text-align: center;
  margin-bottom: 30px;
  border-bottom: 2px solid var(--color-primary);
  padding-bottom: 20px;
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.stat-box {
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  color: white;
}

.stat-box.correct {
  background: #27ae60;
}
.stat-box.incorrect {
  background: #e74c3c;
}
.stat-box.pending {
  background: #f39c12;
}

.stat-value {
  font-size: 2.5em;
  font-weight: bold;
  display: block;
}

.stat-label {
  font-size: 0.9em;
  opacity: 0.9;
}

.question-list {
  margin-top: 30px;
}

.question-item {
  margin-bottom: 40px;
  padding: 20px;
  border: 1px solid #eee;
  border-radius: 8px;
  position: relative;
}

.question-status {
  position: absolute;
  top: 15px;
  right: 15px;
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 0.8em;
}

.status-correct {
  background: #27ae60;
  color: white;
}

.status-incorrect {
  background: #e74c3c;
  color: white;
}

.explanation-panel {
  margin-top: 15px;
  padding: 15px;
  background: #f8f9fa;
  border-left: 3px solid var(--color-primary);
  border-radius: 4px;
}

/*========================*/
/* Estilos do Relatório de Performance*/
/*========================*/

.area-performance-chart {
  font-family: Arial, sans-serif;
  font-size: 0.875rem; /* text-sm */
  line-height: 1.25rem;
  border: 1px solid #e5e7eb; /* border-gray-200 */
  padding: 1rem; /* p-4 */
  border-radius: 0.5rem; /* rounded-lg */
}
.area-row {
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem; /* mb-3 */
  padding-bottom: 0.75rem; /* pb-3 */
  border-bottom: 1px solid #f3f4f6; /* border-gray-100 */
}
.area-row:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.area-name-label {
  width: 35%; /* Ajuste conforme necessário */
  padding-right: 1rem; /* pr-4 */
  color: #374151; /* text-gray-700 */
  font-weight: 500; /* medium (um pouco mais de destaque) */
}
.bar-graph-container {
  width: 55%; /* Ajuste conforme necessário */
  height: 20px; /* Altura da barra e do container */
  background-color: #e5e7eb; /* bg-gray-200 */
  border-radius: 0.25rem; /* rounded-sm */
  position: relative;
  overflow: hidden; /* Para arredondar a barra interna */
}
.performance-actual-bar {
  height: 100%;
  background-color: #6d28d9; /* bg-purple-700 - Cor para o desempenho */
  border-radius: 0.25rem; /* rounded-sm */
  transition: width 0.5s ease-in-out;
}
.borderline-marker-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px; /* Largura da linha de borderline */
  background-color: #ef4444; /* bg-red-500 - Cor para a linha de borderline */
  /* 'left' será definido por JS */
}
.area-accuracy-value {
  width: 10%; /* Ajuste conforme necessário */
  text-align: right;
  padding-left: 1rem; /* pl-4 */
  color: #4b5563; /* text-gray-600 */
  font-weight: 500;
}

/* Para a legenda do gráfico (Lower, Borderline, Higher) */
.graph-legend {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem; /* text-xs */
  color: #6b7280; /* text-gray-500 */
  margin-top: 0.5rem; /* mt-2 */
  padding: 0 35% 0 calc(35% + 1rem); /* Alinha com o bar-graph-container, ajuste o padding-left se .area-name-label mudar */
}
.legend-lower,
.legend-borderline,
.legend-higher {
  text-align: center;
}
.legend-borderline {
  /* Pode precisar de ajuste para centralizar com a linha */
}

/* ===================
* Gráfico de Nível de Dificuldade
=======================  */
.level-performance-chart {
  font-family: Arial, sans-serif;
  font-size: 0.875rem; /* text-sm */
  padding: 1rem; /* p-4 */
  /* Mantendo consistência com .area-performance-chart, mas sem a borda externa aqui,
       já que ele estará dentro da seção #level-analysis-section que já tem borda e padding.
       Você pode adicionar uma borda se preferir:
       border: 1px solid #e5e7eb;
       border-radius: 0.5rem; 
    */
}

.level-row {
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem; /* mb-3 */
}

.level-name-label {
  width: 25%; /* Ajuste conforme necessário */
  padding-right: 1rem; /* pr-4 */
  color: #374151; /* text-gray-700 */
  font-weight: 500;
  text-align: right; /* Alinha o nome do nível à direita para ficar perto da barra */
}

.level-bar-container {
  width: 65%; /* Ajuste conforme necessário */
  height: 20px;
  background-color: #e5e7eb; /* bg-gray-200 */
  border-radius: 0.25rem; /* rounded-sm */
  position: relative;
  overflow: hidden;
}

.level-accuracy-bar {
  height: 100%;
  background-color: #3b82f6; /* bg-blue-500 - Cor para as barras de dificuldade */
  border-radius: 0.25rem; /* rounded-sm */
  transition: width 0.5s ease-in-out;
  text-align: right; /* Para alinhar o texto da acurácia dentro da barra, se desejar */
  color: white;
  font-size: 0.75rem; /* text-xs */
  line-height: 20px; /* Mesma altura da barra para centralizar verticalmente */
  padding-right: 0.25rem; /* Pequeno padding para o texto não colar na borda */
}

.level-accuracy-value-outside {
  /* Se preferir o valor fora da barra */
  width: 10%;
  text-align: left; /* Alinha à esquerda após a barra */
  padding-left: 0.5rem; /* pl-2 */
  color: #4b5563; /* text-gray-600 */
  font-weight: 500;
}
/*===============
 Styling for the Study Suggestions Section 
 ================*/
.suggestions-card {
  background-color: #f3e8ff; /* purple-100 */
  border: 1px solid #c084fc; /* purple-400 */
  border-left: 5px solid #8b5cf6; /* purple-500 */
  border-radius: 0.75rem; /* rounded-xl */
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.suggestions-list-item {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  background-color: #ffffff;
  border-radius: 0.5rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.suggestions-list-item .accuracy-badge {
  font-size: 0.875rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px; /* rounded-full */
  color: #ffffff;
  margin-right: 1rem;
}

.suggestions-list-item .topic-name {
  font-weight: 600;
  color: #374151; /* gray-700 */
}

/* ===============
Styling for new interactive bar charts 
================== */
.interactive-chart-bar {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
  padding: 0.25rem;
  border-radius: 0.25rem;
  text-decoration: none;
  color: inherit;
  transition: background-color 0.2s;
}
.interactive-chart-bar:hover {
  background-color: #f3e8ff; /* purple-100 */
}
.interactive-chart-bar .bar-label {
  width: 120px;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.interactive-chart-bar .bar-container {
  flex-grow: 1;
  background-color: #e5e7eb; /* gray-200 */
  border-radius: 0.25rem;
  height: 20px;
}
.interactive-chart-bar .bar-fill {
  height: 100%;
  border-radius: 0.25rem;
}
.interactive-chart-bar .bar-value {
  width: 50px;
  text-align: right;
  font-size: 0.875rem;
  font-weight: bold;
}
.question-review-item.highlight {
  border: 2px solid #8b5cf6; /* purple-500 */
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}
/* ============
New Styles for Strengths/Weaknesses & Interactive Tags
==============  */

/* Strengths and Weaknesses Section */
.strengths-weaknesses-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .strengths-weaknesses-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.performance-summary-card {
  background-color: #f9fafb;
  border-radius: 0.75rem;
  padding: 1rem;
  border: 1px solid #e5e7eb;
}

.performance-summary-card h3 {
  display: flex;
  align-items: center;
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.performance-summary-card .icon {
  width: 1.5rem;
  height: 1.5rem;
  margin-right: 0.5rem;
}

.summary-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f3f4f6;
}

.summary-list-item:last-child {
  border-bottom: none;
}

.summary-list-item .accuracy-value {
  font-weight: 700;
}

/* Interactive Tags on Questions */
.question-tags-container {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.question-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  user-select: none; /* Prevent text selection on click/tap */
}

.question-tag:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.tag-area {
  background-color: #ede9fe; /* violet-100 */
  color: #5b21b6; /* violet-800 */
}

.tag-level-easy,
.tag-level-moderate {
  background-color: #dcfce7; /* green-100 */
  color: #166534; /* green-800 */
}

.tag-level-hard,
.tag-level-very-hard {
  background-color: #fee2e2; /* red-100 */
  color: #991b1b; /* red-800 */
}

/* Highlight effect for related questions */
.question-review-item.related-highlight {
  background-color: #fefce8; /* yellow-50 */
  border-color: #facc15; /* yellow-400 */
}

/* Fade effect for non-related questions */
.question-review-section-filtering .question-review-item:not(.related-highlight) {
  opacity: 0.4;
  transition: opacity 0.3s ease-in-out;
}

/* ==============
--- New Styles for Voronoi Topic Chart --- 
=================*/

#topic-chart-section {
  position: relative;
  background-color: #ffffff;
  border-radius: 0.75rem;
  padding: 1.5rem;
  border: 1px solid #e5e7eb;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.topic-voronoi-chart-container {
  width: 100%;
  height: 450px; /* Adjust height as needed */
}

.topic-voronoi-chart-container svg {
  width: 100%;
  height: 100%;
}

.voronoi-cell path {
  stroke: #ffffff;
  stroke-width: 2px;
  transition: opacity 0.2s ease-in-out;
}

.voronoi-cell:hover path {
  opacity: 0.8;
}

.voronoi-cell text {
  fill: white;
  font-size: 10px;
  font-weight: 600;
  text-anchor: middle;
  pointer-events: none; /* Text should not block mouse events */
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.7);
}

.voronoi-tooltip {
  position: absolute;
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  pointer-events: none; /* Tooltip should not block mouse events */
  opacity: 0;
  transition: opacity 0.2s;
  text-align: left;
}
