/* Page profil (profile.html), inspirée du profil Spotify.
   Rappel du choix de mise en page :
   - block (par défaut) : les grandes sections de la page, les unes sous les autres
   - flex : des éléments sur UNE ligne (ou une colonne) à aligner : avatar + infos, titre + "See all", boutons
   - grid : des éléments en lignes ET colonnes de même taille : rangées de cartes, tuiles de statistiques */

.profile-page {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

/* ---------- En-tête : avatar à gauche, infos à droite → FLEX ---------- */

.profile-hero {
  display: flex;
  align-items: flex-end;            /* le texte aligné sur le bas de l'avatar, comme Spotify */
  gap: 32px;
  padding: 48px 32px 32px;
  margin: 0 -16px;                  /* le dégradé va jusqu'aux bords du contenu */
  background: linear-gradient(to bottom, #3a3f4f, #1a1d27);
  border-radius: 0 0 16px 16px;
}

.profile-avatar {
  flex: 0 0 220px;                  /* taille fixe : ni plus grand, ni plus petit */
  height: 220px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  background-color: #2a2e3a;
  color: #9aa0ad;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.profile-label {
  margin: 0;
  color: #e7eaf4;
  font-size: 0.9rem;
  font-weight: bold;
}

.profile-page .profile-name {
  margin: 8px 0 16px;
  font-size: clamp(2.5rem, 7vw, 5.5rem);   /* grand titre, qui rétrécit sur petit écran */
  line-height: 1;
  color: #ffffff;
  text-align: left;
}

.profile-stats {
  margin: 0;
  color: #c9ccd6;
}

.profile-stats strong {
  color: #ffffff;
}

/* ---------- Barre d'actions → FLEX ---------- */

.profile-actions {
  display: flex;
  gap: 8px;
  padding: 20px 16px;
}

.profile-page .icon-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #9aa0ad;
}

.profile-page .icon-btn:hover {
  color: #ffffff;
  background-color: #1a1d27;
}

/* ---------- Sections ---------- */

.profile-section {
  margin-bottom: 40px;
}

/* Titre à gauche, "See all" à droite → FLEX */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 16px;
}

.profile-page .section-head h2 {
  margin: 0;
  text-align: left;
  color: #ffffff;
}

.section-sub {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: #9aa0ad;
}

.profile-page .see-all-link {
  color: #9aa0ad;
  font-size: 0.9rem;
  font-weight: bold;
  text-decoration: none;
}

.profile-page .see-all-link:hover {
  color: #ffffff;
  text-decoration: underline;
}

/* Rangée d'éléments de même largeur → GRID */
.profile-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
}

/* Une carte (meilleures cartes du mois) */
.profile-card {
  padding: 12px;
  border-radius: 12px;
  transition: background-color 0.2s ease;
}

.profile-card:hover {
  background-color: #1a1d27;
}

.profile-card-visual {
  aspect-ratio: 269 / 385;          /* mêmes proportions que les vraies cartes */
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 10px;
  border: 3px solid var(--c);
  border-radius: 10px;
  background: linear-gradient(160deg, #1a1d27 30%, color-mix(in srgb, var(--c) 70%, #1a1d27));
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  color: #ffffff;
  font-weight: bold;
}

/* La vraie image de la carte remplit le cadre. Pas de bordure de rareté sur le profil pour l'instant
   (ça fait moins "jeu") : remettre la ligne border de .profile-card-visual pour la retrouver */
.profile-card-visual {
  overflow: hidden;
  border: none;
}

.profile-card-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Message quand il n'y a encore rien à montrer */
.profile-page .profile-empty {
  margin: 0;
  padding: 20px;
  border: 1px dashed #3a3f4e;
  border-radius: 12px;
  color: #9aa0ad;
  text-align: center;
}

.profile-empty a {
  color: #eab711;
}

.profile-card h3,
.collection-circle h3 {
  margin: 0 0 4px;
  font-size: 1rem;
  color: #ffffff;
}

.profile-page .profile-card p,
.profile-page .collection-circle p {
  margin: 0;
  font-size: 0.85rem;
  color: #9aa0ad;
}

/* Un rond de collection, avec un anneau de progression */
.collection-circle {
  padding: 12px;
  border-radius: 12px;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.collection-circle:hover {
  background-color: #1a1d27;
}

.collection-circle .circle {
  aspect-ratio: 1;                  /* toujours un carré... */
  border-radius: 50%;               /* ...donc toujours un rond */
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 10px;
  /* anneau de progression : jaune sur --p (le pourcentage), gris pour le reste */
  background: conic-gradient(#eab711 var(--p), #2a2e3a 0);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.collection-circle .circle span {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 84%;                       /* le disque du centre laisse voir l'anneau autour */
  aspect-ratio: 1;
  border-radius: 50%;
  background-color: #1a1d27;
  color: #ffffff;
  font-size: 1.6rem;
  font-weight: bold;
}

/* Tuiles de statistiques → GRID */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.stat-tile {
  padding: 20px;
  background-color: #1a1d27;
  border: 1px solid #2a2e3a;
  border-radius: 12px;
}

.profile-page .stat-value {
  margin: 0;
  font-size: 2rem;
  font-weight: bold;
  color: #eab711;
}

.profile-page .stat-label {
  margin: 4px 0 0;
  color: #9aa0ad;
}

/* ---------- Titre équipé (sous le pseudo) ---------- */

.profile-page .profile-title {
  display: inline-block;
  margin: 0 0 12px;
  padding: 4px 14px;
  border: 1px solid #eab711;
  border-radius: 999px;
  color: #eab711;
  font-size: 0.9rem;
  font-weight: bold;
}

/* Lien "See my achievements" sous le titre équipé */
.profile-page .profile-achievements-link {
  margin: 0 0 12px;
  font-size: 0.9rem;
}

/* ---------- Page des succès (achievements.html) ---------- */

.achievements-page {
  padding-top: 32px;
}

.achievements-page .achievements-intro {
  margin: 0 0 32px;
  text-align: center;
  color: #c9ccd6;
}

/* ---------- Succès → GRID ---------- */

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.achievement {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  background-color: #1a1d27;
  border: 1px solid #2a2e3a;
  border-radius: 12px;
}

.achievement-icon {
  font-size: 2rem;
  line-height: 1;
}

.profile-page .achievement h3 {
  margin: 4px 0 0;
  font-size: 1rem;
  color: #ffffff;
}

.profile-page .achievement-desc {
  margin: 0;
  font-size: 0.85rem;
  color: #9aa0ad;
}

/* Barre de progression */
.achievement-bar {
  height: 6px;
  margin-top: 4px;
  border-radius: 999px;
  background-color: #2a2e3a;
  overflow: hidden;
}

.achievement-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background-color: #12b5f0;
}

.profile-page .achievement-status {
  margin: 0;
  font-size: 0.8rem;
  font-weight: bold;
  color: #e7eaf4;
}

.profile-page .achievement-reward {
  margin: auto 0 0;                 /* collée en bas de la tuile */
  padding-top: 8px;
  border-top: 1px solid #2a2e3a;
  font-size: 0.8rem;
  color: #c9ccd6;
}

.achievement-equip {
  margin-top: 6px;
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* Obtenu : bordure dorée, barre dorée, petit ✓ */
.achievement.unlocked {
  border-color: #eab711;
  background: linear-gradient(160deg, #2a2410, #1a1d27 60%);
}

.achievement.unlocked .achievement-bar span {
  background-color: #eab711;
}

.achievement.unlocked .achievement-status {
  color: #eab711;
}

.achievement.unlocked::after {
  content: "✓";
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: #eab711;
  color: #0f1117;
  font-weight: bold;
  line-height: 24px;
  text-align: center;
}

/* Pas encore commencé : grisé */
.achievement.locked {
  opacity: 0.5;
}

.achievement.locked .achievement-icon {
  filter: grayscale(1);
}

/* ---------- Mobile : l'avatar passe au-dessus des infos ---------- */

@media (max-width: 700px) {
  .profile-hero {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .profile-avatar {
    flex-basis: 150px;
    width: 150px;
    height: 150px;
  }

  .profile-page .profile-name {
    text-align: center;
  }
}
