/* ==========================================================================
   Rendevu — Header (Redo)
   ========================================================================== */

:root {
  --hdr-bg: #152238;
  /* Navy (matches logo) */
  --hdr-menu-bg: #152238;
  /* Mobile Menu BG */
  --hdr-border: rgba(255, 255, 255, .08);
  --hdr-text: #F8FAFC;
  /* Slate 50 */
  --hdr-text-hover: #FF8FB1;
  /* Light Pink (logo) */
  --hdr-cta: #FF2E79;
  /* Hot Pink (logo) */
  --hdr-cta-text: #FFFFFF;
  /* White text on pink */

  /* Layout */
  --hdr-height-mobile: 80px;
  --hdr-height-desktop: 100px;
  /* Safe area for notch/Dynamic Island (iPhone X+) */
  --hdr-safe-top: env(safe-area-inset-top, 0px);
  /* In-app browsers (Instagram, etc.): JS sets --hdr-visual-inset-top (chrome band). Filled via padding-top, not top:. */
  --hdr-visual-inset-top: 0px;
  /* Outer header box (border-box): logo row + safe area + in-app chrome padding — aligns with body padding-top */
  --hdr-bar-height-mobile: calc(var(--hdr-height-mobile) + var(--hdr-safe-top) + var(--hdr-visual-inset-top));
  --hdr-bar-height-desktop: calc(var(--hdr-height-desktop) + var(--hdr-safe-top) + var(--hdr-visual-inset-top));
  --hdr-offset-mobile: var(--hdr-bar-height-mobile);
  --hdr-offset-desktop: var(--hdr-bar-height-desktop);
}

/* --- Base Header --- */
.mp-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  /* Au-dessus des sections (isolation / z-index ~1000) ; sous la tabbar bas de page (10020) */
  z-index: 10050;
  background: var(--hdr-bg);
  border-bottom: 1px solid var(--hdr-border);
  /* No transition on padding/top/height — avoids janky layout when env/JS vars change */
  transition: background-color 0.3s ease, border-color 0.3s ease;
  padding-top: calc(var(--hdr-safe-top) + var(--hdr-visual-inset-top));
  height: var(--hdr-bar-height-mobile);
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

/* Blur Layer (Pseudo) */
.mp-header::before {
  content: "";
  position: absolute;
  inset: 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: -1;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s ease;
  /* WebKit : sans couche dédiée, blur + fixed peut faire « disparaître » le header au scroll */
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: translateZ(0);
}

/* iOS WebKit : translateZ sur le ::before + rubber-band / pull-to-refresh peut séparer le calque
   du fond et celui du contenu (.wrap) — le logo/menu restent « collés » au haut de l’écran. */
@supports (-webkit-touch-callout: none) {
  .mp-header::before {
    transform: none;
  }
}

/* WebViews Instagram / FB / Telegram : backdrop-filter sur un header fixed peut « traîner » des calques
   fantômes (logo / texte fantômes, bande claire) au scroll — fond uni uniquement. */
html.mp-inapp-wk .mp-header::before {
  content: none;
}

/* Transparent State (Home Hero) */
.mp-header.is-transparent {
  background: transparent !important;
  border-bottom-color: transparent !important;
  box-shadow: none !important;
}

.mp-header.is-transparent::before {
  opacity: 0;
}

/* Ensure solid background when mobile menu is open, overriding transparency */
.mp-header.is-open {
  background: var(--hdr-bg) !important;
  border-bottom-color: var(--hdr-border) !important;
}

/* Layout Wrapper */
.mp-header .wrap {
  flex-grow: 1 !important;
  width: 100% !important;
  max-width: 80rem;
  /* 1280px */
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  height: 100%;
}

/* --- Brand / Logo --- */
.mp-header .brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  /* Prevent shrinking */
  text-decoration: none;
}

.mp-header .brand-logo {
  display: block;
  height: 48px;
  /* Mobile Size */
  width: auto;
  /* style.css impose max-width:100% sur tous les img : en flex (WebKit / Safari), le % se
     résout trop petit et le SVG wordmark est tronqué (ex. barre gauche du « R »). */
  max-width: none;
  flex-shrink: 0;
  border-radius: 0;
  transition: height 0.3s ease;
}

/* --- Navigation (Hamburger Overlay Style Global) --- */
.mp-header .nav {
  position: fixed;
  top: var(--hdr-offset-mobile);
  /* Below header + safe area */
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--hdr-menu-bg);
  display: none;
  /* Toggled by JS */
  flex-direction: column;
  padding: 2rem;
  overflow-y: auto;
  border-top: 1px solid var(--hdr-border);
}

.mp-header.is-open .nav {
  display: flex;
}

/* Groups stacked */
.nav-left,
.nav-right {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 0;
}

.nav-right {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.nav-item {
  width: 100%;
  min-width: 0;
  margin-bottom: 0;
}

.nav-link,
.nav-link--toggle {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 1.1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--hdr-text);
  text-decoration: none;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  -webkit-tap-highlight-color: transparent;
  tap-highlight-color: transparent;
}

/* Sous-menus : chevron (indique qu’on peut déplier) */
.nav-link--toggle {
  justify-content: flex-start;
  align-items: center;
  gap: 0.5rem;
}

.nav-link--toggle::after {
  content: "";
  display: block;
  width: 0.45em;
  height: 0.45em;
  margin-left: auto;
  flex-shrink: 0;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.85;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-item.is-open .nav-link--toggle::after {
  transform: rotate(-135deg);
  opacity: 1;
}

/* Specific Login Link Style */
.nav-link--login {
  text-align: left;
  display: block;
  line-height: normal;
}

.submenu {
  display: none;
  margin-top: 0.5rem;
  padding-left: 1rem;
  border-left: 2px solid var(--hdr-border);
}

.nav-item.is-open .submenu {
  display: block;
}

.submenu a {
  display: block;
  padding: 0.75rem 0;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 1rem;
}

/* CTA Button */
.btn-cta {
  background: var(--hdr-cta);
  color: var(--hdr-cta-text);
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.6rem 1.2rem;
  border-radius: 99px;
  text-decoration: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
  white-space: nowrap;
  margin-top: 1rem;
  display: inline-block;
}

/* Menu : bouton Événements pleine largeur, texte centré à toute largeur */
.mp-header .nav .nav-item .btn-cta {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.mp-header .nav .nav-item .btn-cta .btn-cta-inner {
  display: block;
  width: 100%;
  text-align: center;
}

.btn-cta:hover {
  transform: scale(1.02);
  opacity: 0.95;
}


/* --- Mobile Toggle (Visible Always) --- */
.nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 8px;
  width: 44px;
  height: 44px;
  cursor: pointer;
  color: #fff;
}

/* --- Mobile Panels (New) --- */
.mobile-panels {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
  margin-top: 2rem;
}

.mobile-panel {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--hdr-border);
  border-radius: 12px;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
}

.mobile-panel-header {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 0.75rem;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mobile-panel a {
  display: block;
  padding: 0.75rem 0;
  color: #fff;
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 500;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  -webkit-tap-highlight-color: transparent;
  tap-highlight-color: transparent;
}

.mobile-panel a:last-child {
  border-bottom: none;
}

/* Only apply hover color on devices with true hover (desktop). On mobile tap, Safari
   can "stick" :hover and cause pink+white ghosting. */
@media (hover: hover) {
  .mobile-panel a:hover {
    color: var(--hdr-cta);
    padding-left: 0.25rem;
    transition: all 0.2s ease;
  }
}

/* Touch devices: force white on tap to avoid pink+white ghosting (Safari can stick :hover) */
@media (hover: none) {
  .mobile-panel a:active {
    color: #fff !important;
  }
}


/* --- Desktop Enhancements (Still keep height adjustment) --- */
@media (min-width: 1250px) {
  .mp-header {
    height: var(--hdr-bar-height-desktop);
  }

  .mp-header .nav {
    top: var(--hdr-offset-desktop);
    /* Start overlay below desktop header */
    padding: 3rem;
    /* More padding on desktop */
  }

  /* Logo Scales Up */
  .mp-header .brand-logo {
    height: 56px;
  }

  /* Make text slightly larger on desktop drawer */
  .nav-link,
  .nav-link--toggle {
    font-size: 1.3rem;
  }
}

/* --- Mobile bottom tab bar (app-like nav; clients + visiteurs) --- */
:root {
  --mp-bottom-tabbar-h: 52px;
}

.mp-bottom-tabbar {
  display: none;
}

/* ≤1024px : inclut viewport 1024 (bureau iPhone / certains WebKit) + téléphones. */
@media (max-width: 1024px) {
  body.mp-body:has(.mp-bottom-tabbar) {
    /* --mp-vv-bottom-nudge : corrige Chrome/Safari mobile quand la barre navigateur change de hauteur */
    padding-bottom: calc(var(--mp-bottom-tabbar-h) + env(safe-area-inset-bottom, 0px) + var(--mp-vv-bottom-nudge, 0px));
  }

  /* Bandeaux fixed bottom (édition profil, aperçu profil, match…) : au-dessus de la tabbar ; z-index > tabbar si léger décalage */
  body.mp-body:has(.mp-bottom-tabbar) .sticky-create:not(.at-bottom) {
    bottom: calc(var(--mp-bottom-tabbar-h) + env(safe-area-inset-bottom, 0px) + var(--mp-vv-bottom-nudge, 0px));
    z-index: 10025;
  }

  body.mp-body:has(.mp-bottom-tabbar) .sticky-create.at-bottom {
    bottom: calc(var(--mp-bottom-tabbar-h) + env(safe-area-inset-bottom, 0px) + var(--mp-vv-bottom-nudge, 0px));
    z-index: 10025;
  }

  body.mp-body:has(.mp-bottom-tabbar) .sticky-create-wrap {
    min-height: calc(5.5rem + var(--mp-bottom-tabbar-h) + env(safe-area-inset-bottom, 0px) + var(--mp-vv-bottom-nudge, 0px));
  }

  body.mp-body:has(.mp-bottom-tabbar) .express-continue-bar {
    bottom: calc(var(--mp-bottom-tabbar-h) + env(safe-area-inset-bottom, 0px) + var(--mp-vv-bottom-nudge, 0px));
  }

  /* Fiche événement / inscription rapide : bandeau CTA fixe au-dessus de la tabbar (évite bottom:0 + z-index 120 sous la barre). */
  body.mp-body:has(.mp-bottom-tabbar) .ed-sticky-register {
    bottom: calc(var(--mp-bottom-tabbar-h) + env(safe-area-inset-bottom, 0px) + var(--mp-vv-bottom-nudge, 0px));
    z-index: 10025;
    padding: 0.55rem 1rem 0.55rem;
  }

  .mp-bottom-tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10020;
    min-height: var(--mp-bottom-tabbar-h);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
    /* Opacité forcée : sur Chrome mobile, var() + seule couleur peut laisser le scroll visible */
    background-color: #152238;
    background-color: var(--hdr-bg, #152238);
    background-image: none;
    border-top: 1px solid var(--hdr-border);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
    justify-content: space-around;
    align-items: stretch;
    isolation: isolate;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    /* Descend avec le bas du visual viewport (Chrome iOS / barre d’outils dynamique) */
    transform: translateY(var(--mp-vv-bottom-nudge, 0px));
  }

  .mp-bottom-tabbar::before {
    content: "";
    position: absolute;
    inset: 0;
    background: #152238;
    background: var(--hdr-bg, #152238);
    z-index: -1;
    pointer-events: none;
  }

  .mp-header.is-open ~ .mp-bottom-tabbar {
    visibility: hidden;
    pointer-events: none;
  }

  .mp-tab {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 2px 8px;
    text-decoration: none;
    color: rgba(248, 250, 252, 0.62);
    font-family: 'Poppins', sans-serif;
    -webkit-tap-highlight-color: transparent;
    tap-highlight-color: transparent;
    position: relative;
  }

  .mp-tab.is-active {
    color: var(--hdr-text-hover);
  }

  .mp-tab__ic {
    font-size: 1.12rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .mp-tab__avatar {
    border-radius: 50%;
    object-fit: cover;
    width: 22px;
    height: 22px;
    border: 1px solid rgba(255, 46, 121, 0.55);
  }

  .mp-tab__lb {
    font-size: 0.52rem;
    font-weight: 600;
    line-height: 1.1;
    text-align: center;
    max-width: 100%;
    padding: 0 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mp-tab__dot {
    position: absolute;
    top: 3px;
    right: max(6px, 12%);
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #152238;
    box-sizing: border-box;
    line-height: 1;
  }

  .mp-tab__dot--events {
    background: #22c55e;
  }

  .mp-tab__dot--likes {
    background: var(--brand-gold, #ca8a04);
  }

  .mp-tab__dot--chat {
    background: #ef4444;
  }

  .mp-tab__pip {
    position: absolute;
    top: 5px;
    right: max(10px, 20%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    border: 1px solid #152238;
  }
}