/* Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  font-family: 'Segoe UI', sans-serif;
  background-color: #000000;
  color: #333;
  line-height: 1.6;
  padding: 1rem;
}

.container {
  /* Meilleure gestion de la largeur pour s'adapter à tous les écrans */
  max-width: 1000px; /* Limite la largeur maximale sur les très grands écrans (ajuste si besoin) */
  width: 90%;      /* Prend 90% de la largeur disponible de l'écran, jusqu'à la max-width */
  margin: auto;
  background-color: #fff;
  padding: 1.25rem;
  border-radius: 10px;
  box-shadow: 0 0 8px rgba(0, 123, 255, 0.1);
}

h1 {
  text-align: center;
  color: #007bff;
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.subtitle {
  text-align: center;
  color: #666;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

form input[type="text"] {
  width: 100%;
  padding: 8px 12px;
  font-size: 1rem;
  border: 2px solid #ccc;
  border-radius: 6px;
  background-color: #fff;
  color: #333;
  margin-bottom: 0.5rem;
  transition: border 0.2s ease-in-out;
}

form input[type="text"]:focus {
  outline: none;
  border-color: #007bff;
}

.buttons {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  font-size: 0.95rem;
  transition: all 0.2s ease-in-out;
}

.btn-primary {
  background-color: #007bff;
  color: white;
}

.btn-primary:hover {
  background-color: #0056b3;
}

.btn-secondary {
  background-color: #e9ecef;
  color: #333;
}

.btn-secondary:hover {
  background-color: #d4d4d4;
}

/* Bloc pour afficher un mot valide */
.word-valid-container {
  background-color: #e3f2fd;
  border: 2px solid #bbdefb;
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
  margin-top: 1.5rem;
  box-shadow: 0 4px 8px rgba(0, 123, 255, 0.1);
  transition: all 0.2s ease-in-out;
}

.word-valid-container:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 123, 255, 0.15);
}

.word-valid-container h2 {
  color: #007bff;
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.word-valid-container h2::before {
  content: '✅';
  font-size: 1.2rem;
}

.word-valid-container p {
  font-size: 1rem;
  color: #333;
  margin-bottom: 1rem;
}

.token-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 1rem;
}

.token {
  width: 32px;
  height: 32px;
  background: #f1f1f1;
  border: 2px solid #007bff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.9rem;
  color: #007bff;
  transition: background 0.2s ease-in-out;
}

.token:hover {
  background-color: #e0f0ff;
}

.resultat {
  margin-top: 1rem;
}

.possible-words-section {
  margin-top: 1.5rem;
  background-color: #f8f9fa;
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid #dee2e6;
}

.word-group {
  margin-bottom: 1rem;
}

.word-group h3 {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 0.3rem;
}

.word-list,
.suggestions-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.5rem;
  padding: 0;
}

.word-item,
.suggestion-item {
  background-color: #e9f0ff;
  border: 1px solid #c0daff;
  border-radius: 6px;
  padding: 6px 10px;
  text-align: center;
  font-weight: bold;
  font-size: 0.9rem;
  color: #007bff;
  transition: all 0.2s ease-in-out;
}

.word-item:hover,
.suggestion-item:hover {
  background-color: #d4e3ff;
  border-color: #a3c7ff;
}

.word-item .points {
  display: block;
  font-size: 0.75rem;
  color: #888;
  margin-top: 2px;
}

/* Style du lien "J'aime" */
.like-link {
  color: #ff4d4d;
  text-decoration: none;
  font-weight: bold;
  transition: color 0.2s ease;
  display: inline-block;
}

.like-link:hover {
  color: #cc0000;
}

/* Wrapper pour forcer l'espace en haut */
.vote-link-wrapper {
  display: block;
  clear: both;
  margin-top: 1rem;
  text-align: center;
}

/* Liens stylisés */
.word-link,
a {
  color: #007bff;
  text-decoration: none;
  padding: 2px 1px;
  border-radius: 3px;
  display: inline-block;
  transition: all 0.2s ease-in-out;
}

.word-link:hover,
a:hover {
  background-color: #e0f0ff;
  border-bottom: 1px dashed #007bff;
}

.footer {
  margin-top: 1.5rem;
  text-align: center;
  color: #999;
  font-size: 0.85rem;
}
.sub-footer {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: #aaa;
  text-align: center;
}
.search-info {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.95rem;
  color: #666;
  padding: 0 1rem;
}

.search-info p {
  display: inline-block;
  max-width: 600px;
  width: 100%;
  padding: 12px 16px;
  background-color: #f8f8f8;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45); /* Ombre douce et visible */
  transition: box-shadow 0.3s ease;
  font-style: italic;
}
/* --- Styles pour les mots aléatoires --- */
.random-words-suggestion {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed #ddd; /* Une petite séparation visuelle */
    text-align: center; /* Centre le texte d'intro "Besoin d'inspiration ?" */
}

.random-words-intro {
    font-size: 1em;
    color: #000;
    margin-bottom: 15px;
    font-style: normal; /* Annule l'italique du .search-info p */
}

.random-words-list {
    display: grid; /* UTILISATION DE CSS GRID */
    /* Crée des colonnes auto-ajustables : au moins 250px de large, prend 1 part égale de l'espace restant */
    /* Cela va créer 2 colonnes si la largeur le permet (~500px), sinon une seule, ou plus si la largeur est très grande. */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 5px 30px; /* Espacement vertical et horizontal entre les éléments */
    justify-content: center; /* Centre la grille si elle ne prend pas toute la largeur */
    max-width: 800px; /* Limite la largeur de la grille */
    margin: 0 auto; /* Centre la grille sur la page */
    text-align: left; /* Aligner les mots à gauche dans chaque "cellule" de la grille */
}

.random-word-link {
    display: inline-flex; /* Garde le mot et les points sur la même ligne */
    align-items: baseline; /* Alignement de base pour le mot et les points */
    padding: 2px 0; /* Petit padding vertical, pas de padding horizontal */
    color: #007bff; /* Bleu pour les liens */
    text-decoration: none; /* Pas de soulignement par défaut */
    font-weight: normal; /* Normal pour le texte */
    font-size: 1em;
    transition: color 0.2s ease;
}

.random-word-link:hover {
    color: #0056b3; /* Bleu plus foncé au survol */
    text-decoration: underline; /* Souligné au survol */
}

.random-word-points {
    font-size: 0.9em; /* Taille légèrement plus petite pour les points */
    color: #333; /* Couleur plus foncée pour les points */
    margin-left: 5px; /* Petit espace entre le mot et les points */
    font-weight: normal; /* Les points ne sont pas en gras */
}
.social-media-buttons {
  display: flex;
  justify-content: center;
  margin-top: 10px;
  margin-bottom: 20px;
}

.social-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0 10px;
  background-color: #333;
  color: white;
  border-radius: 50%;
  font-size: 20px;
  text-decoration: none;
  transition: background-color 0.3s;
}

.social-button:hover {
  background-color: #555;
}
.vote-section {
    text-align: center;
    margin-top: 15px;
}


  .like-button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      height: 40px;
      min-width: 60px;
      padding: 0 12px;
      border-radius: 6px;
      background-color: #333;
      color: white;
      font-size: 18px;
      text-decoration: none;
      transition: all 0.2s ease;
      margin-left: 10px;
  }

  .like-button:hover {
      background-color: #d63384;
      color: white;
  }

  .like-button .heart {
      margin-right: 6px;
  }

  #like-count {
      font-size: 16px;
      font-weight: bold;
      min-width: 24px;
      text-align: right;
  }

  .centered-message {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      padding: 16px 24px;
      background-color: #fff;
      color: #333;
      border-left: 5px solid #d63384;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
      font-size: 16px;
      font-weight: bold;
      z-index: 9999;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.4s ease;
      display: none;
      border-radius: 6px;
  }

  .centered-message.show {
      display: block;
      opacity: 1;
  }

.visitors-count {
    font-size: 14px;
    color: #666;
    text-align: center;
    margin-top: 10px;
}

/* Pour les tablettes (max-width: 768px) */
@media (max-width: 768px) {
  html {
    font-size: 15px; /* Base de police légèrement réduite */
  }

  .container {
    width: 25%;     /* Le conteneur prend 95% de la largeur */
    padding: 1rem;  /* Padding légèrement réduit pour laisser plus de place au contenu */
  }

  /* Ajustements pour les éléments à l'intérieur du container */
  .token {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
  }

  form input[type="text"] {
    font-size: 0.95rem;
    padding: 6px 10px;
  }

  .word-list,
  .suggestions-list {
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); /* Les colonnes s'adaptent, min 80px */
  }

  .word-item,
  .suggestion-item {
    font-size: 0.85rem;
    padding: 5px 8px;
  }

  .buttons {
    flex-wrap: wrap; /* Permet aux boutons de passer à la ligne si l'espace est insuffisant */
    gap: 0.5rem;    /* Réduit l'espace entre les boutons */
  }

  .btn {
    padding: 7px 12px; /* Réduit la taille des boutons */
    font-size: 0.9rem;
  }
}

/* Pour les smartphones (max-width: 480px) */
@media (max-width: 480px) {
  html {
    font-size: 14px; /* Base de police encore un peu réduite pour les plus petits écrans */
  }

  .container {
    width: 98%;     /* Très large pour maximiser l'espace, petites marges */
    padding: 0.75rem; /* Padding encore plus réduit */
    min-width: 0;   /* S'assurer qu'il n'y a pas de largeur minimale cachée qui force le débordement */
  }

  h1 {
    font-size: 1.3rem; /* Réduit la taille du titre */
  }

  .subtitle {
    font-size: 0.9rem; /* Réduit la taille du sous-titre */
  }

  .token-container {
    gap: 4px; /* Réduit l'espace entre les jetons pour qu'ils s'affichent mieux */
  }

  .token {
    width: 26px;
    height: 26px;
    font-size: 0.8rem;
  }

  form input[type="text"] {
    font-size: 0.9rem;
    padding: 6px 8px;
  }

  .buttons {
    flex-direction: column; /* Force les boutons à s'empiler verticalement sur les très petits écrans */
    gap: 0.5rem;
  }

  .btn {
    width: 100%; /* Les boutons prennent toute la largeur disponible */
    padding: 8px 10px;
    font-size: 0.9rem;
  }

  .word-list,
  .suggestions-list {
    grid-template-columns: repeat(auto-fit, minmax(65px, 1fr)); /* Min-width des colonnes encore réduit */
    gap: 0.4rem; /* Réduit l'espace entre les mots */
  }

  .word-item,
  .suggestion-item {
    font-size: 0.75rem; /* Taille de police plus petite pour les mots */
    padding: 4px 5px;
  }

  .word-item .points {
    font-size: 0.7rem; /* Taille de police plus petite pour les points */
  }
}

/* Une media query supplémentaire pour les écrans vraiment très petits (ex: iPhone SE, anciens modèles) */
@media (max-width: 375px) {
  html {
    font-size: 13px; /* Base de police encore plus petite si nécessaire */
  }

  .container {
    padding: 0.6rem; /* Encore moins de padding */
  }

  h1 {
    font-size: 1.2rem;
  }

  .subtitle {
    font-size: 0.85rem;
  }

  .token {
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
  }

  .word-list,
  .suggestions-list {
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  }

  .word-item,
  .suggestion-item {
    font-size: 0.7rem;
    padding: 3px 4px;
  }
}
