/* =========================================
   STYLE GRAND MASTER : LEADERBOARD
   ========================================= */

:root {
  --bg-main: #050505;
  --bg-secondary: #0a0a0a; /* Un peu plus sombre */
  --bg-tertiary: #121212;
  --accent-gold: #d4af37;
  --accent-gold-dim: rgba(212, 175, 55, 0.5);
  --text-primary: #ffffff;
  --text-secondary: #888888;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --font-heading: "Playfair Display", serif;
  --font-body: "Inter", sans-serif;
  --glass-bg: rgba(20, 20, 20, 0.6);
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-body);
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* =========================================
   FOND D'AMBIANCE (CORRIGÉ : PLUS VISIBLE)
   ========================================= */
.grand-master-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  z-index: -1;
  background-image: radial-gradient(
    circle at 50% 0%,
    #1a1500 0%,
    var(--bg-main) 60%
  );
  pointer-events: none;
}

/* =========================================
   HERO SECTION
   ========================================= */
.game-hero {
  padding: 10rem 2rem 3rem; /* Espace header */
  text-align: center;
  position: relative;
  z-index: 1;
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
}

.badge-pro {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--accent-gold);
  border: 1px solid rgba(212, 175, 55, 0.3);
  padding: 6px 18px;
  margin-bottom: 1.5rem;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(212, 175, 55, 0.05),
    transparent
  );
}

.game-hero h1 {
  font-family: var(--font-heading);
  font-size: 4rem;
  line-height: 1.1;
  margin: 0 0 1rem 0;
  color: #fff;
  letter-spacing: -1px;
}

.text-gradient-gold {
  background: linear-gradient(to bottom, #fcf6ba, #d4af37, #aa8a29);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-style: italic;
  filter: drop-shadow(0 0 15px rgba(212, 175, 55, 0.2));
}

.hero-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1.6;
  font-weight: 300;
  max-width: 600px;
  margin: 0 auto;
}

/* =========================================
   CONTENEUR PRINCIPAL
   ========================================= */
.leaderboard-container {
  max-width: 1000px;
  margin: 0 auto 6rem auto;
  padding: 0 2rem;
  position: relative;
  min-height: 50vh;
}

.error-box {
  background: rgba(255, 68, 68, 0.1);
  color: #ff4444;
  border: 1px solid rgba(255, 68, 68, 0.3);
  padding: 15px;
  margin: 20px 0;
  text-align: center;
  border-radius: 4px;
}

/* =========================================
   CARTES (MODE SELECTOR)
   ========================================= */
.modes-layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  animation: fadeIn 0.5s ease-out;
}

.general-card-wrapper {
  display: flex;
  justify-content: center;
  width: 100%;
}

.sub-modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

/* Style des cartes */
.mode-card {
  position: relative;
  background: linear-gradient(145deg, #0f0f0f, #050505);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.4s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.card-content {
  position: relative;
  z-index: 2;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Lueur au survol */
.card-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    circle at top right,
    rgba(212, 175, 55, 0.15),
    transparent 60%
  );
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: 1;
}

.mode-card:hover {
  transform: translateY(-5px);
  border-color: rgba(212, 175, 55, 0.3);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.mode-card:hover .card-glow {
  opacity: 1;
}

/* Icônes */
.icon-circle {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
  color: #666;
}

.icon-circle.large {
  width: 90px;
  height: 90px;
  font-size: 2.5rem;
}

.mode-card:hover .icon-circle {
  transform: scale(1.1);
  color: var(--accent-gold);
  border-color: rgba(212, 175, 55, 0.2);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.1);
}

.mode-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  color: #fff;
  margin-bottom: 0.8rem;
}

.mode-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Badge "Bientôt" */
.badge-soon {
  position: absolute;
  top: -15px;
  right: -10px;
  background: rgba(255, 255, 255, 0.05);
  color: #666;
  font-size: 0.65rem;
  padding: 4px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* =========================================
   VUE TABLEAU
   ========================================= */
#leaderboard-view {
  display: none;
  opacity: 0;
  transition: opacity 0.3s;
}
#leaderboard-view.visible {
  display: block;
  opacity: 1;
}

/* Navigation Secondaire */
.sub-nav {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.sub-nav-link {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sub-nav-link.menu-link {
  border: 1px solid var(--border-subtle);
}
.sub-nav-link.menu-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.sub-nav-link.active-mode {
  color: var(--accent-gold);
  font-weight: 600;
}
.sub-nav-separator {
  width: 1px;
  height: 20px;
  background: var(--border-subtle);
}

/* Explications */
.ranking-explanation {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-left: 2px solid var(--accent-gold);
  border-radius: 4px;
  padding: 1.5rem;
  margin-bottom: 3rem;
  backdrop-filter: blur(5px);
}
.explanation-title {
  color: var(--accent-gold);
  font-family: var(--font-heading);
  font-size: 1.1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
}
.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
.rule-card {
  display: flex;
  gap: 12px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  align-items: center;
}
.rule-icon {
  color: var(--accent-gold);
  font-size: 0.9rem;
}
.rule-text strong {
  display: block;
  color: #fff;
  font-size: 0.85rem;
  margin-bottom: 2px;
}
.rule-text span {
  color: #777;
  font-size: 0.75rem;
}

/* Onglets */
.category-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
  background: rgba(255, 255, 255, 0.02);
  padding: 5px;
  border-radius: 50px;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  border: 1px solid var(--border-subtle);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.6rem 1.5rem;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.8rem;
  transition: all 0.3s ease;
  border-radius: 40px;
  font-weight: 500;
}

.tab-btn:hover {
  color: #fff;
}
.tab-btn.active {
  background: var(--accent-gold);
  color: #000;
  box-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
}

/* TABLEAU PRESTIGE */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: rgba(10, 10, 10, 0.8);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
}

.rank-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.rank-table th {
  text-align: left;
  padding: 1.5rem;
  color: var(--accent-gold);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.01);
}

.th-score {
  text-align: right;
}

.rank-table td {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
  color: #ccc;
  font-size: 0.95rem;
}

.rank-table tr:hover {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.03),
    transparent
  );
}

/* Rangs Spéciaux */
.rank-num {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  color: #444;
  width: 30px;
  display: inline-block;
}

/* Or, Argent, Bronze */
.rank-1 .rank-num {
  color: #ffd700;
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
  font-size: 1.5rem;
}
.rank-2 .rank-num {
  color: #c0c0c0;
  text-shadow: 0 0 10px rgba(192, 192, 192, 0.3);
  font-size: 1.4rem;
}
.rank-3 .rank-num {
  color: #cd7f32;
  text-shadow: 0 0 10px rgba(205, 127, 50, 0.3);
  font-size: 1.3rem;
}

.player-cell {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.avatar-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background-color: #1a1a1a;
  background-size: cover;
  background-position: center;
}

.rank-1 .avatar-circle {
  border-color: #ffd700;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}

.player-info {
  display: flex;
  flex-direction: column;
}

.player-name {
  font-weight: 600;
  color: #fff;
  font-size: 1rem;
}
.player-badge {
  font-size: 0.7rem;
  color: #666;
  text-transform: uppercase;
}

.col-stat {
  color: #666;
  font-size: 0.85rem;
}

.elo-score {
  font-family: "Courier New", monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-gold);
  text-align: right;
  display: block;
}

/* =========================================
   FOOTER
   ========================================= */
footer {
  border-top: 1px solid var(--border-subtle);
  padding: 4rem 2rem;
  background: var(--bg-main);
  margin-top: auto;
  position: relative;
  z-index: 1;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 3rem;
}

.footer-brand h4 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: #fff;
}
.footer-brand .dot {
  color: var(--accent-gold);
}
.footer-brand p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-style: italic;
}

.footer-nav-group {
  display: flex;
  gap: 4rem;
}
.footer-col h5 {
  color: var(--accent-gold);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 1.2rem;
}
.footer-col ul {
  padding: 0;
  list-style: none;
}
.footer-col li {
  margin-bottom: 0.8rem;
}
.footer-col a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 0.2s;
}
.footer-col a:hover {
  color: #fff;
}

.footer-copy {
  width: 100%;
  border-top: 1px solid var(--border-subtle);
  padding-top: 2rem;
  margin-top: 1rem;
  color: #444;
  font-size: 0.8rem;
  text-align: center;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .game-hero h1 {
    font-size: 2.5rem;
  }
  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
  .footer-nav-group {
    justify-content: center;
    gap: 2rem;
    width: 100%;
  }
  .col-stat {
    display: none;
  }
  .rank-table th,
  .rank-table td {
    padding: 1rem 0.5rem;
  }
}
