/* =========================
   Top bar unique — Mobile-first
   Jouer · Mes joueurs · Mes gages · Mon compte (dropdown)
========================= */

#site-topbar {
  /* Le dropdown compte doit pouvoir dépasser le conteneur */
  position: relative;
  z-index: 300;
  overflow: visible;
}

/* Vitrine: on conserve le clipping du glow logo sur cette page */
body.vitrine-page #site-topbar {
  overflow: hidden;
}

/* Vitrine : topbar en fixed pour que le scroll-hide (transform) réapparaisse correctement */
body.vitrine-page #site-topbar .app-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
}
body.vitrine-page {
  padding-top: 72px;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(15, 15, 18, 0.96);
  border-bottom: 1px solid rgba(38, 38, 44, 0.8);
  position: sticky;
  top: 0;
  z-index: 200;
  backdrop-filter: blur(10px);
  transition: transform 0.25s ease-out;
}

/* scroll-hide : barre masquée au scroll (vitrine) — !important pour éviter tout override */
.app-topbar.topbar-scroll-hidden {
  transform: translateY(-100%) !important;
}

.app-topbar-logo {
  display: inline-flex;
  align-items: center;
  color: #ff4d8d;
  text-decoration: none;
  transition: color 0.2s ease;
  overflow: visible;
}

.app-topbar-logo-img {
  height: 56px;
  width: auto;
  display: block;
  transform: scale(1.5);
  transform-origin: left center;
  filter: drop-shadow(0 0 16px rgba(255, 77, 141, 0.85)) drop-shadow(0 0 32px rgba(255, 77, 141, 0.6));
}

.app-topbar-logo:hover {
  color: #ff6b8a;
}

/* Bouton menu mobile ☰ */
.app-topbar-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  background: transparent;
  border: 1px solid rgba(255, 77, 109, 0.25);
  border-radius: 10px;
  color: #f0f0f0;
  font-size: 1.4rem;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.app-topbar-menu-btn:hover {
  background: rgba(255, 77, 109, 0.1);
  border-color: rgba(255, 77, 109, 0.5);
  color: #ff4d8d;
}

/* Nav : mobile = drawer, desktop = horizontal */
.app-topbar-nav {
  position: fixed;
  top: 0;
  right: 0;
  width: min(280px, 85vw);
  height: 100vh;
  height: 100dvh;
  padding: 60px 20px calc(24px + env(safe-area-inset-bottom, 0px)) 20px;
  background: #121216;
  border-left: 1px solid rgba(38, 38, 44, 0.9);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 199;
  transform: translateX(100%);
  transition: transform 0.25s ease, visibility 0.25s ease;
  visibility: hidden;
  overflow-y: auto;
}

.app-topbar-nav.is-open {
  transform: translateX(0);
  visibility: visible;
}

.app-topbar-nav-link {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 16px 18px;
  box-sizing: border-box;
  color: #f0f0f0;
  text-decoration: none;
  font-size: 1.05rem;
  border-radius: 10px;
  transition: background 0.2s ease, color 0.2s ease;
}

.app-topbar-nav-link:hover {
  background: rgba(255, 77, 109, 0.12);
  color: #ff4d8d;
}

/* Jouer : dropdown modes */
.topbar-play-wrap {
  position: relative;
}

.topbar-play-trigger {
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  box-sizing: border-box;
  text-align: left;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  display: flex;
  align-items: center;
}

.topbar-play-chevron {
  font-size: 0.75em;
  opacity: 0.9;
}

.topbar-play-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: 260px;
  background: #1a1a1f;
  border: 1px solid rgba(38, 38, 44, 0.9);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  padding: 8px;
  z-index: 100;
}

.topbar-play-dropdown[hidden] {
  display: none !important;
}

.topbar-play-option {
  display: block;
  min-height: 44px;
  padding: 12px 14px;
  box-sizing: border-box;
  color: #f0f0f0;
  text-decoration: none;
  font-size: 0.95rem;
  border-radius: 10px;
  transition: background 0.2s ease, color 0.2s ease;
  line-height: 1.35;
  margin-bottom: 4px;
}
.topbar-play-option-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin-right: 10px;
  opacity: 0.95;
  color: #ff4d8d;
}
.topbar-play-option-icon svg {
  flex-shrink: 0;
}
.topbar-play-option:hover .topbar-play-option-icon {
  opacity: 1;
}

.topbar-play-option:last-child {
  margin-bottom: 0;
}

.topbar-play-option:hover {
  background: rgba(255, 77, 109, 0.15);
  color: #ff4d8d;
}

.topbar-play-desc {
  display: block;
  font-size: 0.8rem;
  color: #999;
  margin-top: 4px;
}

.topbar-play-option:hover .topbar-play-desc {
  color: #b0b0b0;
}

/* Bouton test switch Premium (à retirer plus tard) */
.topbar-premium-test {
  min-height: 44px;
  padding: 10px 14px;
  box-sizing: border-box;
  font-size: 0.85rem;
  color: #b0b0b0;
  background: rgba(255, 193, 7, 0.15);
  border: 1px solid rgba(255, 193, 7, 0.4);
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}
.topbar-premium-test:hover {
  background: rgba(255, 193, 7, 0.25);
  color: #e0e0e0;
}

/* Page connexion / création de compte : topbar minimal = logo seul, pas de hide au scroll */
.app-topbar.topbar-auth-page {
  justify-content: flex-start;
  transition: none;
}

.app-topbar-auth {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(38, 38, 44, 0.8);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Invité : Connexion + Créer un compte */
.topbar-auth-guest {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.topbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 14px 18px;
  box-sizing: border-box;
  text-align: center;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  border-radius: 10px;
  transition: background 0.2s ease, color 0.2s ease;
}

.topbar-btn-ghost {
  border: 1px solid rgba(255, 77, 109, 0.4);
  color: #ff4d8d;
}

.topbar-btn-ghost:hover {
  background: rgba(255, 77, 109, 0.12);
}

.topbar-btn-primary {
  background: #ff4d8d;
  color: #0f0f12;
  border: none;
}

.topbar-btn-primary:hover {
  background: #ff6b88;
}

/* Mon compte : dropdown (mobile = dans le drawer) */
.topbar-account-wrap {
  position: relative;
}

.topbar-account-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  padding: 14px 18px;
  box-sizing: border-box;
  background: transparent;
  border: 1px solid rgba(255, 77, 109, 0.3);
  border-radius: 10px;
  color: #f0f0f0;
  font-size: 1.05rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.topbar-account-trigger:hover {
  background: rgba(255, 77, 109, 0.1);
  border-color: rgba(255, 77, 109, 0.5);
  color: #ff4d8d;
}

.topbar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin-right: 8px;
  opacity: 0.9;
  color: #ff4d8d;
}
.topbar-icon svg {
  flex-shrink: 0;
}
.topbar-account-trigger:hover .topbar-icon {
  opacity: 1;
}

.topbar-account-chevron {
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 8px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid currentColor;
  vertical-align: middle;
  opacity: 0.9;
  transition: transform 0.2s ease;
}

.topbar-account-trigger[aria-expanded="true"] .topbar-account-chevron {
  transform: rotate(180deg);
}

.topbar-account-dropdown {
  margin-top: 8px;
  padding: 6px 0;
  background: rgba(20, 20, 24, 0.98);
  border: 1px solid rgba(38, 38, 44, 0.9);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.topbar-account-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  padding: 14px 18px;
  color: #e8e8e8;
  text-decoration: none;
  font-size: 1rem;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  border-radius: 0;
}

.topbar-account-item:hover {
  background: rgba(255, 77, 109, 0.12);
  color: #ff4d8d;
}

.topbar-account-logout {
  color: #b88;
}

.topbar-account-logout:hover {
  color: #ff6b8a;
}

/* Overlay quand menu mobile ouvert */
.app-topbar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 198;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.app-topbar-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

@media (min-width: 768px) {
  .app-topbar-overlay {
    display: none;
  }
}

/* Desktop : barre horizontale, pas de hamburger */
@media (min-width: 768px) {
  .app-topbar-menu-btn {
    display: none;
  }

  .app-topbar-nav {
    position: static;
    width: auto;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 0;
    margin-left: auto;
    background: transparent;
    border: none;
    box-shadow: none;
    transform: none;
    visibility: visible;
    overflow: visible;
    gap: 6px;
  }

  .app-topbar-nav.is-open::before {
    display: none;
  }

  .app-topbar-nav-link {
    min-height: 44px;
    padding: 10px 16px;
    box-sizing: border-box;
    font-size: 1rem;
  }

  .app-topbar-auth {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }

  .topbar-auth-guest {
    flex-direction: row;
    gap: 10px;
  }

  .topbar-btn {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 18px;
    box-sizing: border-box;
  }

  .topbar-account-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    min-width: 180px;
  }

  .topbar-account-trigger {
    width: auto;
    min-height: 44px;
    padding: 10px 16px;
    box-sizing: border-box;
    font-size: 1rem;
  }
}

@media (min-width: 900px) {
  .app-topbar {
    padding: 14px 24px;
  }
}

/* Modal Premium (Mes gages – utilisateur gratuit) — hors header pour centrage viewport */
.premium-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  min-height: 100vh;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  visibility: hidden;
  opacity: 0;
  transition: visibility 0.2s ease, opacity 0.2s ease;
  box-sizing: border-box;
}

.premium-modal-overlay.is-visible {
  visibility: visible;
  opacity: 1;
}

.premium-modal-overlay[hidden] {
  display: none !important;
}

.premium-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  min-height: 100%;
  background: rgba(0, 0, 0, 0.82);
  cursor: pointer;
}

.premium-modal-content {
  position: relative;
  background: #17171c;
  border: 1px solid #26262c;
  border-radius: 16px;
  padding: 28px 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.premium-modal-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 12px;
}

.premium-modal-icon-svg {
  font-size: 0;
  line-height: 0;
  position: relative;
  display: inline-block;
}

.premium-modal-icon-svg > svg:first-of-type {
  display: block;
  margin: 0 auto;
  color: #ff4d8d;
}

.premium-modal-icon-plus {
  position: absolute;
  right: 0;
  bottom: 0;
  transform: translate(30%, 30%);
  display: block;
  color: #ff4d8d;
  background: #17171c;
  border-radius: 50%;
  padding: 2px;
  box-sizing: border-box;
}

.premium-modal-title {
  margin: 0 0 12px 0;
  font-size: 1.25rem;
  color: #ff4d8d;
  font-weight: 600;
}

.premium-modal-text {
  margin: 0 0 24px 0;
  color: #ccc;
  font-size: 0.95rem;
  line-height: 1.45;
}

.premium-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.premium-modal-btn-primary {
  display: block;
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  background: #ff4d8d;
  color: #fff;
  text-decoration: none;
  text-align: center;
}

.premium-modal-btn-primary:hover {
  background: #ff6b88;
  color: #fff;
}

.premium-modal-btn-secondary {
  min-height: 44px;
  padding: 10px 16px;
  box-sizing: border-box;
  border: none;
  background: transparent;
  color: #b0b0b0;
  font-size: 0.9rem;
  cursor: pointer;
}

.premium-modal-btn-secondary:hover {
  color: #aaa;
}

/* Sélecteur de langue FR / EN */
.topbar-lang-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
}
.topbar-lang-switcher a {
  min-height: 44px;
  min-width: 44px;
  padding: 10px 12px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
  text-decoration: none;
  border-radius: 4px;
}
.topbar-lang-switcher a:hover {
  color: rgba(255, 255, 255, 0.9);
}
.topbar-lang-switcher a.topbar-lang.is-active {
  color: #ff4d8d;
  font-weight: 600;
}
