/* Reset e fonte */
body,
html {
  margin: 0;
  padding: 0;
  font-family: "Montserrat", sans-serif;
}
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: #f0f4f8;
}

/* Header */
header {
  background-color: #4a90e2;
  color: white;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
header h1 {
  margin: 0;
}
.avatar-small {
  width: 40px;
  border-radius: 50%;
  margin-right: 0.5rem;
  vertical-align: middle;
}

/* Main */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

/* Quiz Cards */
.quizzes-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  width: 100%;
}
.quiz-card {
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  padding: 0.8rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s;
  min-height: 320px;
}
.quiz-card:hover {
  transform: translateY(-5px);
}
.quiz-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}
.quiz-card h3,
.quiz-card p {
  text-align: center;
}
.quiz-card button {
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
  border: none;
  border-radius: 6px;
  background-color: #4a90e2;
  color: white;
  cursor: pointer;
  align-self: center;
}
.quiz-card button:hover {
  background-color: #357abd;
}

/* Level selection */
.level-container {
  text-align: center;
  background-color: #ffffff;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  max-width: 600px;
  margin: 3rem auto;
}

.level-container h2 {
  color: #333;
  margin-bottom: 1rem;
}

.level-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.level-buttons button {
  background-color: #4a90e2;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s;
}

.level-buttons button:hover {
  background-color: #357abd;
  transform: scale(1.05);
}

/* Ranking */
#ranking {
  margin-top: 2rem;
  padding: 1rem;
  background-color: #f9f9f9;
  border-radius: 12px;
  width: 100%;
  max-width: 1200px;
}
#ranking h2 {
  text-align: center;
  margin-bottom: 1rem;
}
.ranking-container {
  display: flex;
  justify-content: space-around;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.ranking-theme {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #f0f0f0;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  text-align: center;
  min-width: 120px;
  min-height: 80px;
}

/* Footer */
footer {
  background-color: #4a90e2;
  color: white;
  text-align: center;
  padding: 1rem;
}
footer a {
  color: white;
  text-decoration: underline;
}

/* === Quiz Page === */
.quiz-container {
  background-color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: 2rem;
  max-width: 600px;
  width: 100%;
  text-align: center;
  animation: fadeIn 0.5s ease;
}

.question {
  font-size: 1.3rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 1.5rem;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.options button {
  background-color: #e0e7ff;
  border: none;
  border-radius: 8px;
  padding: 0.9rem;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.options button:hover {
  background-color: #c7d2fe;
  transform: scale(1.03);
}

.feedback {
  margin-top: 1rem;
  font-weight: bold;
  color: #333;
  min-height: 1.5rem;
}

.score {
  margin-top: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: #4a90e2;
}

.btn-next {
  margin-top: 1.5rem;
  padding: 0.8rem 1.5rem;
  background-color: #4a90e2;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s;
}

.btn-next:hover {
  background-color: #357abd;
  transform: scale(1.05);
}

/* Botão de voltar na tela final */
.feedback .btn-next {
  margin-top: 1rem;
  background-color: #2ecc71;
}

.feedback .btn-next:hover {
  background-color: #27ae60;
}

/* Animação de entrada suave */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === Avatar e Menu Suspenso === */
.dropdown {
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.dropdown-menu {
  display: none;
  flex-direction: column;
  position: absolute;
  top: 55px;
  right: 0;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  overflow: hidden;
  z-index: 10;
  min-width: 180px;
  animation: fadeIn 0.2s ease;
}

.dropdown-menu button {
  background: none;
  border: none;
  text-align: left;
  padding: 0.8rem 1rem;
  width: 100%;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.dropdown-menu button:hover {
  background-color: #f0f4f8;
}

/* Mostrar o menu quando ativo */
.dropdown.active .dropdown-menu {
  display: flex;
}

/* Cursor e estilo do avatar */
#avatarImg {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid white;
  transition: transform 0.2s;
}

#avatarImg:hover {
  transform: scale(1.05);
}

/* === Modal de prévia do avatar === */
.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background: white;
  padding: 1.5rem 2rem;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  max-width: 350px;
}

.modal-content img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin: 1rem 0;
  border: 3px solid #4A90E2;
}

.modal-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.modal-buttons button {
  background-color: #4A90E2;
  border: none;
  color: white;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s;
}

.modal-buttons button:hover {
  background-color: #357ABD;
}

.modal-buttons #cancelAvatar {
  background-color: #e74c3c;
}

.modal-buttons #cancelAvatar:hover {
  background-color: #c0392b;
}

.quiz-dropdown {
  position: relative;
  cursor: pointer;
  padding: 5px 10px;
}

.quiz-dropdown .submenu {
  display: none;
  position: absolute;
  left: 100%;
  top: 0;
  background-color: #fff;
  border: 1px solid #ccc;
  min-width: 200px;
  z-index: 100;
  padding: 5px 0;
}

.quiz-dropdown:hover .submenu {
  display: block;
}

.submenu-item {
  padding: 5px 15px;
  cursor: pointer;
}

.sub-submenu {
  display: none;
  position: absolute;
  left: 100%;
  top: 0;
  background-color: #fff;
  border: 1px solid #ccc;
  min-width: 180px;
  padding: 5px 0;
}

.submenu-item:hover > .sub-submenu {
  display: block;
}

.sub-submenu li {
  padding: 5px 15px;
  cursor: pointer;
}

/* === Correção do nome do jogador === */
#playerNameHeader {
  color: #fff;
  font-weight: 600;
  margin-left: 8px;
}

/* === Corrigir sobreposição e visibilidade dos submenus === */
.dropdown-menu {
  position: absolute;
  z-index: 999; /* garante que fica sobre o resto do conteúdo */
}

/* Corrige a hierarquia dos submenus */
.quiz-dropdown .submenu {
  display: none;
  position: absolute;
  left: 100%;
  top: 0;
  background-color: #ffffff;
  border: 1px solid #ccc;
  min-width: 200px;
  z-index: 1000; /* mais alto que o menu principal */
}

/* Mostra o submenu ao passar o mouse */
.quiz-dropdown:hover .submenu {
  display: block;
}

/* Garante que sub-submenus também aparecem corretamente */
.sub-submenu {
  display: none;
  position: absolute;
  left: 100%;
  top: 0;
  background-color: #fff;
  border: 1px solid #ccc;
  min-width: 180px;
  z-index: 1001;
}

.submenu-item:hover > .sub-submenu {
  display: block;
}

/* === Correção do nome do jogador === */
#playerNameHeader {
  color: #ffffff !important; /* força cor branca */
  font-weight: 600;
  margin-left: 8px;
  z-index: 2000;
  position: relative;
}

/* === Forçar visibilidade do menu dropdown === */
.dropdown {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dropdown-menu {
  display: none;
  flex-direction: column;
  position: absolute;
  top: 60px;
  right: 0;
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  overflow: visible; /* importante */
  z-index: 3000;
  min-width: 220px;
}

.dropdown.active .dropdown-menu {
  display: flex !important;
}

/* === Corrige o submenu dos quizzes === */
.quiz-dropdown {
  position: relative;
  padding: 8px 12px;
  color: #222;
}

.quiz-dropdown:hover .submenu {
  display: block !important;
}

.quiz-dropdown .submenu {
  display: none;
  position: absolute;
  left: 100%;
  top: 0;
  background: #fff;
  border: 1px solid #ccc;
  min-width: 200px;
  z-index: 4000;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.submenu-item {
  padding: 8px 12px;
  cursor: pointer;
  color: #333;
}

.submenu-item:hover {
  background-color: #f0f4f8;
}

.submenu-item:hover > .sub-submenu {
  display: block !important;
}

.sub-submenu {
  display: none;
  position: absolute;
  left: 100%;
  top: 0;
  background-color: #fff;
  border: 1px solid #ccc;
  min-width: 180px;
  z-index: 5000;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.theme-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  text-align: center;
}
