@import url("https://fonts.googleapis.com/css2?family=Rubik:ital,wght@0,300..900;1,300..900&display=swap");

body {
  font-family: Rubik, sans-serif;
  background: linear-gradient(180deg, #87ceeb 0%, #90ee90 100%);
  min-height: calc (100vh - 260px);
}

.user-controls {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: #1e1e1e;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 2rem;
  padding-right: 10px;
}

.user-controls-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 15px; /* Espace entre les éléments */
  height: 100%;
}

.username {
  color: #eee;
}

.logout-button {
  background-color: #dc3545; /* Rouge */
  color: white;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background-color 0.2s;
  font-size: 0.9em;
}

.logout-button:hover {
  background-color: #c82333; /* Rouge plus foncé au survol */
}

.container {
  margin: 40px auto 0 auto;
  padding: 20px;
}

/* Layout principal */
.game-layout {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.editor-section {
  margin-bottom: 20px;
}

#sqlEditor {
  width: 100%;
  height: 150px;
  padding: 10px;
  margin-bottom: 10px;
  font-family: monospace;
  border: 1px solid #ddd;
  border-radius: 4px;
  resize: vertical;
}

.button-group {
  margin-bottom: 20px;
}

button {
  padding: 10px 20px;
  margin-right: 10px;
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: Rubik, sans-serif;
}

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

.hint-button {
  background-color: #2196f3;
}

.hint-button:hover {
  background-color: #1976d2;
}

#currentQuest {
  margin: 20px 0;
  padding: 15px;
  background-color: #fff3cd;
  border: 1px solid #ffeeba;
  border-radius: 4px;
}

/* Ajoutez ces styles dans la section styles du fichier index.php */

/* Zone de requête SQL fixe */
.query-section {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #1e1e1e;
  padding: 20px;
  color: white;
  height: 150px; /* Hauteur fixe pour la section complète */
  display: flex;
  flex-direction: column;
}

/* Container pour l'éditeur et les boutons */
.query-container {
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* Zone d'édition SQL */
.editor-container {
  background: #2d2d2d;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 10px;
  height: 100px; /* Hauteur fixe pour l'éditeur */
}

#sqlEditor {
  width: 100%;
  height: 100%;
  padding: 15px;
  background: #2d2d2d;
  color: #d4d4d4;
  border: none;
  font-family: "Consolas", monospace;
  font-size: 14px;
  resize: none; /* Désactive le redimensionnement */
}

/* Ajustement du padding du body pour compenser la zone fixe */
body {
  padding-bottom: 220px; /* 200px + 20px de marge */
}

/* Style pour la table de résultats */
.results-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

.results-table th,
.results-table td {
  padding: 12px;
  text-align: left;
  border: 1px solid #eee;
}

.results-table th {
  background: #f8f9fa;
  position: sticky;
  top: 0;
  z-index: 1;
}

.results-table tr:nth-child(even) {
  background: #f8f9fa;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

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

.results-table th {
  background-color: #f8f9fa;
  font-weight: bold;
}

.error-message {
  background-color: #fff3f3;
  border: 1px solid #ffcdd2;
  border-radius: 8px;
  margin: 10px 0;
  overflow: hidden;
  animation: slideIn 0.3s ease-out;
}

.error-header {
  background-color: #ffebee;
  padding: 12px 15px;
  color: #d32f2f;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.error-header i {
  font-size: 1.2em;
}

.error-tips {
  padding: 12px 15px;
}

.tip {
  color: #555;
  margin: 5px 0;
  font-size: 0.95em;
  line-height: 1.4;
}

.tip:before {
  content: "•";
  color: #d32f2f;
  margin-right: 8px;
}

@keyframes slideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.success-message,
.error-message,
.hint-dialog {
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 15px;
  animation: slideDown 0.3s ease-out;
}

.success-message {
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
}

.error-message {
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
}

.hint-dialog {
  background-color: #fff3cd;
  border: 1px solid #ffeeba;
  color: #856404;
}

/* Barre de progression */
.exploration-progress {
  margin-top: 20px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
}

.progress-bar {
  height: 10px;
  background: #e9ecef;
  border-radius: 5px;
  overflow: hidden;
}

.progress {
  height: 100%;
  background: #28a745;
  transition: width 0.3s ease;
}

.progress-text {
  text-align: center;
  margin-top: 5px;
  font-size: 0.9em;
  color: #6c757d;
}

/* Animations */
@keyframes slideDown {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Coloration syntaxique SQL */
.syntax-highlight {
  color: #0066cc;
  font-weight: bold;
}

.keyword {
  color: #e83e8c;
}

/* Loader */
.loader {
  display: flex;
  justify-content: center;
  margin: 20px 0;
}

/* Reprise du spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Table de résultats */
.results-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.results-table th,
.results-table td {
  padding: 12px;
  text-align: left;
  border: 1px solid #eee;
}

.results-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #333;
  position: sticky;
  top: 0;
}

.results-table tr:nth-child(even) {
  background: #fafafa;
}

.results-table tr:hover {
  background: #f0f7ff;
}

.number-cell {
  text-align: right;
  font-family: monospace;
}

.high-value {
  color: #dc3545;
  font-weight: bold;
}

/* Monster List Styling */
.monster-list {
  max-height: 600px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #90caf9 #f5f5f5;
}

.monster-item:hover {
  background-color: #f0f7ff;
}

.monster-number {
  color: #666;
  font-weight: 600;
}

.monster-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.monster-icon {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 4px;
}

/* Dialog Styling */
.dialog-container {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  position: relative;
}

.character-name {
  color: #2196f3;
  font-weight: bold;
  margin-bottom: 10px;
}

.dialog-text {
  line-height: 1.6;
  margin-bottom: 15px;
}

.code-example {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 12px;
  border-radius: 6px;
  font-family: monospace;
  margin: 10px 0;
}

/* Quest Progress */
.quest-progress {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  padding: 15px;
  margin-top: 20px;
}

.progress-title {
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
}

.progress-bar {
  height: 8px;
  background: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4caf50, #8bc34a);
  transition: width 0.3s ease;
  border-radius: 4px;
}

/* Controls */
.control-panel {
  display: flex;
  gap: 10px;
  margin: 15px 0;
}

.control-button {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.execute-button {
  background: #2196f3;
  color: white;
}

.execute-button:hover {
  background: #1976d2;
}

.help-button {
  background: #4caf50;
  color: white;
}

.help-button:hover {
  background: #388e3c;
}

/* Editor Enhancements */
.editor-container {
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
}

.editor-toolbar {
  background: #f8f9fa;
  padding: 8px;
  border-bottom: 1px solid #ddd;
}

.sql-editor {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  font-family: monospace;
  font-size: 14px;
  line-height: 1.5;
  border: none;
  resize: vertical;
  background: #1e1e1e;
  color: #d4d4d4;
}

.sql-editor:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px #2196f3;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.fade-in {
  animation: fadeIn 0.3s ease-in;
}

.slide-in {
  animation: slideIn 0.3s ease-out;
}

/* Responsive Design */
@media (max-width: 768px) {
  .game-container {
    flex-direction: column;
  }

  .monster-list {
    max-height: 400px;
  }

  .dialog-container {
    margin: 10px;
  }

  .control-panel {
    flex-wrap: wrap;
  }

  .control-button {
    flex: 1;
    min-width: 120px;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  body {
    background: linear-gradient(180deg, #1a1a1a 0%, #2d2d2d 100%);
    color: #fff;
  }

  .dialog-container,
  .monster-list,
  .results-table {
    background: #333;
    color: #fff;
  }

  .results-table th {
    background: #444;
  }

  .results-table td {
    border-color: #444;
  }

  .code-example {
    background: #1a1a1a;
  }

  .progress-bar {
    background: #444;
  }
}

/* Accessibility Improvements */
:focus {
  outline: 2px solid #2196f3;
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.monster-list {
  background: white;
  border-radius: 12px;
  overflow: hidden;
}

.monster-list-header {
  padding: 15px;
  border-bottom: 1px solid #eee;
  background: #f8f9fa;
}

.monster-list-header h3 {
  margin: 0;
  color: #333;
  font-size: 1.2em;
}

.monster-grid {
  max-height: 500px;
  overflow-y: auto;
}

.monster-item {
  display: grid;
  grid-template-columns: 40px 50px auto;
  padding: 10px 15px;
  border-bottom: 1px solid #eee;
  align-items: center;
  gap: 15px;
  transition: background-color 0.2s;
}

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

.monster-number {
  color: #666;
  font-weight: 600;
  text-align: right;
}

.monster-sprite {
  width: 40px;
  height: 40px;
  background: #f0f0f0;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.monster-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.monster-image.loaded {
  opacity: 1;
}

/* Styles pour l'état de chargement */
.monster-sprite::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #f0f0f0;
  z-index: -1;
}

.monster-info {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}

.monster-name {
  font-weight: 600;
  color: #333;
}

.monster-types {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.type-Feu {
  background: #ff4444;
  color: white;
}
.type-Eau {
  background: #3399ff;
  color: white;
}
.type-Plante {
  background: #77cc55;
  color: white;
}
.type-Electrik {
  background: #ffcc33;
  color: black;
}
.type-Psy {
  background: #ff5599;
  color: white;
}
.type-Dragon {
  background: #7766ee;
  color: white;
}
.type-Vol {
  background: #89aae3;
  color: white;
}
.type-Spectre {
  background: #6666bb;
  color: white;
}
.type-Acier {
  background: #aaaabb;
  color: white;
}
.type-Poison {
  background: #aa5599;
  color: white;
}

.type-badge {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8em;
  text-transform: uppercase;
  display: inline-block;
  margin: 2px;
  font-weight: 500;
}

/* Section gauche */
.left-section {
  flex: 1;
  position: relative;
}

.character-section {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 400px; /* Hauteur minimale pour éviter les chevauchements */
  padding-bottom: 130px; /* Espace pour le personnage */
}

.character-image {
  width: 95%;
  height: auto;
  border-radius: 9999px;
  object-fit: contain;
}

#hints-container {
  margin-top: 15px;
}

.character-container {
  position: absolute;
  bottom: 0;
  width: 150px;
  height: 150px;
  display: flex;
  z-index: 1;
  background-color: #fff;
  border-radius: 9999px;
  justify-content: center;
  align-items: center;
}

.dialog-bubble {
  max-height: calc(100vh - 400px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #90caf9 #f5f5f5;
}

.dialog-bubble::-webkit-scrollbar {
  width: 8px;
}

.dialog-bubble::-webkit-scrollbar-track {
  background: #f5f5f5;
}

.dialog-bubble::-webkit-scrollbar-thumb {
  background: #90caf9;
  border-radius: 4px;
}

.dialog-bubble::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 30px;
  width: 20px;
  height: 20px;
  background: white;
  transform: rotate(45deg);
}

/* Section droite */
.right-section {
  flex: 1;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.help-panel {
  padding: 15px;
  border-bottom: 1px solid #eee;
}

.monster-list {
  max-height: 600px;
  overflow-y: auto;
}

.monster-item:hover {
  background: #f5f5f5;
}

/* Résultats */
.results-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.results-table th,
.results-table td {
  padding: 12px;
  text-align: left;
  border: 1px solid #eee;
}

.results-table th {
  background: #f8f9fa;
  font-weight: 600;
}

/* Autres styles utiles */
.code-block {
  background: #2d2d2d;
  color: #d4d4d4;
  padding: 12px;
  border-radius: 6px;
  font-family: monospace;
  margin: 10px 0;
}

.keyword {
  color: #569cd6;
}

.help-content {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  margin-top: 10px;
}

.help-content pre {
  background: #fff;
  padding: 10px;
  border-radius: 4px;
  border: 1px solid #eee;
}

.type-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.error-message {
  background-color: #fff3f3;
  border: 1px solid #ffcdd2;
  border-radius: 8px;
  margin: 10px 0;
  overflow: hidden;
  animation: slideIn 0.3s ease-out;
}

.error-header {
  background-color: #ffebee;
  padding: 12px 15px;
  color: #d32f2f;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.error-header i {
  font-size: 1.2em;
}

.error-tips {
  padding: 12px 15px;
}

.tip {
  color: #555;
  margin: 5px 0;
  font-size: 0.95em;
  line-height: 1.4;
}

.tip:before {
  content: "•";
  color: #d32f2f;
  margin-right: 8px;
}

@keyframes slideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.hint-message {
  background-color: #fff3cd;
  border: 1px solid #ffeeba;
  border-radius: 8px;
  padding: 15px;
  margin: 10px 0;
  color: #856404;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: slideDown 0.3s ease-out;
}

.hint-message i {
  color: #856404;
  font-size: 1.2em;
}

.hint-content {
  flex: 1;
}

@keyframes slideDown {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.mode-selector {
  margin-bottom: 20px;
  display: flex;
  gap: 10px;
}

.mode-button {
  padding: 8px 16px;
  border: 2px solid #4caf50;
  border-radius: 20px;
  background: white;
  color: #4caf50;
  cursor: pointer;
  transition: all 0.3s;
}

.mode-button.active {
  background: #4caf50;
  color: white;
}

.mode-button:hover {
  background: #4caf50;
  color: white;
}
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #87ceeb 0%, #90ee90 100%);
}

.login-box {
  background: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
}

.login-box h1 {
  text-align: center;
  color: #333;
  margin-bottom: 10px;
}

.login-box p {
  text-align: center;
  color: #666;
  margin-bottom: 30px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  color: #555;
  font-weight: 500;
}

.form-group input {
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
}

.login-button {
  background: #4caf50;
  color: white;
  padding: 12px;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.login-button:hover {
  background: #45a049;
}

.register-link {
  text-align: center;
  margin-top: 20px;
  color: #666;
}

.register-link a {
  color: #4caf50;
  text-decoration: none;
}

.register-link a:hover {
  text-decoration: underline;
}
#badges-container {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
}

.badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
}

.badge:hover {
  transform: translateY(-2px);
}

.badge img {
  width: 40px;
  height: 40px;
}

.badge-info {
  flex: 1;
}

.badge-info h4 {
  margin: 0;
  color: #333;
  font-size: 0.9em;
}

.badge-info p {
  margin: 3px 0 0;
  color: #666;
  font-size: 0.8em;
}

.badge.locked {
  opacity: 0.5;
  filter: grayscale(1);
}

/* Styles spécifiques pour chaque badge */
.badge.novice {
  border-left: 4px solid #4caf50;
}
.badge.intermediate {
  border-left: 4px solid #2196f3;
}
.badge.expert {
  border-left: 4px solid #9c27b0;
}
