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

:root {
  --bg:         #0d0f14;
  --bg-card:    #141720;
  --bg-hover:   #1c2030;
  --border:     #252a3a;
  --text:       #e8eaf0;
  --text-muted: #6b7280;
  --accent:     #5865f2;
  --accent-h:   #4752c4;
  --green:      #57f287;
  --red:        #ed4245;
  --gold:       #f5a623;
  --silver:     #c0c0c0;
  --bronze:     #cd7f32;
  --radius:     8px;
  --shadow:     0 4px 24px rgba(0,0,0,.45);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-h); }

code {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: .85em;
}

/* ── Navbar ───────────────────────────────────────────── */
.navbar {
  display              : grid;
  grid-template-columns: 1fr auto 1fr;
  align-items          : center;
  padding              : 0 2rem;
  height               : 64px;
  background           : var(--bg-card);
  border-bottom        : 1px solid var(--border);
  position             : sticky;
  top                  : 0;
  z-index              : 100;
}

/* Colonne gauche — logo */
.navbar-brand {
  display     : flex;
  align-items : center;
  justify-self: start;
}

/* Colonne centre — liens */
.navbar-links {
  display        : flex;
  gap            : .25rem;
  list-style     : none;
  justify-content: center;
}

.navbar-links a {
  display      : inline-flex;
  align-items  : center;
  padding      : .45rem .9rem;
  border-radius: 8px;
  color        : var(--text-muted);
  font-size    : .88rem;
  font-weight  : 500;
  letter-spacing: .3px;
  transition   : color .15s, background .15s;
  text-decoration: none;
}

.navbar-links a:hover,
.navbar-links a.active { color: var(--text); background: rgba(255,255,255,.05); }

/* ── Navbar auth ──────────────────────────────────────── */
.navbar-auth {
  display    : flex;
  align-items: center;
  gap        : .75rem;
}

/* Bouton "Connexion Discord" */
.btn-discord-login {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem 1rem;
  background: var(--accent);
  color: #fff !important;
  border-radius: var(--radius);
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .3px;
  transition: background .15s, transform .1s;
  white-space: nowrap;
}

.btn-discord-login:hover {
  background: var(--accent-h);
  color: #fff;
  transform: translateY(-1px);
}

.navbar-avatar {
  width        : 30px;
  height       : 30px;
  border-radius: 50%;
  object-fit   : cover;
  border       : 1.5px solid rgba(255,255,255,.15);
  flex-shrink  : 0;
}

.navbar-avatar-fallback {
  width        : 30px;
  height       : 30px;
  border-radius: 50%;
  background   : var(--accent);
  color        : #fff;
  font-size    : .75rem;
  font-weight  : 700;
  align-items  : center;
  justify-content: center;
  flex-shrink  : 0;
}

.navbar-username {
  max-width    : 120px;
  overflow     : hidden;
  text-overflow: ellipsis;
  white-space  : nowrap;
  font-size    : .875rem;
}

/* ── Navbar logo image ─────────────────────────────────── */
.navbar-logo-img {
  height    : 40px;
  width     : auto;
  display   : block;
  object-fit: contain;
  /* Légère ombre pour faire ressortir le logo sur fond sombre */
  filter    : drop-shadow(0 0 8px rgba(88,101,242,.35));
  transition: filter .2s ease;
}
.navbar-brand:hover .navbar-logo-img {
  filter: drop-shadow(0 0 14px rgba(88,101,242,.6));
}

/* ── Sous-menu PBE ─────────────────────────────────────────── */
.navbar-has-sub { position: relative; }

/* Le bouton PBE hérite exactement du style des liens <a> */
.navbar-link-pbe {
  display    : inline-flex;
  align-items: center;
  gap        : .3rem;
  background : none;
  border     : none;
  cursor     : pointer;
  font-family: inherit;
  font-size  : .88rem;
  font-weight: 500;
  color      : var(--text-muted);   /* ← même couleur que les autres liens */
  letter-spacing: .3px;
  padding    : .45rem .9rem;
  border-radius: 8px;
  transition : color .15s, background .15s;
}
.navbar-link-pbe:hover,
.navbar-has-sub:hover .navbar-link-pbe {
  color      : var(--text);
  background : rgba(255,255,255,.05);
}

.nav-chevron { transition: transform .2s ease; flex-shrink: 0; }

/*
 * Le sous-menu commence flush avec le bas du <li> (top:100%)
 * puis un padding-top de 8px crée l'espace visuel SANS créer de gap
 * → la souris reste sur le <li> pendant tout le trajet vers le menu
 */
.navbar-sub {
  display      : none;
  position     : absolute;
  top          : 100%;            /* flush — pas de gap */
  left         : 50%;
  transform    : translateX(-50%);
  min-width    : 222px;
  padding-top  : 8px;             /* espace visuel entre bouton et panneau */
  z-index      : 150;
}

/* Le panneau visuel dans un pseudo-élément pour ne pas couper le hover */
.navbar-sub-inner {
  background   : var(--bg-card);
  border       : 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  box-shadow   : 0 12px 40px rgba(0,0,0,.55);
  padding      : .4rem;
  animation    : subFadeIn .15s ease;
}

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

/* Hover desktop */
@media (hover: hover) {
  .navbar-has-sub:hover .navbar-sub  { display: block; }
  .navbar-has-sub:hover .nav-chevron { transform: rotate(180deg); }
}
/* Clic mobile (JS toggle) */
.navbar-has-sub.navbar-sub-open .navbar-sub  { display: block; }
.navbar-has-sub.navbar-sub-open .nav-chevron { transform: rotate(180deg); }

.navbar-sub-item {
  display        : flex;
  align-items    : center;
  gap            : .75rem;
  padding        : .65rem .8rem;
  border-radius  : 8px;
  text-decoration: none;
  color          : var(--text-muted) !important;
  transition     : background .12s, color .12s;
}
.navbar-sub-item:hover {
  background: rgba(255,255,255,.05);
  color     : var(--text) !important;
}
.navbar-sub-icon  { font-size: 1.1rem; flex-shrink:0; width:1.6rem; text-align:center; }
.navbar-sub-label { display:flex; flex-direction:column; gap:.05rem; }
.navbar-sub-label strong { font-size:.88rem; font-weight:600; color:var(--text); }
.navbar-sub-label small  { font-size:.75rem; color:var(--text-muted); }
.navbar-sub-sep   { height:1px; background:var(--border); margin:.3rem .4rem; }

/* ── Navbar right — colonne droite ──────────────────────── */
.navbar-right {
  display        : flex;
  align-items    : center;
  gap            : .75rem;
  justify-self   : end;
}


/* ── Cloche notifications ──────────────────────────────── */
.navbar-bell {
  position     : relative;
  display      : flex;
  align-items  : center;
  justify-content: center;
  width        : 36px;
  height       : 36px;
  border-radius: 50%;
  color        : var(--text-muted);
  text-decoration: none;
  transition   : background .15s, color .15s;
}
.navbar-bell:hover {
  background: var(--bg-hover);
  color     : var(--text);
}
.navbar-bell-badge {
  position   : absolute;
  top        : 2px;
  right      : 2px;
  min-width  : 16px;
  height     : 16px;
  padding    : 0 3px;
  background : var(--red);
  color      : #fff;
  font-size  : .65rem;
  font-weight: 700;
  border-radius: 10px;
  display    : flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border     : 2px solid var(--bg);
}

/* ── Dropdown utilisateur ──────────────────────────────── */
.navbar-user-menu { position: relative; }

.navbar-user-btn {
  display      : flex;
  align-items  : center;
  gap          : .45rem;
  background   : none;
  border       : none;
  cursor       : pointer;
  color        : var(--text);
  font-size    : .875rem;
  font-weight  : 500;
  padding      : .3rem .55rem;
  border-radius: var(--radius);
  transition   : background .15s;
}
.navbar-user-btn:hover { background: var(--bg-hover); }

.navbar-chevron {
  color      : var(--text-muted);
  transition : transform .2s ease;
  flex-shrink: 0;
}
.navbar-user-btn[aria-expanded="true"] .navbar-chevron { transform: rotate(180deg); }

.navbar-dropdown {
  display      : none;
  position     : absolute;
  right        : 0;
  top          : calc(100% + 6px);
  min-width    : 200px;
  background   : var(--bg-card);
  border       : 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  box-shadow   : 0 8px 32px rgba(0,0,0,.5);
  padding      : .35rem;
  z-index      : 200;
  animation    : ddFadeIn .12s ease;
}
.navbar-dropdown-open { display: block; }

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

.navbar-dropdown-item {
  display      : flex;
  align-items  : center;
  gap          : .55rem;
  padding      : .6rem .8rem;
  border-radius: 6px;
  color        : var(--text-muted) !important;
  font-size    : .875rem;
  font-weight  : 500;
  text-decoration: none;
  transition   : background .12s, color .12s;
}
.navbar-dropdown-item:hover {
  background: var(--bg-hover);
  color     : var(--text) !important;
}
.navbar-dropdown-item-admin       { color: var(--gold) !important; }
.navbar-dropdown-item-admin:hover { background: rgba(245,166,35,.08); color: var(--gold) !important; }
.navbar-dropdown-item-danger       { color: var(--red) !important; }
.navbar-dropdown-item-danger:hover { background: rgba(237,66,69,.08); color: var(--red) !important; }

.navbar-dropdown-sep {
  height    : 1px;
  background: var(--border);
  margin    : .3rem .35rem;
}

/* ── Container helper (pour les pages qui en ont besoin) ── */
.container {
  max-width: 1140px;
  margin   : 0 auto;
  padding  : 0 1.5rem;
}

/* ── Layout ───────────────────────────────────────────── */
.main-content { flex: 1; }

.section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: .5rem;
  letter-spacing: 1px;
}

.section-sub {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: .95rem;
}

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: .65rem 1.4rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-align: center;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-h); color: #fff; }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--bg-hover); color: var(--text); }

/* ── Hero ─────────────────────────────────────────────── */
.hero {
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: radial-gradient(ellipse at center, #1a1f35 0%, var(--bg) 70%);
  border-bottom: 1px solid var(--border);
}

.hero-title {
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 900;
  letter-spacing: 10px;
  background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin: 1rem 0 2rem;
}

.hero-actions { display: flex; gap: 1rem; justify-content: center; }

/* ── Mini Leaderboard (Home) ──────────────────────────── */
.leaderboard-mini {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.lb-mini-row {
  display: grid;
  grid-template-columns: 3rem 1fr 8rem 7rem;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem 1.2rem;
  color: var(--text);
  transition: background .15s;
}

.lb-mini-row:hover { background: var(--bg-hover); }

.lb-rank { font-weight: 700; color: var(--text-muted); }
.rank-1 { color: var(--gold); }
.rank-2 { color: var(--silver); }
.rank-3 { color: var(--bronze); }

.lb-mmr { font-weight: 700; text-align: right; }
.lb-wr { color: var(--text-muted); font-size: .85rem; text-align: right; }

/* ── Home live stats ─────────────────────────────────── */
.home-live { padding-top: 2rem; padding-bottom: 1.5rem; }

.live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.live-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: border-color .2s;
}

.live-card-active {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(245,166,35,.15);
}

.live-card-icon {
  font-size: 1.75rem;
  line-height: 1;
  flex-shrink: 0;
  padding-top: .15rem;
}

.live-card-body {
  display: flex;
  flex-direction: column;
  gap: .1rem;
}

.live-card-value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
}

.live-card-max {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
}

.live-card-label {
  color: var(--text-muted);
  font-size: .85rem;
}

.live-timer {
  margin-top: .3rem;
  font-size: .78rem;
  color: var(--gold);
}

/* ── Features ─────────────────────────────────────────── */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
}

.feature-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.feature-card h3 { margin-bottom: .5rem; font-size: 1.1rem; }
.feature-card p { color: var(--text-muted); font-size: .9rem; line-height: 1.6; }

/* ── Utilities ────────────────────────────────────────── */
.text-green { color: var(--green); }
.text-red   { color: var(--red); }
.text-gold  { color: var(--gold); }
.text-muted { color: var(--text-muted); }

/* ── Error page ───────────────────────────────────────── */
.error-page { text-align: center; padding: 6rem 1.5rem; }
.error-code { font-size: 8rem; font-weight: 900; color: var(--accent); line-height: 1; }
.error-message { color: var(--text-muted); margin: 1rem 0 2rem; font-size: 1.1rem; }

/* ── Footer ───────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: .82rem;
  padding: 1.25rem 0;
}
.footer-inner {
  display        : flex;
  align-items    : center;
  justify-content: space-between;
  gap            : 1rem;
  flex-wrap      : wrap;
}
.footer-copy  { color: var(--text-muted); }
.footer-links { display: flex; gap: 1.25rem; }
.footer-links a { color: var(--text-muted); transition: color .15s; }
.footer-links a:hover { color: var(--text); }
.footer-disclaimer {
  text-align  : center;
  font-size   : .72rem;
  color       : var(--text-muted);
  opacity     : .55;
  margin      : .5rem auto 0;
  padding     : 0 1.5rem .25rem;
  max-width   : 680px;
}

/* ── Badge ────────────────────────────────────────────── */
.badge-season {
  background: var(--accent);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 100px;
  vertical-align: middle;
  text-transform: uppercase;
}

/* ── Auth toast ───────────────────────────────────────── */
.auth-toast {
  text-align: center;
  padding: .7rem 1.5rem;
  font-size: .9rem;
  font-weight: 500;
}
.auth-toast-warn  { background: rgba(254,231,92,.12); color: var(--gold); border-bottom: 1px solid rgba(254,231,92,.2); }
.auth-toast-error { background: rgba(237,66,69,.1);   color: var(--red);  border-bottom: 1px solid rgba(237,66,69,.2); }

/* ── Pagination ───────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
  color: var(--text-muted);
}

/* ── Burger ───────────────────────────────────────────── */
.navbar-burger {
  display       : none;
  background    : none;
  border        : none;
  cursor        : pointer;
  padding       : .4rem;
  color         : var(--text);
  border-radius : var(--radius);
  transition    : background .15s;
  flex-shrink   : 0;
}
.navbar-burger:hover { background: rgba(255,255,255,.07); }

/* ── Responsive navbar ───────────────────────────────── */
@media (max-width: 768px) {
  .navbar {
    grid-template-columns: auto 1fr;
    grid-template-rows   : auto auto;
    height               : auto;
    padding              : .6rem 1rem;
    gap                  : 0;
  }
  .navbar-brand  { grid-column: 1; grid-row: 1; align-self: center; }
  .navbar-right  { grid-column: 2; grid-row: 1; justify-self: end; align-self: center; display: flex; align-items: center; gap: .5rem; }
  .navbar-burger { display: flex; align-items: center; }
  .navbar-links  {
    display        : none;
    grid-column    : 1 / -1;
    grid-row       : 2;
    justify-content: flex-start;
    flex-wrap      : wrap;
    padding        : .4rem 0 .5rem;
    border-top     : 1px solid var(--border);
    margin-top     : .4rem;
  }
  .navbar.navbar-mobile-open .navbar-links { display: flex; }
  .navbar-search-input { width: 90px; }
}

@media (max-width: 480px) {
  .navbar-search  { display: none; }
  .navbar-logo-img { height: 32px; }
}

/* ── Badges supporter ────────────────────────────────── */
.supporter-badge {
  display: inline-flex;
  align-items: center;
  font-size: .6rem;
  font-weight: 800;
  letter-spacing: .5px;
  padding: 1px 5px;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 4px;
  background: rgba(139, 92, 246, .15);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, .35);
  line-height: 1.6;
}
.supporter-badge-gold {
  background: rgba(245, 158, 11, .15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, .4);
}

/* ── Lien "Nous rejoindre" dans la navbar ────────────── */
.navbar-link-join {
  color      : #7289da !important;
  font-weight: 600;
  display    : inline-flex;
  align-items: center;
  gap        : .3rem;
}
.navbar-link-join:hover,
.navbar-link-join.navbar-link-active { color: #5865f2 !important; }

/* ── Lien Ko-fi dans la navbar ───────────────────────── */
.navbar-kofi-link {
  color: #a78bfa !important;
  font-weight: 600;
}
.navbar-kofi-link:hover { color: #c4b5fd !important; }

/* ── Lien Ko-fi dans le footer ───────────────────────── */
.footer-kofi {
  color: #a78bfa;
  font-weight: 600;
}
.footer-kofi:hover { color: #c4b5fd; }
