/* =============================================================
   JUNSPRO — Navigation Globale Premium
   Mobile/tablette (≤991.98px) + actions header desktop.
   ============================================================= */

/* ── ICÔNE MESSAGES GLOBALE (mobile + desktop) ──────────── */
.jnp-msg-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid rgba(109, 40, 217, 0.20);
  background: none;
  color: #5b21b6;
  text-decoration: none;
  transition: background 0.15s ease;
  flex-shrink: 0;
}
.jnp-msg-btn:hover {
  background: rgba(109, 40, 217, 0.06);
  color: #4c1d95;
}
.jnp-msg-btn:focus-visible {
  outline: 2px solid rgba(109, 40, 217, 0.30);
  outline-offset: 2px;
}

/* ── BADGE UNREAD RÉEL ──────────────────────────────────── */
.jnp-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 16px;
  height: 16px;
  background: #dc2626;
  color: #ffffff;
  font-size: 9px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  padding: 0 3px;
  border: 1.5px solid #ffffff;
  pointer-events: none;
  white-space: nowrap;
}

/* Par défaut : les éléments mobiles sont invisibles */
.jnp-mobile-bar,
.jnp-offcanvas,
.jnp-overlay {
  display: none;
}

/* ── GARDE-FOU DESKTOP ─────────────────────────────────── */
@media (min-width: 992px) {
  .jnp-mobile-bar,
  .jnp-offcanvas,
  .jnp-overlay {
    display: none !important;
  }
}

/* ── MOBILE + TABLETTE (≤991.98px) ────────────────────── */
@media (max-width: 991.98px) {

  /* Remplace la navbar existante par la barre fixe */
  .header-area .main-navbar {
    display: none !important;
  }
  .header-area .mobile-menu {
    display: none !important;
  }
  .header-area .main-responsive-nav {
    display: none !important;
  }

  /* Espace réservé pour la barre fixe */
  .main-wrapper {
    padding-top: 56px;
  }

  /* ── BARRE FIXE ──────────────────────────────────────── */
  .jnp-mobile-bar {
    display: flex;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    background: #ffffff;
    border-bottom: 1px solid rgba(109, 40, 217, 0.10);
    box-shadow: 0 1px 10px rgba(76, 29, 149, 0.07);
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    z-index: 1030;
    gap: 10px;
  }

  /* ── BOUTON HAMBURGER ────────────────────────────────── */
  .jnp-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    flex-shrink: 0;
  }
  .jnp-hamburger:hover,
  .jnp-hamburger:focus-visible {
    background: rgba(109, 40, 217, 0.06);
    outline: 2px solid rgba(109, 40, 217, 0.25);
  }
  .jnp-hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: #4c1d95;
    border-radius: 2px;
    transition: transform 0.22s ease, opacity 0.18s ease;
    pointer-events: none;
  }
  .jnp-hamburger.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .jnp-hamburger.open span:nth-child(2) {
    opacity: 0;
  }
  .jnp-hamburger.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* ── BRAND (barre fixe) — reuse junspro-logo markup ─── */
  /* Correction locale : l'ancien gradient mobile de mobile-tablet-enhancements.css
     (≤991.98px) recolore JUNSPRO en violet à l'intérieur de .header-area.
     Ce gradient n'est pas la référence produit validée.
     On restitue ici la couleur sombre validée #0B0F1A (cf. layout.blade.php ligne 654).
     Scope strict : nouveau composant uniquement. Règle globale inchangée. */
  .jnp-mobile-bar .junspro-logo-text,
  .jnp-oc-header .junspro-logo-text {
    background: none !important;
    -webkit-background-clip: unset !important;
    background-clip: unset !important;
    -webkit-text-fill-color: #0B0F1A !important;
    color: #0B0F1A !important;
    text-shadow: none !important;
  }

  /* Taille adaptée à la hauteur 56px ; couleurs héritées du CSS existant */
  .jnp-mobile-bar .junspro-logo {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }
  .jnp-mobile-bar .junspro-logo-top {
    gap: 6px !important;
  }
  .jnp-mobile-bar .junspro-logo-icon {
    height: 30px !important;
    max-height: 30px !important;
  }
  .jnp-mobile-bar .junspro-logo-text {
    font-size: 16px !important;
    letter-spacing: 0.06em !important;
  }
  .jnp-mobile-bar .junspro-logo-divine {
    font-size: 9px !important;
    margin-top: 1px !important;
  }
  .jnp-mobile-bar .junspro-logo-line {
    display: none !important;
  }

  /* ── ICÔNES BARRE FIXE (messages + user) ────────────── */
  .jnp-topbar-right {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 4px;
  }
  .jnp-topbar-user,
  .jnp-topbar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1.5px solid rgba(109, 40, 217, 0.20);
    background: none;
    color: #5b21b6;
    text-decoration: none;
    flex-shrink: 0;
  }
  .jnp-topbar-user:hover,
  .jnp-topbar-icon:hover {
    background: rgba(109, 40, 217, 0.06);
  }
  .jnp-topbar-icon {
    position: relative;
  }

  /* ── OVERLAY ─────────────────────────────────────────── */
  .jnp-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.50);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.25s ease;
  }
  .jnp-overlay.visible {
    opacity: 1;
  }

  /* ── PANEL OFF-CANVAS ───────────────────────────────── */
  .jnp-offcanvas {
    display: flex;
    position: fixed;
    top: 0; left: 0;
    width: min(300px, 87vw);
    height: 100dvh;
    height: 100vh; /* fallback */
    background: #faf9ff;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform 0.27s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    flex-direction: column;
    box-shadow: 4px 0 28px rgba(76, 29, 149, 0.14);
  }
  .jnp-offcanvas.open {
    transform: translateX(0);
  }

  /* Header du panel */
  .jnp-oc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(139, 92, 246, 0.10);
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 1;
    flex-shrink: 0;
  }

  /* ── BRAND (off-canvas header) — reuse junspro-logo markup ─ */
  /* Taille adaptée au panel 300px ; couleurs héritées du CSS existant */
  .jnp-oc-header .junspro-logo {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }
  .jnp-oc-header .junspro-logo-top {
    gap: 8px !important;
  }
  .jnp-oc-header .junspro-logo-icon {
    height: 34px !important;
    max-height: 34px !important;
  }
  .jnp-oc-header .junspro-logo-text {
    font-size: 18px !important;
    letter-spacing: 0.06em !important;
  }
  .jnp-oc-header .junspro-logo-divine {
    font-size: 9px !important;
    margin-top: 1px !important;
  }
  .jnp-oc-header .junspro-logo-line {
    display: none !important;
  }

  /* Bouton fermer */
  .jnp-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1.4rem;
    color: #374151;
    border-radius: 8px;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
  }
  .jnp-close:hover,
  .jnp-close:focus-visible {
    background: rgba(109, 40, 217, 0.06);
    color: #4c1d95;
    outline: 2px solid rgba(109, 40, 217, 0.20);
  }

  /* ── NAVIGATION ─────────────────────────────────────── */
  .jnp-oc-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 6px 0;
  }
  .jnp-oc-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .jnp-oc-nav > ul > li {
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  }
  .jnp-oc-nav a,
  .jnp-accordion-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    font-size: 0.925rem;
    font-weight: 500;
    color: #111827;
    text-decoration: none;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    min-height: 48px;
  }
  .jnp-oc-nav a:hover,
  .jnp-accordion-toggle:hover {
    background: rgba(109, 40, 217, 0.04);
    color: #5b21b6;
  }
  .jnp-oc-nav a:focus-visible,
  .jnp-accordion-toggle:focus-visible {
    outline: 2px solid rgba(109, 40, 217, 0.35);
    outline-offset: -2px;
  }

  /* Icône accordéon */
  .jnp-acc-icon {
    font-size: 1.1rem;
    color: #7c3aed;
    transition: transform 0.20s ease;
    font-weight: 300;
    flex-shrink: 0;
    margin-left: 8px;
  }
  .jnp-has-children.open > .jnp-accordion-toggle .jnp-acc-icon {
    transform: rotate(45deg);
  }

  /* Sous-menu accordéon */
  .jnp-submenu {
    display: none;
    background: rgba(109, 40, 217, 0.025);
    border-top: 1px solid rgba(109, 40, 217, 0.06);
  }
  .jnp-has-children.open > .jnp-submenu {
    display: block;
  }
  .jnp-submenu li a {
    padding: 11px 20px 11px 32px;
    font-size: 0.875rem;
    color: #4b5563;
    font-weight: 400;
    min-height: 44px;
  }
  .jnp-submenu li a:hover {
    color: #5b21b6;
  }

  /* ── FOOTER D'AUTH ──────────────────────────────────── */
  .jnp-oc-footer {
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
    border-top: 1px solid rgba(139, 92, 246, 0.10);
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
  }
  .jnp-oc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    min-height: 44px;
    transition: opacity 0.15s ease;
  }
  .jnp-oc-btn:hover { opacity: 0.85; }
  .jnp-btn-primary {
    background: linear-gradient(135deg, #6d28d9 0%, #7c3aed 100%);
    color: #ffffff;
  }
  .jnp-btn-outline {
    border: 1.5px solid rgba(109, 40, 217, 0.35);
    color: #5b21b6;
    background: transparent;
  }
  .jnp-btn-ghost {
    color: #6b7280;
    background: transparent;
  }

  /* ── SCROLL LOCK ────────────────────────────────────── */
  body.jnp-menu-open {
    overflow: hidden;
    touch-action: none;
  }
}
