/* ---- Réinitialisation globale pour éviter le défilement horizontal ---- */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden; /* Empêche tout défilement horizontal */
  box-sizing: border-box;
}

/* ---- Assure que tous les éléments utilisent box-sizing ---- */
*, *:before, *:after {
  box-sizing: inherit;
}

/* Navbar au-dessus de tout sur cette page */
.navbar {
  z-index: 10000 !important;
}

.nav-links, .user-info, .guest-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap; /* Permet aux liens de s'adapter */
  max-width: 100%;
}

/* Ne pas casser la navbar : pas de wrap dans la barre du haut */
#appNavbar .nav-links,
#appNavbar .user-info,
#appNavbar .guest-links {
  flex-wrap: nowrap !important;
}

.profile-avatar {
  width: 40px; /* Taille fixe pour l'avatar */
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  max-width: 100%; /* Empêche l'image de dépasser */
}

/* ---- Container principal ---- */
.account-container {
  width: 100%;
  max-width: 1200px; /* Limite la largeur sur les très grands écrans */
  margin: 90px auto 30px auto; /* laisse la place sous la navbar fixe */
  padding: 20px;
  background-color: #f4f6f8; /* Fond gris clair pour faire ressortir les cartes */
  border-radius: 12px;
  font-family: Arial, sans-serif !important;
  color: #272a49;
  box-sizing: border-box;
  overflow-x: hidden;
  position: relative;
  z-index: 1 !important; /* reste sous la navbar / menu mobile */
}

/* --- EN-TÊTE (Centré verticalement pour l'App) --- */
.user-header-container {
  display: flex;
  flex-direction: column; /* Force le pseudo au-dessus et la flamme en dessous */
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 30px;
  text-align: center;
}

h2 {
  font-size: 2em;
  font-weight: bold !important;
  margin: 0;
  color: #272a49;
}

/* --- FLAMME (Version Emoji) --- */
.streak-container {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 1.1rem;
  transition: transform 0.2s ease;
  vertical-align: middle;
  background-color: white;
  margin-left: 0; /* Centré par le parent flex column */
}

/* État Inactif */
.streak-container.inactive {
  background-color: transparent;
  color: #e5e5e5;
  border: 2px solid #e5e5e5;
}
.streak-container.inactive span:first-child {
  filter: grayscale(100%); /* Émoji en gris si inactif */
  opacity: 0.5;
}

/* État Actif */
.streak-container.active {
  background-color: #fff;
  color: #ff9600; 
  border: 2px solid #ff9600;
  box-shadow: 0 2px 0 #e58600; 
}

/* Animation sur l'émoji 🔥 */
@keyframes burn {
  from { transform: scale(1); }
  to { transform: scale(1.15); }
}

.streak-container.active span:first-child {
  display: inline-block;
  font-size: 1.3rem;
  animation: burn 1.5s infinite alternate; /* Fait vibrer l'émoji */
}

/* ========================================= */
/* === NOUVEAU LAYOUT GRID (PC & Mobile) === */
/* ========================================= */

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr; /* PC : Gauche un peu plus petite, Droite plus large */
  gap: 30px;
  align-items: start;
}

/* --- CARTES GÉNÉRIQUES --- */
.profile-card, .settings-card, .gamification-section {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  padding: 25px;
  margin-bottom: 25px;
  border: 1px solid #eee;
}

/* --- COLONNE GAUCHE --- */

/* Profil */
.profile-card {
  text-align: center;
}
.profile-pic {
  display: block;
  margin: 0 auto 15px auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #f0f0f0;
  transition: transform 0.3s ease;
}
.profile-pic:hover { transform: scale(1.05); }

.btn-small {
  padding: 8px 15px;
  font-size: 0.9em;
  background-color: #f0f0f0;
  color: #333;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
}
.btn-small:hover { background-color: #e0e0e0; }

/* Gamification */
.level-badge {
  font-size: 1.1em;
  color: #e65100;
  background-color: #ffe0b2;
  padding: 5px 15px;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: 15px;
  font-weight: 800 !important;
}

.xp-container {
  width: 100%;
  background-color: #e0e0e0;
  border-radius: 15px;
  height: 15px;
  overflow: hidden;
  margin: 10px 0;
}
.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff9800, #ff3c00);
  width: 0%;
  transition: width 1s ease-in-out;
}
.xp-text { font-size: 0.9em; color: #666; margin-bottom: 20px; font-weight: bold; }

/* Stats Grid */
.stats-grid {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 25px;
  flex-wrap: wrap;
}
.stat-card {
  background: #f9f9f9;
  padding: 10px;
  border-radius: 8px;
  min-width: 90px;
  text-align: center;
  border: 1px solid #eee;
}
.stat-value { font-size: 1.3em; color: #272a49; font-weight: bold; display: block; }
.stat-label { font-size: 0.8em; color: #888; }

/* ---- Quêtes du Jour (Design calqué sur les Succès) ---- */
.quests-container {
  text-align: left;
  border-top: 1px solid #f0f0f0;
  padding-top: 15px;
}
.quests-container h3 { margin-top: 0; font-size: 1.1em; }

.quest-item {
  display: flex;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
  background-color: #f9f9f9;
  border: 1px solid #eee;
  transition: all 0.3s ease;
  margin-bottom: 10px;
  /* État verrouillé par défaut comme les succès */
  opacity: 0.6; 
  filter: grayscale(100%);
}

/* État complété (même design que .achievement-card.unlocked) */
.quest-item.unlocked {
  background-color: #fff8e1;
  border: 1px solid #ffc107;
  opacity: 1;
  filter: none;
}

.quest-icon { font-size: 1.8em; margin-right: 12px; width: 35px; text-align: center; }
.quest-info { flex: 1; }
.quest-title { font-weight: bold; display: block; color: #333; font-size: 0.9em; }
.quest-progress { font-size: 0.75em; color: #888; margin-top: 2px; font-style: italic; }
.quest-reward { font-weight: bold; color: #ff9800; font-size: 0.85em; min-width: 50px; text-align: right; }
.quest-status { font-size: 1.2em; margin-left: 8px; }

/* Succès (Achievements) */
.achievements-section {
  margin-top: 25px;
  text-align: left;
  border-top: 1px solid #f0f0f0;
  padding-top: 15px;
}
.achievements-section h3 { margin-top: 0; margin-bottom: 15px; color: #272a49; font-size: 1.1em; }
.achievements-grid { display: flex; flex-direction: column; gap: 10px; }

.achievement-card {
  display: flex;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
  background-color: #f9f9f9;
  border: 1px solid #eee;
  transition: all 0.3s ease;
}
.achievement-card.locked { opacity: 0.6; filter: grayscale(100%); }
.achievement-card.unlocked {
  background-color: #fff8e1;
  border: 1px solid #ffc107;
  opacity: 1;
  filter: none;
}
.ach-icon { font-size: 1.8em; margin-right: 12px; width: 35px; text-align: center; }
.ach-content { flex: 1; }
.ach-title { font-weight: bold; display: block; color: #333; font-size: 0.9em; }
.ach-desc { font-size: 0.8em; color: #666; display: block; }
.ach-progress { font-size: 0.75em; color: #888; margin-top: 2px; font-style: italic; }
.ach-reward { font-weight: bold; color: #ff9800; font-size: 0.85em; min-width: 50px; text-align: right; }
.ach-status { font-size: 1.2em; margin-left: 8px; }

.cta-classement {
    display: inline-block;
    background: #ff3c00;
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: bold;
    transition: transform 0.2s;
    font-size: 0.9em;
}
.cta-classement:hover { transform: scale(1.05); }

/* --- COLONNE DROITE --- */

/* Titres des cartes */
.settings-card h3 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 1.2em;
  border-bottom: 2px solid #f0f0f0;
  padding-bottom: 10px;
  color: #272a49;
}

/* Carte Jetons (Highlight) */
.credits-highlight {
  background: linear-gradient(135deg, #272a49 0%, #1a1d33 100%);
  color: white;
  border: none;
}
.credits-highlight h3 {
  color: white;
  border-color: rgba(255,255,255,0.2);
}
.credits-text { font-size: 1.1em; margin-bottom: 15px; }
.big-credits { font-size: 1.5em; color: #ffca28; font-weight: bold; margin-left: 5px; }

/* Formulaires */
.form-group {
  margin-bottom: 15px;
  text-align: left;
}
.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  font-size: 0.9em;
  color: #555;
}
.input-wrapper {
  display: flex;
  gap: 10px;
}
.form-group input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1em;
  background-color: #f9f9f9;
  flex: 1;
}
.form-group input:focus {
  border-color: #ff3c00;
  background-color: #fff;
  outline: none;
}

/* Boutons */
.btn-full {
  width: 100%;
  background-color: #ffca28; /* Jaune or */
  color: #333;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  font-size: 1em;
}
.btn-full:hover { background-color: #ffc107; }

.btn-icon {
  background-color: #ff3c00;
  color: white;
  border: none;
  padding: 0 15px;
  border-radius: 8px;
  font-size: 1.2em;
  cursor: pointer;
}
.btn-icon:hover { background-color: #e63300; }

.btn-secondary {
  width: 100%;
  background-color: #f8f9fa;
  color: #272a49;
  border: 1px solid #ddd;
  padding: 10px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  margin-top: 5px;
}
.btn-secondary:hover { background-color: #e2e6ea; }

.delete-account-btn {
  background-color: transparent;
  color: #dc3545;
  border: 1px solid #dc3545;
  padding: 10px;
  border-radius: 8px;
  width: 100%;
  font-weight: bold;
  cursor: pointer;
}
.delete-account-btn:hover { background-color: #dc3545; color: white; }

.separator {
  height: 1px;
  background: #eee;
  margin: 25px 0;
}

/* --- MODALES --- */
.modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  overflow-x: hidden;
}
.modal-content {
  background-color: white;
  margin: 10% auto;
  padding: 25px;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
  text-align: center;
}
.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}
.close:hover { color: black; }

/* Styles spécifiques modale email */
#emailVerifyModal .code-container {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 20px 0;
}
#emailVerifyModal .code-input {
  width: 40px;
  height: 50px;
  text-align: center;
  font-size: 20px;
  border: 2px solid #ddd;
  border-radius: 8px;
}
#emailVerifyModal .register-button {
  background-color: #ff3c00;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  width: 100%;
}

/* --- Liste des utilisateurs bloqués dans la modale --- */
.blocked-list-container {
    max-height: 400px;
    overflow-y: auto;
    text-align: left;
    margin-top: 10px;
}

.blocked-user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid #eee;
    gap: 10px;
}

.blocked-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.blocked-user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
    background-color: #f0f0f0;
}

.blocked-user-pseudo {
    font-weight: bold;
    color: #272a49;
}

.btn-unblock {
    padding: 6px 12px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.85em;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
}

.btn-unblock:hover {
    background-color: #218838;
}

.no-blocked-text {
    padding: 20px;
    color: #888;
    font-style: italic;
    text-align: center;
}

/* Styles spécifiques modale prefs */
.prefs-options { text-align: left; margin: 20px 0; }
.prefs-options label { display: block; margin: 10px 0; font-size: 1.1em; }
#savePrefsBtn {
  background-color: #ff3c00;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  font-weight: bold;
}

/* ---- Notifications ---- */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 15px 20px;
  border-radius: 8px;
  color: white;
  font-weight: bold;
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
  z-index: 11000;
  animation: fadeIn 0.5s ease;
}
.notification.success { background-color: #28a745; }
.notification.error { background-color: #dc3545; }
.notification.warning { background-color: #ffc107; color: #333; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---- Footer ---- */
.footer {
  width: 100%;
  padding: 20px;
  text-align: center;
  margin-top: 30px;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
}
.footer-links a {
  text-decoration: none;
  color: #272a49;
  font-weight: bold;
}

/* --- RESPONSIVE MOBILE --- */
@media screen and (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr; /* 1 Colonne sur mobile */
    gap: 15px;
  }

  .account-container {
    width: 100% !important;   /* Prend toute la largeur */
    max-width: 100% !important;
    margin: 80px 0 0 0 !important; /* Collé aux bords gauche/droite */
    padding: 15px !important;
    border-radius: 0 !important; /* On retire l'arrondi pour faire "propre" sur toute la largeur */
    box-sizing: border-box !important;
  }
  
  .profile-card, .settings-card, .gamification-section {
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  }

/* Carte Profil */
  .profile-card {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    width: 100% !important;
  }

  /* Carte Gamification (XP) */
  .gamification-section {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    width: 100% !important;
  }

  .xp-container {
    width: 90% !important; /* On la centre avec une largeur un peu réduite */
    margin: 10px auto !important;
  }

  /* Titre et Flamme tout en haut */
  .user-header-container {
    width: 100% !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    margin-bottom: 20px !important;
  }


  h2 { font-size: 1.5em; }
  
  .stats-grid { gap: 10px; }
  .stat-card { min-width: 30%; font-size: 0.9em; }
}
