@import url("https://fonts.googleapis.com/css2?family=Comfortaa:wght@300..700&display=swap");

body {
  font-family: "Comfortaa", Arial, sans-serif;
  background-color: #f0f0f0;
  text-align: center;
  margin-top: 50px;
  position: relative;
  background-image: url(images/krozmoz_backgroundM7.png);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  min-height: 100vh;
}

h1 {
  color: #ae0ba6;
  font-size: 75px;
  margin: 10px;
  padding: 10px;
  text-shadow: 5px 5px 10px black;
}

h1 span {
  color: rgb(8, 129, 241);
}

/* Menu en haut à droite */
.top-menu {
  position: fixed;
  top: 15px;
  right: 15px;
  display: flex;
  gap: 10px;
  align-items: center;
  z-index: 100;
}

.menu-item {
  display: flex;
  align-items: center;
}

.stats-btn {
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: all 0.3s ease;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  color: white;
  font-size: 28px;
}

.stats-btn:hover {
  background-color: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.05);
}

.language-btn {
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: all 0.3s ease;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  overflow: hidden;
}

.language-btn:hover {
  background-color: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.05);
}

.flag-icon {
  width: 42px;
  height: 32px;
  object-fit: cover;
  border-radius: 2px;
  display: block;
}

.settings-btn {
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  background-color: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s ease;
  outline: none;
}

.settings-btn:hover {
  background-color: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
  transform: rotate(90deg);
}

.input-container {
  display: flex;
  justify-content: center;
  align-items: stretch;
  margin: 5px;
  position: relative;
  gap: 5px;
}

.rep {
  padding: 10px;
  margin: 0;
  margin-right: 0px;
  width: 300px;
  /* Fixer la largeur de l'input */
  position: relative;
  /* Nécessaire pour aligner les suggestions */
  height: auto;
  box-sizing: border-box;
}

button {
  padding: 10px;
  margin: 0;
  width: 100px;
  height: auto;
  box-sizing: border-box;
}

#feedback {
  margin-top: 20px;
  font-size: 25px;
  font-weight: bold;
  text-shadow: 1px 1px 0px white,
    /* Ombre vers le bas à droite */ -1px 1px 0px white,
    /* Ombre vers le bas à gauche */ 1px -1px 0px white,
    /* Ombre vers le haut à droite */ -1px -1px 0px white; /* Ombre vers le haut à gauche */
}

#suggestions {
  border: 1px solid #ddd;
  border-radius: 8px;
  display: none;
  position: absolute;
  background-color: #fff;
  width: 300px;
  /* Correspond à la largeur de l'input */
  text-align: left;
  margin-top: 5px;
  /* Espace entre l'input et les suggestions */
  z-index: 1;
  left: 50%;
  transform: translateX(calc(-50% - 52.5px));
  top: 100%;
  /* Position en dessous de l'input */
  box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.15);
  /* Ajoute une ombre pour le style */
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Autres styles inchangés */
.answers-container {
  max-width: 800px;
  margin: 20px auto;
  overflow-x: auto;
}

input {
  margin-right: 0px;
  border-radius: 20px 0 0 20px;
  /*box-shadow: 0 5px 10px 5px #000000;*/
  box-sizing: border-box;
  border: 1px solid #ccc;
}

input::placeholder {
  color: #666;
  opacity: 0.8;
  font-style: italic;
}

.btn-submit {
  margin: 0px;
  border-radius: 0 20px 20px 0;
  /*box-shadow: 0 5px 10px 5px #000000;*/
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #ccc;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px;
  border: 1px solid #ccc;
  text-align: center;
  width: calc(100% / 6);
  /* Ajustement pour 7 colonnes */
}

td {
  text-shadow: 2px 2px 5px #000;
  padding: 0px;
}

th {
  background-color: #f0f0f0;
  font-weight: bold;
  box-shadow: inset 1px 1px 1px 1px black;
}

.square-image {
  max-width: 100%;
  max-height: 100%;
}

.square-image img {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 5px;
}

.correct {
  background-color: #4caf50;
  /* Vert pour correspondance totale */
  color: white;
}

.partial-correct {
  background-color: #ffa500;
  /* Orange pour correspondance partielle */
  color: white;
}

.incorrect {
  background-color: #f44336;
  /* Rouge pour aucune correspondance */
  color: white;
}

.correct,
.partial-correct,
.incorrect {
  box-shadow: inset 1px 1px 10px 1px black;
}

/*tr:nth-child(even) { background-color: #f9f9f9;}*/

/* Styles pour le pop-up de victoire */
.win-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #fff;
  padding: 40px 20px 20px 20px;
  box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 2;
  border-radius: 10px;
  text-align: center;
  max-width: 400px;
  width: 80%;
}

.win-content {
  position: relative;
}

.win-popup img {
  max-width: 100%;
  border-radius: 5px;
  margin-bottom: 10px;
}

.close {
  position: absolute;
  top: 5px;
  right: 5px;
  font-size: 20px;
  cursor: pointer;
  color: #333;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  font-weight: bold;
}

.win-popup button {
  padding: 10px 20px;
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.win-popup button:hover {
  background-color: #45a049;
}

/* Styles pour le pop-up de statistiques */
.stats-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #fff;
  padding: 40px 20px 20px 20px;
  box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 2;
  border-radius: 10px;
  text-align: center;
  max-width: 500px;
  width: 90%;
}

.stats-content {
  position: relative;
}

.stats-content h2 {
  margin-bottom: 20px;
  color: #333;
  font-size: 28px;
}

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

.stat-item {
  background-color: #f5f5f5;
  padding: 15px;
  border-radius: 8px;
  transition: transform 0.2s ease;
}

.stat-item:hover {
  transform: translateY(-2px);
  box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.1);
}

.stat-value {
  font-size: 32px;
  font-weight: bold;
  color: #ae0ba6;
  margin-bottom: 5px;
}

.stat-label {
  font-size: 14px;
  color: #666;
}

.already-played {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background-color: #e8f5e9;
  border-radius: 8px;
  color: #2e7d32;
  margin-top: 15px;
  font-weight: 500;
}

.already-played .material-symbols-outlined {
  font-size: 20px;
}

/* Styles pour les flèches */
.arrow-icon {
  width: 20px;
  /* Taille de la flèche */
  height: 20px;
  opacity: 0.5;
  /* Opacité à 50% */
  margin-left: 5px;
  /* Espace entre la flèche et le texte */
  vertical-align: middle;
  /* Aligne la flèche avec le texte */
}

/* Flèche vers le haut */
.arrow-up {
  content: url("images/fleche-haut.png");
}

/* Flèche vers le bas */
.arrow-down {
  content: url("images/fleche-bas.png");
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.fade-in-cell {
  animation: fadeIn 0.25s ease-in-out forwards;
  opacity: 0;
  /* Assurez-vous qu'elles sont invisibles au début */
}

.suggestion-item {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s ease;
}

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

.suggestion-item:hover {
  background-color: #f5f5f5;
}

.suggestion-item:active {
  background-color: #e8e8e8;
}

.suggestion-image {
  width: 30px;
  /* Taille de l'image */
  height: 30px;
  margin-right: 10px;
  /* Espace entre l'image et le nom */
  border-radius: 25px;
  /* Coins arrondis */
  object-fit: cover;
}

/* Style pour la barre de navigation */
nav {
  background-color: #333;
  padding: 1em;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 3;
  /* Assurez-vous qu'elle reste au-dessus des autres éléments */
}

nav ul {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 2em;
  margin: 0;
  padding: 0;
}

nav ul li {
  display: inline;
}

nav ul li a {
  color: white;
  text-decoration: none;
  font-weight: bold;
}

nav ul li a:hover {
  text-decoration: underline;
}

/* Media queries pour le responsive mobile */
@media screen and (max-width: 768px) {
  body {
    margin-top: 20px;
    padding: 0 10px;
  }

  h1 {
    font-size: 40px;
    margin: 5px;
    padding: 5px;
  }

  /* Menu en haut à droite - plus petit sur mobile */
  .top-menu {
    top: 10px;
    right: 10px;
    gap: 8px;
  }

  .stats-btn,
  .language-btn {
    width: 50px;
    height: 50px;
    font-size: 24px;
  }

  .flag-icon {
    width: 36px;
    height: 28px;
  }

  /* Input container responsive */
  .input-container {
    margin: 10px 5px;
    gap: 3px;
    flex-wrap: wrap;
  }

  .rep {
    width: calc(100% - 110px);
    min-width: 200px;
    padding: 12px;
    font-size: 16px; /* Évite le zoom sur iOS */
  }

  button.btn-submit {
    width: 50px;
    min-width: 50px;
    padding: 12px 8px;
  }

  #suggestions {
    width: calc(100% - 110px);
    max-width: calc(100vw - 20px);
    left: 50%;
    transform: translateX(calc(-50% - 25px));
  }

  #feedback {
    font-size: 18px;
    margin-top: 15px;
    padding: 0 10px;
  }

  /* Tableau responsive */
  .answers-container {
    max-width: 100%;
    margin: 15px auto;
    padding: 0 5px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 600px; /* Largeur minimale pour garder la lisibilité */
    font-size: 12px;
  }

  th,
  td {
    padding: 6px 4px;
    font-size: 11px;
  }

  th {
    font-size: 10px;
    padding: 8px 4px;
  }

  /* Popups responsive */
  .win-popup,
  .stats-popup {
    width: 95%;
    max-width: 95%;
    padding: 30px 15px 15px 15px;
    max-height: 90vh;
    overflow-y: auto;
  }

  .win-popup h2,
  .stats-content h2 {
    font-size: 22px;
    margin-bottom: 15px;
  }

  .win-popup img {
    max-width: 80%;
  }

  /* Stats grid - 1 colonne sur mobile */
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 15px;
  }

  .stat-item {
    padding: 12px;
  }

  .stat-value {
    font-size: 28px;
  }

  .stat-label {
    font-size: 13px;
  }

  /* Suggestions responsive */
  .suggestion-item {
    padding: 10px 12px;
  }

  .suggestion-image {
    width: 25px;
    height: 25px;
  }
}

/* Media queries pour très petits écrans */
@media screen and (max-width: 480px) {
  h1 {
    font-size: 32px;
  }

  .top-menu {
    top: 8px;
    right: 8px;
    gap: 6px;
  }

  .stats-btn,
  .language-btn {
    width: 45px;
    height: 45px;
    font-size: 20px;
  }

  .flag-icon {
    width: 32px;
    height: 24px;
  }

  .rep {
    width: calc(100% - 100px);
    padding: 10px;
    font-size: 16px;
  }

  button.btn-submit {
    width: 45px;
    min-width: 45px;
    padding: 10px 6px;
  }

  #suggestions {
    width: calc(100% - 100px);
    transform: translateX(calc(-50% - 22.5px));
  }

  table {
    min-width: 550px;
    font-size: 11px;
  }

  th,
  td {
    padding: 5px 3px;
    font-size: 10px;
  }

  th {
    font-size: 9px;
    padding: 6px 3px;
  }

  .win-popup,
  .stats-popup {
    width: 98%;
    max-width: 98%;
    padding: 25px 12px 12px 12px;
  }

  .win-popup h2,
  .stats-content h2 {
    font-size: 20px;
  }

  .stat-value {
    font-size: 24px;
  }

  .stat-label {
    font-size: 12px;
  }
}

/* Orientation paysage sur mobile */
@media screen and (max-width: 768px) and (orientation: landscape) {
  body {
    margin-top: 10px;
  }

  h1 {
    font-size: 35px;
    margin: 3px;
  }

  .input-container {
    margin: 8px 5px;
  }

  .answers-container {
    margin: 10px auto;
  }

  table {
    min-width: 700px;
  }
}