/* ================================================================
   NsStore.mx - Menu Usuario Premium v9
   Desktop: topbar horizontal, logout al extremo derecho
   Mobile: dropdown premium, logout al final, iniciar sesion visible
   ================================================================ */

/* -- CHIP MI CUENTA (todas las versiones) -- */
#topbar .header_user_info .popup-title a {
  background: rgba(255,255,255,.08) !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  border-radius: 20px !important;
  padding: 4px 12px !important;
  transition: background .12s !important;
}
#topbar .header_user_info .popup-title a:hover {
  background: rgba(255,255,255,.15) !important;
}
#topbar .header_user_info .popup-title .fa-cog {
  color: #60a5fa !important;
  font-size: 12px !important;
}
#topbar .header_user_info .popup-title > a > span {
  color: rgba(255,255,255,.8) !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
}

/* ================================================================
   DESKTOP + TABLET (>1024px)
   Horizontal. Logout al extremo derecho junto a Idiomas.
================================================================ */
@media (min-width: 1025px) {

  /* Lista horizontal con logout separado al final */
  #topbar .header_user_info .links {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 0 !important;
    width: 100% !important;
  }

  #topbar .header_user_info .links li {
    list-style: none !important;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
  }

  /* Logout al extremo derecho con margen separador */
  #topbar .header_user_info .links li:has(a.logout) {
    margin-left: auto !important;
    padding-left: 12px !important;
    border-left: 1px solid rgba(255,255,255,.1) !important;
  }

  /* Chip del saludo con nombre */
  #topbar .header_user_info .links li:first-child a.account {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    background: rgba(255,255,255,.1) !important;
    border: 1px solid rgba(255,255,255,.15) !important;
    border-radius: 20px !important;
    padding: 4px 12px 4px 5px !important;
    color: rgba(255,255,255,.85) !important;
    font-size: 11.5px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
  }
  #topbar .header_user_info .links li:first-child a.account::before {
    content: '\f007' !important;
    font-family: FontAwesome !important;
    width: 20px !important;
    height: 20px !important;
    background: #2563eb !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 9px !important;
    color: #ffffff !important;
    flex-shrink: 0 !important;
  }
  #topbar .header_user_info .links li:first-child a.account span {
    color: rgba(255,255,255,.85) !important;
    font-size: 11.5px !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    max-width: 140px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: inline-block !important;
  }
  #topbar .header_user_info .links li:first-child a.account:hover {
    background: rgba(255,255,255,.18) !important;
  }

  /* Links normales */
  #topbar .header_user_info .links li a {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 4px 10px !important;
    border-radius: 6px !important;
    color: rgba(255,255,255,.55) !important;
    font-size: 11.5px !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    transition: all .12s !important;
    background: transparent !important;
  }
  #topbar .header_user_info .links li a:hover {
    color: rgba(255,255,255,.9) !important;
    background: rgba(255,255,255,.07) !important;
  }

  /* Icono Caja */
  #topbar .header_user_info .links li a[href*="pedido-rapido"]::before,
  #topbar .header_user_info .links li a.last::before {
    content: '\f07a' !important;
    font-family: FontAwesome !important;
    font-size: 11px !important;
    color: rgba(255,255,255,.4) !important;
  }

  /* Icono Comparar */
  #topbar .header_user_info .links li a[href*="comparar"]::before {
    content: '\f0c3' !important;
    font-family: FontAwesome !important;
    font-size: 11px !important;
    color: rgba(255,255,255,.4) !important;
  }

  /* Cerrar sesion - extremo derecho junto a Idiomas */
  #topbar .header_user_info .links li:has(a.logout) {
    order: 99 !important;
    margin-left: auto !important;
    padding-left: 10px !important;
    border-left: 1px solid rgba(255,255,255,.1) !important;
  }
  #topbar .header_user_info .links li a.logout {
    color: rgba(252,165,165,.65) !important;
    border: 1px solid rgba(220,38,38,.15) !important;
    border-radius: 6px !important;
    font-size: 11px !important;
  }
  #topbar .header_user_info .links li a.logout::before {
    content: '\f08b' !important;
    font-family: FontAwesome !important;
    font-size: 11px !important;
    color: rgba(252,165,165,.5) !important;
  }
  #topbar .header_user_info .links li a.logout:hover {
    color: #fca5a5 !important;
    background: rgba(220,38,38,.1) !important;
    border-color: rgba(220,38,38,.25) !important;
  }

  /* Iniciar sesion (cuando NO hay sesion) */
  #topbar .header_user_info .links li a.login {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    background: #2563eb !important;
    border: none !important;
    border-radius: 20px !important;
    padding: 5px 14px !important;
    color: #ffffff !important;
    font-size: 11.5px !important;
    font-weight: 700 !important;
  }
  #topbar .header_user_info .links li a.login::before {
    content: '\f090' !important;
    font-family: FontAwesome !important;
    font-size: 11px !important;
    color: #ffffff !important;
  }
  #topbar .header_user_info .links li a.login:hover {
    background: #1d4ed8 !important;
  }
}

/* ================================================================
   MOBILE (<1024px)
   Dropdown premium. Logout al final. Iniciar sesion en blanco.
================================================================ */
@media (max-width: 1024px) {

  #topbar .header_user_info .links {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 16px 40px rgba(0,0,0,.18) !important;
    border-radius: 0 0 14px 14px !important;
    overflow: hidden !important;
    min-width: 260px !important;
    display: flex !important;
    flex-direction: column !important;
  }

  /* Header azul con nombre (cuando hay sesion) */
  #topbar .header_user_info .links li:first-child {
    background: linear-gradient(135deg, #0f2040 0%, #1a3a6e 100%) !important;
    border-bottom: none !important;
  }
  #topbar .header_user_info .links li:first-child a.account {
    display: block !important;
    padding: 18px 16px 14px !important;
    background: transparent !important;
    border: none !important;
    text-decoration: none !important;
  }
  #topbar .header_user_info .links li:first-child a.account::before {
    display: none !important;
  }
  #topbar .header_user_info .links li:first-child a.account span {
    color: rgba(255,255,255,.95) !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    display: block !important;
  }
  #topbar .header_user_info .links li:first-child a.account::after {
    content: 'Portal de Distribuidor NsStore' !important;
    display: block !important;
    font-size: 10px !important;
    color: rgba(255,255,255,.4) !important;
    font-weight: 400 !important;
    margin-top: 3px !important;
  }
  #topbar .header_user_info .links li:first-child a.account:hover {
    background: rgba(255,255,255,.04) !important;
    color: #ffffff !important;
  }

  /* Iniciar sesion (sin sesion) - texto BLANCO sobre fondo azul */
  #topbar .header_user_info .links li:first-child a.login {
    display: block !important;
    padding: 18px 16px !important;
    background: transparent !important;
    color: #ffffff !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    text-decoration: none !important;
  }
  #topbar .header_user_info .links li:first-child a.login::before {
    display: none !important;
  }
  #topbar .header_user_info .links li:first-child a.login::after {
    content: 'Accede a tu portal de distribuidor' !important;
    display: block !important;
    font-size: 10px !important;
    color: rgba(255,255,255,.4) !important;
    font-weight: 400 !important;
    margin-top: 3px !important;
  }

  /* Items normales */
  #topbar .header_user_info .links li {
    border-bottom: 1px solid #f1f5f9 !important;
    list-style: none !important;
    background: #ffffff !important;
  }
  #topbar .header_user_info .links li:last-child {
    border-bottom: none !important;
  }
  #topbar .header_user_info .links li a {
    display: block !important;
    padding: 12px 16px 12px 50px !important;
    color: #334155 !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    position: relative !important;
    background: transparent !important;
    transition: background .1s !important;
  }
  #topbar .header_user_info .links li a:hover {
    background: #f8fafc !important;
    color: #1e3a5f !important;
  }

  /* Icono base */
  #topbar .header_user_info .links li a::before {
    font-family: FontAwesome !important;
    position: absolute !important;
    left: 14px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 26px !important;
    height: 26px !important;
    border-radius: 7px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 12px !important;
  }

  /* Mi Cuenta */
  #topbar .header_user_info .links li a[href*="mi-cuenta"]:not(.account) {
    color: #1e3a5f !important;
    font-weight: 600 !important;
  }
  #topbar .header_user_info .links li a[href*="mi-cuenta"]:not(.account)::before {
    content: '\f007' !important;
    background: #eff6ff !important;
    color: #2563eb !important;
  }

  /* Caja */
  #topbar .header_user_info .links li a[href*="pedido-rapido"]::before,
  #topbar .header_user_info .links li a.last::before {
    content: '\f07a' !important;
    background: #f1f5f9 !important;
    color: #475569 !important;
  }

  /* Comparar */
  #topbar .header_user_info .links li a[href*="comparar"]::before {
    content: '\f0c3' !important;
    background: #f1f5f9 !important;
    color: #475569 !important;
  }

  /* Iniciar sesion en el menu (sin sesion) */
  #topbar .header_user_info .links li a[href*="inicio-sesion"],
  #topbar .header_user_info .links li a[href*="authentication"] {
    color: #2563eb !important;
    font-weight: 600 !important;
  }
  #topbar .header_user_info .links li a[href*="inicio-sesion"]::before,
  #topbar .header_user_info .links li a[href*="authentication"]::before {
    content: '\f090' !important;
    background: #eff6ff !important;
    color: #2563eb !important;
  }

  /* Cerrar sesion AL FINAL - rojo */
  #topbar .header_user_info .links li:has(a.logout) {
    order: 99 !important;
    margin-top: auto !important;
  }
  #topbar .header_user_info .links li a.logout {
    color: #dc2626 !important;
    background: #fafafa !important;
    font-weight: 600 !important;
    border-top: 2px solid #fee2e2 !important;
  }
  #topbar .header_user_info .links li a.logout:hover {
    background: #fff5f5 !important;
  }
  #topbar .header_user_info .links li a.logout::before {
    content: '\f08b' !important;
    background: #fff5f5 !important;
    color: #dc2626 !important;
  }
}
